---
title: "Create a single-use connect code for the agent-swarm.dev ChatGPT connector"
method: POST
path: "/api/users/{id}/connector-codes"
tags: ["Users"]
---

# Create a single-use connect code for the agent-swarm.dev ChatGPT connector

`POST /api/users/{id}/connector-codes`

## Request

- Base URL: `http://localhost:3013`
- URL: `http://localhost:3013/api/users/{id}/connector-codes`
- Auth: HTTP bearer

Returns a 10-minute single-use code and the connector URL that carries it. The connector trades the code for an MCP token at POST /api/connector/exchange.

## Path parameters

- `id` string, required

## Request body

- object
  - `label` string

## Response `201`

Connect code, its expiry and the connector URL

- object
  - `code` string, required
  - `expiresAt` string, required
  - `connectUrl` string, required

## Other responses

- `400`: The public API origin or CONNECTOR_CONNECT_URL is not HTTPS
- `401`: Unauthorized
- `404`: User not found

## Changes

- **2026-10-07** `931ce53b3c35`: 1 info
  - endpoint added

[Operation history](https://skmtc.dev/desplega-ai/apis/agent-swarm-api/changes/api/users/:id/connector-codes/post.md)

---

[API](https://skmtc.dev/desplega-ai/apis/agent-swarm-api.md) - [All operations](https://skmtc.dev/desplega-ai/apis/agent-swarm-api/llms.txt) - [OpenAPI document](https://skmtc.dev/desplega-ai/apis/agent-swarm-api/revisions/7e4c7198192a?raw)
