# Set Subscription Token

Source: https://agenta.ai/docs/reference/api/set-subscription-token

`PUT /secrets/{secret_id}/subscription-token`

Base URL: `https://us.cloud.agenta.ai/api` (US cloud), `https://eu.cloud.agenta.ai/api` (EU cloud) or `$AGENTA_HOST/api` (self-hosted). Authentication: `Authorization: ApiKey YOUR_API_KEY`.

Set Subscription Token

## Parameters

- `secret_id` (in path, string (uuid), required)
- `scope` (in query, string, one of: "project", "organization")

## Request body schema

Content type: `application/json` (required)

- `token` (string, required)

## Response schemas

### 200: Successful Response

- `slug` (string, nullable)
- `id` (string (uuid), nullable)
- `kind` (string, one of: "provider_key", "custom_provider", "sso_provider", "webhook_provider", "custom_secret", "channel_secret", "subscription_provider", "oauth_provider", "oauth_grant", "mcp_token", required)
- `data` (object, required)
  - One of, option 1 (StandardProviderDTO):
    - `kind` (string, one of: "mock", "openai", "cohere", "anyscale", "deepinfra", "alephalpha", "groq", "minimax", "mistral", "mistralai", "anthropic", "perplexityai", "together_ai", "openrouter", "gemini", "xai", required)
    - `provider` (object, required)
    - `models` (array of object, nullable)
    - `harnesses` (array of string, nullable)
  - One of, option 2 (MCPStandardProviderDTO):
    - `kind` (string, one of: "mock", "composio", required)
    - `provider` (object, required)
  - One of, option 3 (CustomProviderDTO):
    - `kind` (string, one of: "custom", "azure", "bedrock", "sagemaker", "vertex_ai", "openai", "cohere", "anyscale", "deepinfra", "alephalpha", "groq", "minimax", "mistral", "mistralai", "anthropic", "perplexityai", "together_ai", "openrouter", "gemini", "xai", required)
    - `provider` (object, required)
    - `models` (array of object, required)
    - `harnesses` (array of string, nullable)
    - `protocol` (string, one of: "openai", "anthropic", nullable)
    - `provider_slug` (string, nullable)
    - `model_keys` (array of string, nullable)
  - One of, option 4 (SSOProviderDTO):
    - `provider` (object, required)
  - One of, option 5 (WebhookProviderDTO):
    - `provider` (object, required)
  - One of, option 6 (CustomSecretDTO):
    - `secret` (object, required)
  - One of, option 7 (ChannelSecretDTO):
    - `kind` (string, one of: "slack", "telegram", "whatsapp", "teams", "discord", "agenta", "bridge", required)
    - `channel` (object, required): Vault-stored credential fields only -- things a platform issued and we verify. A bridge's `delivery_url` is not a credential (it is our own address to call, not who is calling us) and does not belong here: it lives on `ChannelConnectionCreate.data`. Unknown keys passed here are silently dropped, so routing a non-credential field through this shape would vanish with no error.
  - One of, option 8 (OAuthProviderDTO):
    - `provider` (object, required)
  - One of, option 9 (OAuthGrantDTO):
    - `grant` (object, required)
  - One of, option 10 (SubscriptionProviderDTO):
    - `provider` (string, one of: "chatgpt", "claude"): The product family behind a hosted subscription connection. Default: `"chatgpt"`.
    - `harnesses` (array of string, nullable)
    - `models` (array of string, nullable)
    - `login` (object, nullable)
    - `login_version` (integer) Default: `0`.
    - `login_generation` (integer) Default: `0`.
    - `login_state` (string, one of: "pending_login", "ready", "needs_login"): How usable the stored subscription login is right now. Default: `"pending_login"`.
    - `login_error` (string, nullable)
    - `login_attempt` (object, nullable)
    - `provider_slug` (string, nullable)
    - `model_keys` (array of string, nullable)
- `header` (object, required)
  - `name` (string, nullable)
  - `description` (string, nullable)
- `lifecycle` (object, nullable)
  - `created_at` (string, nullable)
  - `updated_at` (string, nullable)
  - `updated_by_id` (string, nullable)
  - `updated_by` (string, nullable)
- `write_only` (boolean) Default: `false`.
- `owner` (object, nullable)
  - `kind` (string, one of: "organization", "project", "user", required)
  - `id` (string (uuid), required)
  - `organization_id` (string (uuid), nullable)
- `availability` (string, one of: "all_projects", "selected_projects", nullable)
- `selected_project_ids` (array of string (uuid), nullable)
- `management` (object, nullable)
  - `policy` (string, one of: "manager_only", required)
- `value_status` (object, required)
  - `configured` (boolean, required)
  - `preview` (string, nullable)
  - `configured_keys` (array of string, nullable)
- … more fields: see the OpenAPI specification.

### 422: Validation Error

- `detail` (array of object)
  - `loc` (array of string | integer, required)
  - `msg` (string, required)
  - `type` (string, required)
  - `input` (any)
  - `ctx` (Context)
