Skip to main content
A custom API connects Duet Agents to a REST API that isn’t in the integration or MCP catalogs, such as your own internal service. You store the credential once. Duet Agents adds it to every request on its servers, so AI coworkers and apps can call the API without ever seeing the key.

Check that your API fits

A custom API works when the API:
  • uses one static secret on every request: an API key in a header, a bearer token, or basic auth
  • is served over HTTPS from one base domain
  • takes JSON or file upload (multipart) request bodies
Custom APIs don’t support OAuth or any per-user sign-in, keys sent as query parameters, request signing, or login sessions and cookies.
Not sure? Ask a coworker:
Can we connect Acme Billing as a custom API?
It reads the service’s API docs. If the authentication fits, it shows an Add service as a custom API card with setup steps that links to the create form. If it doesn’t fit, it tells you which part isn’t supported.

Create a custom API

1

Open the form

In the sidebar’s Workspace tab, choose Connections under Manage. Open the Advanced tab and click Add Custom API next to Custom APIs.
2

Fill in the details

3

Save

Click Create Custom API. You’re back on the Advanced tab, with the new custom API in the list.
Fill in Domain so calls only need a path, such as /v1/customers. Without a domain, every call has to use a full URL. Duet Agents sends the credential like this:

How Duet Agents protects the credential

  • Duet Agents encrypts the credential and never shows it again after you save it.
  • Duet Agents adds the credential to each request on its servers. Coworkers, app code and the browser never see it.
  • When a credential is attached, calls must use HTTPS.
  • Calls to private or internal network addresses, such as localhost or 10.x.x.x, are blocked.
  • Duet Agents removes the credential from error responses before showing them.
See Secrets and encryption.

Add documentation

Coworkers and the app editor’s AI read a custom API’s Documentation before they call it. You’ll see “Retrieved custom API documentation” in the chat. The better the docs, the fewer wrong guesses about endpoints and fields.
  • Free text: paste the parts of the API docs that matter, with example requests and responses.
  • OpenAPI: paste the OpenAPI spec as JSON or YAML, then click Validate OpenAPI. You’ll see “OpenAPI spec is valid”, or a list of OpenAPI Validation Issues to fix.
In the app editor, you can also paste an OpenAPI spec into the chat and ask the AI to generate a typed TypeScript client from it. The AI adds the client to the app’s server code.

Who can use a custom API

The Scope decides which apps can call the API:
  • Organization (all apps): every app in your organization. These are also the only custom APIs that AI coworkers can use.
  • Specific Apps: only the apps you selected. Coworkers can’t use these; they show “Restricted to specific apps” in a coworker’s access list.
AI coworkers start with no access to any custom API. To give access, pick the coworker in the bar at the top of Connections, open the Advanced tab and turn on the custom API’s switch under name’s access. You can also approve the coworker’s request in chat. If you create the custom API from the coworker’s Add service as a custom API card and keep the Organization (all apps) scope, that coworker gets access right away. Custom API access is on (Full access) or off, with no read-only level.

Use a custom API in chat

Call our billing API and list the invoices that failed in the last 7 days.
Look up customer 4821 in the Acme API and tell me their plan.
Each call appears as a step such as “Called GET /v1/invoices”. In the coworker’s activity history, calls appear as “Called custom API”. A call times out after 30 seconds, or 120 seconds when it uploads files.

Use a custom API in apps

The AI in the app editor writes the code. It calls the custom API through Duet Agents’s helpers, which add the credential for you:
Browser code uses callCustomApi from @/client-lib/custom-api-client the same way. App code never reads the key from environment variables or sets the auth header itself. See Working with code.

Edit or delete a custom API

Custom APIs are listed under Custom APIs on the Advanced tab of Connections, with their Type, Domain and Scope. The search box at the top of the page filters them too. To edit one, click the pencil icon (Edit) next to it. On Edit Custom API:
  • You can change the type, name, API key header, domain, scope, description and documentation.
  • “Auth type can’t be changed after creation.” To switch auth type, create a new custom API and delete the old one.
  • To replace the credential, fill in the credential fields. “Leave all credential fields blank to keep the current values, or fill them all in to replace them.”
Click Save Changes. Back to Connections leaves without saving. To delete one, click the trash icon (Delete) next to it and confirm. This permanently deletes the custom API. Apps and coworkers that use it lose access.

App connections

One Duet Agents app can call another app’s API through an app connection. The coworker you ask must have access to both apps. In Duet Agents chat or Slack, ask for example:
Show the tasks from our To-Do List app in Project Tracker.
The coworker works out which endpoints of the other app it needs, then asks you to approve. In Duet Agents, a Let app call other app card lists the Allowed endpoints and warns that it “Creates an API token for other app in your name. Anyone who uses or edits app can call these other app endpoints as you.” Click Approve connection or Decline. In Slack, the coworker posts a card with the same buttons. A Slack request expires after 24 hours. When you approve, Duet Agents creates a custom API that only the calling app can use, with the token stored like any other credential. The app calls it from its server code. Approving again for the same two apps updates the allowed endpoints of the existing connection. The app connection shows up under Custom APIs. You can change its name, description and documentation, but not its domain, header, scope, apps or credential. Delete it to revoke the token. Calls only work once the other app is published.