# Connect an API

> Save the address and key of an API once as an API connection, then call it from a workflow with the HTTP request block.

To call a service's HTTP API from a workflow, save its address and key as an API connection, then choose that connection in an [HTTP request](https://outwin.ai/docs/reference/blocks/http-request/) block. An API connection holds a name, a base URL, and how to authenticate. Any number of blocks can use one connection. Each block adds a path, and the host is always the connection's. The base URL is optional. A connection saved without one [only receives events](https://outwin.ai/docs/build/connect-an-api/#add-a-connection-that-only-receives-events), and no HTTP request block can use it.

Saving a connection sends nothing to the API. The add dialog says so: "An HTTP API your workflows call with the HTTP request block. Nothing is sent to it until a workflow runs." There is no test request and no health status, so the chip beside a connection reads `Ready` or `Disabled`.

## Add an API connection

You need the member role or higher in the workspace. These steps add a connection that workflows call, so have the base URL of the API and its token, key, or user name and password at hand. For a service that only sends you events, [add a connection that only receives events](https://outwin.ai/docs/build/connect-an-api/#add-a-connection-that-only-receives-events).

1. Open **Connections** and select **Add API connection**, either from the panel's **+** menu or from the page header. An empty Connections page offers the same action beside the line "For a service with no MCP server, add an API connection and call it with the HTTP request block."
2. In **Name**, enter the name people will choose in a block.
3. In **Base URL**, enter the address every request goes to, such as `https://api.example.com`.
4. Under **Authentication**, choose how the API expects its credential and fill in the fields that appear.
5. Select **Add connection**. A message reads `Added <name>` and the connection opens on its own page.

The connection also appears in the Connections list with the MCP connections, sorted by name. Once a workspace has an API connection, the table shows a **Kind** column that reads `MCP server` or `API · <host>`. For a connection with no base URL it reads `API · receives events only`.

| Field | What to enter | Limits |
| --- | --- | --- |
| **Name** | The name shown in a block's connection list and in run messages. The field shows `SendGrid` as a placeholder. | Up to 40 characters. No two API connections in a workspace can share a name, whatever the capitalization. |
| **Base URL** | The host, with an optional path prefix. The field shows `https://api.sendgrid.com` as a placeholder. Its helper line reads "Every request goes to this host. A block adds the path, for example /v3/mail/send. Leave it empty, with Authentication set to None, for a connection that only receives events." With a path prefix, every request stays under that prefix. | Optional. A value starts with `https://` and names a public host. No user name, password, or query string. Up to 2,048 characters. A trailing slash is removed. |
| **Authentication** | One of the four options in the next table. | The secret can have up to 4,096 characters. |

| Authentication option | Fields | What each request carries |
| --- | --- | --- |
| **Bearer token** (the default) | **Token** | An `Authorization` header with the token as a bearer token. |
| **API key header** | **Header name**, with the placeholder `X-Api-Key`, and **Header value** | The header you name, with the value you enter. The name can have up to 64 characters. |
| **User name and password** | **User name** and **Password** | An `Authorization` header with HTTP Basic credentials. **User name** takes up to 256 characters and no colon. |
| **None** | No fields | No authentication header. |

A key carried in the query string is not supported. A workspace can have 50 API connections, counted apart from its MCP connections.

### Add a connection that only receives events

Shopify, HubSpot, Slack, Twilio, Zoom, Discord, and Intercom sign every event they send with one secret for the whole account or app. To receive events from such a service without calling its API, add a connection with no base URL. It holds that secret, and a Webhook block that names the connection uses it to check each delivery.

1. Open **Connections** and select **Add API connection**.
2. In **Name**, enter the name people will choose in a Webhook block.
3. Leave **Base URL** empty.
4. Under **Authentication**, select **None**. The dialog opens on **Bearer token**, and a connection with no base URL cannot hold a credential.
5. Select **Add connection**. The connection opens on its own page, which starts "A service that sends events. Webhook blocks use this connection to check that a delivery is from it. It has no base URL, so workflows cannot call it."
6. Under **Receiving events**, paste the service's signing secret and select **Save**.

An HTTP request block cannot use this connection. The block's **Connection** list does not show it, and a workflow whose block names it [cannot be published](https://outwin.ai/docs/reference/blocks/http-request/#when-publishing).

To call the service's API later, enter a base URL and its credential under **Settings** and select **Save changes**. HTTP request blocks can then use the connection. To stop calling it again, set **Authentication** to **None** and clear **Base URL**. Neither change alters the secret under **Receiving events**.

The name rules, the limit of 50, turning off, deleting, and the roles are the same as for any other API connection.

### Messages when you save

| Message | Cause |
| --- | --- |
| `An API connection named "<name>" already exists` | Another API connection in the workspace has that name. |
| `Add a base URL, or set Authentication to None for a connection that only receives events.` | **Base URL** is empty and **Authentication** is not **None**. |
| `Enter the full URL, starting with https://` | **Base URL** is filled in and has no scheme. |
| `The base URL must start with https://` | The base URL uses another scheme. |
| `The base URL must point at a public host` | The host is local or on a private network. |
| `Do not put credentials in the URL. Use the authentication fields` | The base URL holds a user name or password. |
| `Leave the query string out. Add query parameters in the block.` | The base URL holds a `?`. |
| `For the Authorization header, choose Bearer token or User name and password` | **Header name** is `Authorization`. |
| `"<name>" cannot be used as an authentication header` | **Header name** is a header the request sets for itself, such as `Host`, `Cookie`, or `Content-Type`. |
| `A user name cannot contain a colon.` | **User name** holds a `:`. |
| `A token can hold only letters, digits and punctuation, on one line` | The token holds a line break, or a character other than a basic Latin letter, a digit, or punctuation. The same message starts with `A header value` for an API key header. |
| `A workspace can have at most 50 API connections` | The workspace is at its limit. Delete a connection first. |

## How the secret is stored

The line under the secret field reads "Encrypted before it is stored. After saving, nobody can read it back, only replace it." That holds for every role, including owners and admins. There is no control that reveals a saved secret.

After saving, the page shows a hint in place of the secret: `…abcd`, the last four characters, for a secret of 12 characters or more, and `…` alone for a shorter one. The **Authentication** line reads `Bearer token …abcd`, `<user name> · password …abcd`, `<Header name> header …abcd`, or `No authentication`.

Because the secret lives in the connection, you never type a key into a block, a header, a query parameter, or a prompt. Someone can view or copy a workflow without seeing the key, and replacing the secret once changes it for every block that uses the connection.

## Change, turn off, or delete a connection

A connection's page lists its **Base URL**, **Authentication**, the date under **Secret replaced**, and the date under **Added**. For a connection that only receives events, **Base URL** reads "None. This connection only receives events." Renaming a connection changes nothing for the blocks that use it.

The page also has a **Receiving events** section, for a service that sends events to a [Webhook block](https://outwin.ai/docs/reference/triggers-approvals-and-waits/#webhook-settings). Its text reads "If this service signs the events it sends with one secret for the whole account or app (Shopify, HubSpot, Slack, Twilio, Zoom, Discord and Intercom do), save it here. A Webhook block that names this connection then accepts only what the service really sent." Paste the secret into the field, which shows "Paste the signing secret", and select **Save**. Afterward the section shows only a masked hint and the saved date, with **Replace** and **Remove**. This secret is separate from the one the connection sends with requests. If you remove it, Webhook blocks that use the connection no longer verify their deliveries. A viewer sees "No secret saved." when nothing is saved.

To edit the connection, change the fields under **Settings** and select **Save changes**. A message reads `Saved <name>`. To replace the secret, type the new one. While the field is empty its label reads "Stored as …abcd. Leave blank to keep it". The next request uses the new secret, and you do not republish any workflow. A viewer sees "Only members can change a connection's settings." in place of the form.

If you change the base URL, the authentication option, or the header name, enter the secret again. The field says "The base URL or header name changed, so enter this again. A saved secret stays with the URL it was entered for."

To stop requests without losing the secret, turn off the **Enabled** switch or select **Turn off** in the **⋯** menu. The line beside the switch changes from "Workflows may send requests with this connection." to "HTTP request blocks that use this connection fail until it is turned back on." A message reads `<name> turned off: blocks that use it will fail until it is back on`. Select **Turn on** to resume. The switch governs sending only. While a connection is off, Webhook blocks still check deliveries with the secret under **Receiving events**.

Admins and owners can delete a connection from the **Delete connection** section or with **Delete** in the **⋯** menu. The section warns "HTTP request blocks that use it will fail until they are pointed at another connection. This cannot be undone." A dialog titled `Remove <name>?` asks you to confirm with **Remove** and says "Published workflows that use this connection keep running, but their HTTP request blocks will fail until they are pointed at another connection. The stored secret is deleted. This cannot be undone."

## Who can do what

| Role | What they can do |
| --- | --- |
| Viewer | See the list and each connection's name, base URL, and secret hint. |
| Member | Add and edit a connection, replace its secret, turn it off or on, and save, replace, or remove the secret under **Receiving events**. |
| Owners and admins | Everything a member can do, and delete a connection. |

Choosing a connection in a block requires edit access to the workflow's project. Anyone with that access can send requests to the connection's host with its credential. They cannot send the credential anywhere else, because a block cannot change the host and a redirect is not followed.

## Use the connection in a workflow

Add an **HTTP request** block and choose the connection under **Connection**. The [HTTP request reference](https://outwin.ai/docs/reference/blocks/http-request/) lists the block's settings, its output, and [what a request costs](https://outwin.ai/docs/reference/blocks/http-request/#what-it-costs). For a complete example, [send an email with SendGrid](https://outwin.ai/docs/build/connect-an-api/send-an-email-with-sendgrid/).

To run a workflow when a service reports that something happened, give the service the URL of a Webhook block. Each of these guides covers one service the block names as a **Source**:

- [Start a workflow from Airtable events](https://outwin.ai/docs/build/connect-an-api/start-a-workflow-from-airtable-events/)
- [Start a workflow from Asana events](https://outwin.ai/docs/build/connect-an-api/start-a-workflow-from-asana-events/)
- [Start a workflow from Calendly events](https://outwin.ai/docs/build/connect-an-api/start-a-workflow-from-calendly-events/)
- [Start a workflow from Discord events](https://outwin.ai/docs/build/connect-an-api/start-a-workflow-from-discord-events/)
- [Start a workflow from Discord interactions](https://outwin.ai/docs/build/connect-an-api/start-a-workflow-from-discord-interactions/)
- [Start a workflow from GitHub events](https://outwin.ai/docs/build/connect-an-api/start-a-workflow-from-github-events/)
- [Start a workflow from GitLab events](https://outwin.ai/docs/build/connect-an-api/start-a-workflow-from-gitlab-events/)
- [Start a workflow from Gmail events](https://outwin.ai/docs/build/connect-an-api/start-a-workflow-from-gmail-events/)
- [Start a workflow from Google Calendar events](https://outwin.ai/docs/build/connect-an-api/start-a-workflow-from-google-calendar-events/)
- [Start a workflow from Google Drive events](https://outwin.ai/docs/build/connect-an-api/start-a-workflow-from-google-drive-events/)
- [Start a workflow from HubSpot events](https://outwin.ai/docs/build/connect-an-api/start-a-workflow-from-hubspot-events/)
- [Start a workflow from Intercom events](https://outwin.ai/docs/build/connect-an-api/start-a-workflow-from-intercom-events/)
- [Start a workflow from Jira events](https://outwin.ai/docs/build/connect-an-api/start-a-workflow-from-jira-events/)
- [Start a workflow from Linear events](https://outwin.ai/docs/build/connect-an-api/start-a-workflow-from-linear-events/)
- [Start a workflow from Mailchimp events](https://outwin.ai/docs/build/connect-an-api/start-a-workflow-from-mailchimp-events/)
- [Start a workflow from Mailchimp Transactional events](https://outwin.ai/docs/build/connect-an-api/start-a-workflow-from-mailchimp-transactional-events/)
- [Start a workflow from Microsoft Graph events](https://outwin.ai/docs/build/connect-an-api/start-a-workflow-from-microsoft-graph-events/)
- [Start a workflow from Notion events](https://outwin.ai/docs/build/connect-an-api/start-a-workflow-from-notion-events/)
- [Start a workflow from Paddle events](https://outwin.ai/docs/build/connect-an-api/start-a-workflow-from-paddle-events/)
- [Start a workflow from PayPal events](https://outwin.ai/docs/build/connect-an-api/start-a-workflow-from-paypal-events/)
- [Start a workflow from Postmark events](https://outwin.ai/docs/build/connect-an-api/start-a-workflow-from-postmark-events/)
- [Start a workflow from Resend events](https://outwin.ai/docs/build/connect-an-api/start-a-workflow-from-resend-events/)
- [Start a workflow from SendGrid events](https://outwin.ai/docs/build/connect-an-api/start-a-workflow-from-sendgrid-events/)
- [Start a workflow from Shopify events](https://outwin.ai/docs/build/connect-an-api/start-a-workflow-from-shopify-events/)
- [Start a workflow from Slack events](https://outwin.ai/docs/build/connect-an-api/start-a-workflow-from-slack-events/)
- [Start a workflow from Slack interactivity](https://outwin.ai/docs/build/connect-an-api/start-a-workflow-from-slack-interactivity/)
- [Start a workflow from Slack slash commands](https://outwin.ai/docs/build/connect-an-api/start-a-workflow-from-slack-slash-commands/)
- [Start a workflow from Square events](https://outwin.ai/docs/build/connect-an-api/start-a-workflow-from-square-events/)
- [Start a workflow from Standard Webhooks events](https://outwin.ai/docs/build/connect-an-api/start-a-workflow-from-standard-webhooks-events/)
- [Start a workflow from Stripe events](https://outwin.ai/docs/build/connect-an-api/start-a-workflow-from-stripe-events/)
- [Start a workflow from Twilio events](https://outwin.ai/docs/build/connect-an-api/start-a-workflow-from-twilio-events/)
- [Start a workflow from Twilio incoming messages and calls](https://outwin.ai/docs/build/connect-an-api/start-a-workflow-from-twilio-incoming-messages-and-calls/)
- [Start a workflow from Typeform events](https://outwin.ai/docs/build/connect-an-api/start-a-workflow-from-typeform-events/)
- [Start a workflow from WooCommerce events](https://outwin.ai/docs/build/connect-an-api/start-a-workflow-from-woocommerce-events/)
- [Start a workflow from Zendesk events](https://outwin.ai/docs/build/connect-an-api/start-a-workflow-from-zendesk-events/)
- [Start a workflow from Zoom events](https://outwin.ai/docs/build/connect-an-api/start-a-workflow-from-zoom-events/)

A copy of a workflow uses the same connection as the original. Its HTTP request block sends real requests to the same API, so check where a practice copy sends before you [test it](https://outwin.ai/docs/run/test-before-publishing/).
