---
title: "Exchange OAuth code for tokens"
method: POST
path: "/api/integrations/{provider}/callback"
tags: ["v1", "integrations"]
---

# Exchange OAuth code for tokens

`POST /api/integrations/{provider}/callback`

## Path parameters

- `provider` string, required — Provider name for integrations. Can be any string value, including custom provider names.

## Request body

- BodyPostV1ExchangeOauthCodeForTokens
  - `code` string, required
  - `state_token` string, required

## Response `200`

Successful Response

- CredentialsMetaResponse
  - `id` string, required
  - `provider` string, required
  - `type` 'api_key' | 'oauth2' | 'user_password' | 'host_scoped', required
  - `title` string, nullable, required
  - `scopes` string[], nullable, required
  - `username` string, nullable, required
  - `host` string, nullable — Host pattern for host-scoped or MCP server URL for MCP credentials
  - `is_managed` boolean

## Other responses

- `401` — Authentication required
- `422` — Validation Error

---

[API](https://skmtc.net/significant-gravitas/apis/autogpt-agent-server.md) · [All operations](https://skmtc.net/significant-gravitas/apis/autogpt-agent-server/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/significant-gravitas/autogpt-agent-server/versions/382041c7ecb2/schema)
