---
title: "Import Oauth Token"
method: POST
path: "/v2/auth/tokens/import"
tags: ["Auth Service (v2)"]
---

# Import Oauth Token

`POST /v2/auth/tokens/import`

Persist a directly-obtained OAuth token (no authorization-code exchange).

The Slack managed-install flow receives a bot token inline from
``apps.managedInstall`` instead of through the browser OAuth redirect. This
stores it (Fernet-encrypted at rest, via ``create_oauth_token``) for the
caller's org/user against an existing provider. Requiring the provider to
already exist in the caller's org scopes the write and blocks cross-org
token creation. The token value is never logged or returned.

## Request body

- OAuthTokenImportRequest — Import a directly-obtained OAuth token (no authorization-code exchange). Used by the Slack managed-install flow, which receives a bot token inline from ``apps.managedInstall`` rather than via the browser OAuth redirect. The token is persisted for the caller's org/user against ``provider_id`` (which must already exist in the caller's org).
  - `provider_id` string, required
  - `access_token` string, required
  - `refresh_token` string, nullable
  - `expires_in_seconds` integer, nullable
  - `scopes` string[]
  - `metadata` object, nullable
  - `is_default` boolean

## Response `200`

Successful Response

- OAuthTokenImportResponse — Response for a token import — the created token id only, no secrets.
  - `token_id` string, required

## Other responses

- `422` — Validation Error

---

[API](https://skmtc.net/langchain-ai/apis/langsmith-deployment-control-plane-api.md) · [All operations](https://skmtc.net/langchain-ai/apis/langsmith-deployment-control-plane-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/langchain-ai/langsmith-deployment-control-plane-api/revisions/a0cd098699b4/schema)
