Skip to main content
Docs

Search guides and API endpoints, for example “Idempotency-Key” or “submit job”.

    API reference

    Auth and API keys

    On this page

    Log in with email and password

    POST/api/v1/auth/login-email

    No auth

    Request body

    application/x-www-form-urlencoded

    Request fields
    FieldTypeDescription
    client_idstring | null
    client_secretstring (password) | null
    grant_typestring | null

    Limits: pattern ^password$

    passwordrequiredstring (password)
    scopestring

    Default: ""

    usernamerequiredstring

    Example request

    curl -X POST "https://api.cognichem.com/api/v1/auth/login-email" \
      --data-urlencode '[email protected]' \
      --data-urlencode 'password=YOUR_PASSWORD'

    Responses

    Successful Response · application/json · TokenResponse

    Response fields
    FieldTypeDescription
    access_tokenrequiredstring
    expires_atrequiredinteger
    expires_inrequiredinteger
    refresh_tokenrequiredstring
    token_typestring

    Default: "bearer"

    Example 200 response
    {
      "access_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
      "expires_at": 1716123456,
      "expires_in": 3600,
      "refresh_token": "v1.MRj...",
      "token_type": "bearer"
    }

    Check credentials

    GET/api/v1/auth/check

    API key or token

    Example request

    curl "https://api.cognichem.com/api/v1/auth/check" \
      -H "X-Api-Key: $COGNICHEM_API_KEY"

    Responses

    Successful Response · application/json · MessageResponse

    Response fields
    FieldTypeDescription
    messagerequiredstring

    Refresh an access token (deprecated GET)

    GET/api/v1/auth/refresh

    No authDeprecated

    Parameters

    Query parameters
    NameTypeDescription
    refresh_tokenrequiredstring

    Example request

    curl "https://api.cognichem.com/api/v1/auth/refresh?refresh_token=REFRESH_TOKEN"

    Responses

    Successful Response · application/json · TokenResponse

    Response fields
    FieldTypeDescription
    access_tokenrequiredstring
    expires_atrequiredinteger
    expires_inrequiredinteger
    refresh_tokenrequiredstring
    token_typestring

    Default: "bearer"

    Example 200 response
    {
      "access_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
      "expires_at": 1716123456,
      "expires_in": 3600,
      "refresh_token": "v1.MRj...",
      "token_type": "bearer"
    }

    Refresh an access token

    POST/api/v1/auth/refresh

    No auth

    Request body

    application/json · RefreshTokenRequest

    Request fields
    FieldTypeDescription
    refresh_tokenrequiredstring

    Limits: min length 1

    Example request

    curl -X POST "https://api.cognichem.com/api/v1/auth/refresh" \
      -H "Content-Type: application/json" \
      -d '{
      "refresh_token": "v1.MRj..."
    }'

    Responses

    Successful Response · application/json · TokenResponse

    Response fields
    FieldTypeDescription
    access_tokenrequiredstring
    expires_atrequiredinteger
    expires_inrequiredinteger
    refresh_tokenrequiredstring
    token_typestring

    Default: "bearer"

    Example 200 response
    {
      "access_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
      "expires_at": 1716123456,
      "expires_in": 3600,
      "refresh_token": "v1.MRj...",
      "token_type": "bearer"
    }

    Log out

    GET/api/v1/auth/logout

    API key or token

    Example request

    curl "https://api.cognichem.com/api/v1/auth/logout" \
      -H "X-Api-Key: $COGNICHEM_API_KEY"

    Responses

    Successful Response · application/json · MessageResponse

    Response fields
    FieldTypeDescription
    messagerequiredstring

    List API keys

    GET/api/v1/auth/api-keys

    Access token only

    Example request

    curl "https://api.cognichem.com/api/v1/auth/api-keys" \
      -H "Authorization: Bearer $COGNICHEM_ACCESS_TOKEN"

    Responses

    Successful Response · application/json · ApiKeyListResponse

    Response fields
    FieldTypeDescription
    countrequiredinteger
    keys[]requiredApiKeyListItem[]
    keys.allow_structure_searchboolean

    Default: false

    keys.created_atrequiredstring (date-time)
    keys.expires_atstring (date-time) | null
    keys.idrequiredstring
    keys.key_prefixstring | null
    keys.last_used_atstring (date-time) | null
    keys.namerequiredstring
    keys.revoked_atstring (date-time) | null
    keys.rotated_atstring (date-time) | null
    keys.scopes[]string[]
    keys.spend_accrued_usdnumber | null
    keys.spend_ceiling_usdnumber | null
    limitrequiredinteger
    Example 200 response
    {
      "count": 1,
      "keys": [
        {
          "created_at": "2026-05-21T12:00:00Z",
          "id": "550e8400-e29b-41d4-a716-446655440000",
          "key_prefix": "a1b2c3d4…",
          "name": "Default",
          "scopes": [
            "read",
            "write"
          ]
        }
      ],
      "limit": 50
    }

    Create an API key

    POST/api/v1/auth/api-keys

    Access token only

    Request body

    application/json · CreateApiKeyRequest

    Request fields
    FieldTypeDescription
    allow_structure_searchboolean

    Default: false

    expires_atstring (date-time) | null
    namerequiredstring

    Limits: min length 1, max length 64

    scopes[]string[] | null
    spend_ceiling_usdnumber | null

    Limits: ≥ 0

    Example request

    curl -X POST "https://api.cognichem.com/api/v1/auth/api-keys" \
      -H "Authorization: Bearer $COGNICHEM_ACCESS_TOKEN" \
      -H "Content-Type: application/json" \
      -d '{
      "name": "CI deploy"
    }'

    Responses

    Successful Response · application/json · ApiKeyCreatedResponse

    Response fields
    FieldTypeDescription
    allow_structure_searchboolean

    Default: false

    api_keyrequiredstring
    created_atrequiredstring (date-time)
    expires_atstring (date-time) | null
    idrequiredstring
    key_prefixstring | null
    last_used_atstring (date-time) | null
    namerequiredstring
    revoked_atstring (date-time) | null
    rotated_atstring (date-time) | null
    scopes[]string[]
    spend_accrued_usdnumber | null
    spend_ceiling_usdnumber | null
    Example 201 response
    {
      "api_key": "f47ac10b-58cc-4372-a567-0e02b2c3d479",
      "created_at": "2026-05-21T12:00:00Z",
      "id": "550e8400-e29b-41d4-a716-446655440000",
      "key_prefix": "a1b2c3d4…",
      "name": "CI deploy",
      "scopes": [
        "read",
        "write"
      ]
    }

    Get an API key

    GET/api/v1/auth/api-keys/{key_id}

    Access token only

    Parameters

    Path parameters
    NameTypeDescription
    key_idrequiredstring (uuid)

    Example request

    curl "https://api.cognichem.com/api/v1/auth/api-keys/KEY_ID" \
      -H "Authorization: Bearer $COGNICHEM_ACCESS_TOKEN"

    Responses

    Successful Response · application/json · ApiKeyListItem

    Response fields
    FieldTypeDescription
    allow_structure_searchboolean

    Default: false

    created_atrequiredstring (date-time)
    expires_atstring (date-time) | null
    idrequiredstring
    key_prefixstring | null
    last_used_atstring (date-time) | null
    namerequiredstring
    revoked_atstring (date-time) | null
    rotated_atstring (date-time) | null
    scopes[]string[]
    spend_accrued_usdnumber | null
    spend_ceiling_usdnumber | null
    Example 200 response
    {
      "created_at": "2026-05-21T12:00:00Z",
      "id": "550e8400-e29b-41d4-a716-446655440000",
      "key_prefix": "a1b2c3d4…",
      "last_used_at": "2026-05-21T14:30:00Z",
      "name": "CI deploy",
      "scopes": [
        "read",
        "write"
      ]
    }

    Rename an API key

    PATCH/api/v1/auth/api-keys/{key_id}

    Access token only

    Parameters

    Path parameters
    NameTypeDescription
    key_idrequiredstring (uuid)

    Request body

    application/json · RenameApiKeyRequest

    Request fields
    FieldTypeDescription
    allow_structure_searchboolean | null
    namestring | null

    Limits: min length 1, max length 64

    Example request

    curl -X PATCH "https://api.cognichem.com/api/v1/auth/api-keys/KEY_ID" \
      -H "Authorization: Bearer $COGNICHEM_ACCESS_TOKEN" \
      -H "Content-Type: application/json" \
      -d '{
      "allow_structure_search": false,
      "name": "Production"
    }'

    Responses

    Successful Response · application/json · ApiKeyListItem

    Response fields
    FieldTypeDescription
    allow_structure_searchboolean

    Default: false

    created_atrequiredstring (date-time)
    expires_atstring (date-time) | null
    idrequiredstring
    key_prefixstring | null
    last_used_atstring (date-time) | null
    namerequiredstring
    revoked_atstring (date-time) | null
    rotated_atstring (date-time) | null
    scopes[]string[]
    spend_accrued_usdnumber | null
    spend_ceiling_usdnumber | null
    Example 200 response
    {
      "created_at": "2026-05-21T12:00:00Z",
      "id": "550e8400-e29b-41d4-a716-446655440000",
      "key_prefix": "a1b2c3d4…",
      "last_used_at": "2026-05-21T14:30:00Z",
      "name": "CI deploy",
      "scopes": [
        "read",
        "write"
      ]
    }

    Revoke an API key

    DELETE/api/v1/auth/api-keys/{key_id}

    Access token only

    Parameters

    Path parameters
    NameTypeDescription
    key_idrequiredstring (uuid)

    Example request

    curl -X DELETE "https://api.cognichem.com/api/v1/auth/api-keys/KEY_ID" \
      -H "Authorization: Bearer $COGNICHEM_ACCESS_TOKEN"

    Responses

    Successful Response

    Rotate an API key

    POST/api/v1/auth/api-keys/{key_id}/rotate

    Access token only

    Parameters

    Path parameters
    NameTypeDescription
    key_idrequiredstring (uuid)

    Example request

    curl -X POST "https://api.cognichem.com/api/v1/auth/api-keys/KEY_ID/rotate" \
      -H "Authorization: Bearer $COGNICHEM_ACCESS_TOKEN"

    Responses

    Successful Response · application/json · ApiKeyCreatedResponse

    Response fields
    FieldTypeDescription
    allow_structure_searchboolean

    Default: false

    api_keyrequiredstring
    created_atrequiredstring (date-time)
    expires_atstring (date-time) | null
    idrequiredstring
    key_prefixstring | null
    last_used_atstring (date-time) | null
    namerequiredstring
    revoked_atstring (date-time) | null
    rotated_atstring (date-time) | null
    scopes[]string[]
    spend_accrued_usdnumber | null
    spend_ceiling_usdnumber | null
    Example 200 response
    {
      "api_key": "f47ac10b-58cc-4372-a567-0e02b2c3d479",
      "created_at": "2026-05-21T12:00:00Z",
      "id": "550e8400-e29b-41d4-a716-446655440000",
      "key_prefix": "a1b2c3d4…",
      "name": "CI deploy",
      "scopes": [
        "read",
        "write"
      ]
    }