# Custom integrations

> Connect any outside API from its OpenAPI spec, and call it from your app without exposing the API key.


Connectors cover popular services like Google Calendar and Slack. For any other API, add it from its **OpenAPI spec** (OpenAPI 3 or Swagger 2, in JSON or YAML). Custom integrations are part of **Pro** and **Pro+**.

## Add an integration

1. Open **Dashboard**, then **Integrations**.
2. Give the spec's web address, such as `https://api.example.com/openapi.json`, or paste the spec.
3. If the API needs a key, choose how it takes it: a **Bearer token**, a **header** or a **parameter in the address**, and name the secret that holds it, such as `WEATHER_API_KEY`. When the spec says how, Draftship fills in the header or parameter name.
4. Choose **Add integration**, then save the key's value under **Secrets** with that name.

Each integration gets a short name, such as `weather-api`, and lists its operations. You can change the key settings or remove it later.

## Use it

Ask the AI in the chat, for example "Show the 3-day forecast for the city the user types, using the Weather API integration." The AI sees the operations and writes the calls for you. In code, a call looks like this:

```ts
const r = await ds.integrations.Custom.call("weather-api", "getForecast", {
  params: { city: "Lisbon", days: 3 },
});
if (r.ok) console.log(r.data);
```

`params` holds the operation's path, query and header parameters by name; `body` is sent as JSON to operations that take one. The answer is `{ status, ok, data }`.

## Security

- The API key is added by Draftship on the server. It never reaches the browser or your app's code.
- Calls from the browser need a signed-in user, and each person can make up to 120 calls an hour. Backend functions and API keys aren't limited per person.
- Draftship only calls public addresses. Requests to private networks are refused.

An app can have up to 20 custom integrations, each with up to 300 operations.
