***

title: generateUrl
slug: /reference/typescript/agents/configuration/serverless-adapter/generate-url
description: Generate the platform-specific invocation URL for a deployed function.
max-toc-depth: 3
---------------------

For a complete index of all SignalWire documentation pages, fetch https://signalwire.com/docs/llms.txt

Generate the platform-specific invocation URL for a deployed function.
Uses environment variables as defaults, with optional overrides.

## **Parameters**

<ParamField path="opts" type="object" toc={true}>
  Optional URL generation overrides.
</ParamField>

<Indent>
  <ParamField path="opts.region" type="string" toc={true}>
    Cloud region override. Defaults to `AWS_REGION` or `FUNCTION_REGION` env var.
  </ParamField>

  <ParamField path="opts.projectId" type="string" toc={true}>
    GCP project ID override. Defaults to `GCLOUD_PROJECT` env var.
  </ParamField>

  <ParamField path="opts.functionName" type="string" toc={true}>
    Function name override. Defaults to `AWS_LAMBDA_FUNCTION_NAME` env var or
    `"agent"`.
  </ParamField>

  <ParamField path="opts.stage" type="string" toc={true}>
    API Gateway stage override (Lambda only). Defaults to `"prod"`.
  </ParamField>

  <ParamField path="opts.apiId" type="string" toc={true}>
    API Gateway ID override (Lambda only). Defaults to `"API_ID"`.
  </ParamField>
</Indent>

## **Returns**

`string` -- The constructed URL string.

## **Example**

```typescript {4-8}
import { ServerlessAdapter } from '@signalwire/sdk';

const adapter = new ServerlessAdapter('gcf');
const url = adapter.generateUrl({
  projectId: 'my-project',
  region: 'us-central1',
  functionName: 'my-agent',
});
console.log(url);
// "https://us-central1-my-project.cloudfunctions.net/my-agent"
```