---
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' | 'device_code', 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
  - `mcp_auth_scheme` 'basic' | 'bearer', nullable — Manual authorization scheme for MCP credentials
  - `is_managed` boolean

## Other responses

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

## Changes

- **2026-09-07** `d3946c727d24` — 1 info
  - added the optional property `mcp_auth_scheme` to the response with the `200` status
- **2026-08-20** `ae1be5efc67a` — 1 warning
  - added the new `device_code` enum value to the `type` response property for the response status `200`

[Change history](https://skmtc.dev/significant-gravitas/apis/autogpt-agent-server/changes/api/integrations/:provider/callback/post.md)

---

[API](https://skmtc.dev/significant-gravitas/apis/autogpt-agent-server.md) · [All operations](https://skmtc.dev/significant-gravitas/apis/autogpt-agent-server/llms.txt) · [OpenAPI document](https://skmtc.dev/significant-gravitas/apis/autogpt-agent-server/revisions/9a062c6d49b5?raw)
