---
title: "Create Credentials"
method: POST
path: "/api/integrations/{provider}/credentials"
tags: ["v1", "integrations"]
---

# Create Credentials

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

## Path parameters

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

## Request body

- union
  - OAuth2Credentials
    - `id` string
    - `provider` string, required
    - `title` string, nullable
    - `is_managed` boolean
    - `metadata` object
    - `type` 'oauth2'
    - `username` string, nullable
    - `access_token` string, password, required
    - `access_token_expires_at` integer, nullable
    - `refresh_token` string, password, nullable
    - `refresh_token_expires_at` integer, nullable
    - `scopes` string[], required
  - APIKeyCredentials
    - `id` string
    - `provider` string, required
    - `title` string, nullable
    - `is_managed` boolean
    - `metadata` object
    - `type` 'api_key'
    - `api_key` string, password, required
    - `expires_at` integer, nullable — Unix timestamp (seconds) indicating when the API key expires (if at all)
  - UserPasswordCredentials
    - `id` string
    - `provider` string, required
    - `title` string, nullable
    - `is_managed` boolean
    - `metadata` object
    - `type` 'user_password'
    - `username` string, password, required
    - `password` string, password, required
  - HostScopedCredentials
    - `id` string
    - `provider` string, required
    - `title` string, nullable
    - `is_managed` boolean
    - `metadata` object
    - `type` 'host_scoped'
    - `host` string, required — The host/URI pattern to match against request URLs
    - `headers` object — Key-value header map to add to matching requests

## Response `201`

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)
