> ## Documentation Index
> Fetch the complete documentation index at: https://docs.zelto.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Test an AI provider key

> Re-checks the stored key with a no-cost provider call and records the result. A rejected key is still a 200, with `lastTestStatus: "failed"`; the key is reported, not removed.



## OpenAPI

````yaml /docs-openapi.json post /v1/ai-keys/{id}/test
openapi: 3.1.0
info:
  title: Zelto REST API
  version: v1
  description: >-
    Programmatic access to your Zelto organization. Every endpoint is scoped to
    the organization the API key belongs to. Mint a key at Settings →
    Integrations → API integration.
servers:
  - url: https://api.zelto.ai
    description: Production
security:
  - bearerAuth: []
tags:
  - name: Monitors
    description: Filtered, asynchronous exports of stored monitor results.
  - name: Agents
    description: Voice and text agents normalised through Zelto's ingestion pipeline.
  - name: Conversations
    description: >-
      Phone calls, chats, and voicemails — plus their transcripts and
      recordings.
  - name: Customer Metrics
    description: >-
      Customer-provided evaluations attached to a conversation (requires metrics
      enabled).
  - name: Reviews
    description: Human review state for conversations.
  - name: Buckets
    description: Reviewer routing — group conversations for batched review.
  - name: Companies
    description: Clients or brands your agents work for, and their logos.
  - name: Findings
    description: >-
      Structured issues discovered during analysis, with optional conversation
      attachments and comments.
  - name: Experiments
    description: >-
      Prospective measurement of two externally routed prompt versions across
      independent monitor outcomes.
  - name: Organizations
    description: >-
      Headless org provisioning. Requires an admin/service API key (not a
      read-only org-scoped customer key).
  - name: AI providers
    description: >-
      Your organization's own (bring-your-own) AI provider keys. Monitors can
      run on them instead of Zelto's built-in models. Owner or admin keys only;
      the secret is write-only.
paths:
  /v1/ai-keys/{id}/test:
    parameters:
      - name: id
        in: path
        required: true
        schema:
          type: string
          format: uuid
    post:
      tags:
        - AI providers
      summary: Test an AI provider key
      description: >-
        Re-checks the stored key with a no-cost provider call and records the
        result. A rejected key is still a 200, with `lastTestStatus: "failed"`;
        the key is reported, not removed.
      operationId: testAiKey
      responses:
        '200':
          description: The key with its updated `lastTestStatus` (`ok` or `failed`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AiKey'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          description: '`not_found`: no such key in this organization.'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AiKeyError'
components:
  schemas:
    AiKey:
      type: object
      description: >-
        An organization AI provider key. Never carries the secret: only its last
        four characters.
      required:
        - id
        - provider
        - label
        - lastFour
        - createdAt
        - createdBy
        - rotatedAt
        - rotatedBy
        - lastTestedAt
        - lastTestStatus
        - lastTestError
        - monitorCount
      properties:
        id:
          type: string
          format: uuid
        provider:
          type: string
          enum:
            - openai
            - anthropic
            - openrouter
            - vercel_gateway
            - typesafe
            - deepgram
          description: >-
            `openai`, `anthropic`, `openrouter`, `vercel_gateway` and `typesafe`
            are LLM / evaluation keys a monitor can run on. `deepgram` is a
            speech-to-text key, stored for upcoming Benchmarks.
        label:
          type: string
          maxLength: 100
          description: Tells several keys for the same provider apart. Unique per provider.
        lastFour:
          type: string
          description: The last four characters of the stored key.
        createdAt:
          type: string
          format: date-time
        createdBy:
          type:
            - object
            - 'null'
          required:
            - id
            - name
            - email
          properties:
            id:
              type: string
            name:
              type:
                - string
                - 'null'
            email:
              type:
                - string
                - 'null'
              format: email
          description: Who added the key.
        rotatedAt:
          type:
            - string
            - 'null'
          format: date-time
          description: When the secret was last replaced.
        rotatedBy:
          type:
            - object
            - 'null'
          required:
            - id
            - name
            - email
          properties:
            id:
              type: string
            name:
              type:
                - string
                - 'null'
            email:
              type:
                - string
                - 'null'
              format: email
          description: Who last replaced the secret.
        lastTestedAt:
          type:
            - string
            - 'null'
          format: date-time
        lastTestStatus:
          type:
            - string
            - 'null'
          enum:
            - ok
            - failed
            - null
          description: Result of the last provider check (on save, rotate or test).
        lastTestError:
          type:
            - string
            - 'null'
          description: >-
            Why the last check failed, such as `invalid_key` or
            `provider_unreachable:<detail>`.
        monitorCount:
          type: integer
          minimum: 0
          description: Monitors that currently run on this key.
    AiKeyError:
      type: object
      required:
        - error
        - message
      properties:
        error:
          type: string
          enum:
            - invalid_input
            - phi_mode_blocked
            - invalid_key
            - provider_unreachable
            - duplicate_label
            - not_found
            - in_use
          description: >-
            Stable code: `invalid_input` (400), `invalid_key` (400, the provider
            rejected the key), `phi_mode_blocked` (403), `not_found` (404),
            `duplicate_label` (409), `in_use` (409), `provider_unreachable`
            (502).
        message:
          type: string
        details:
          type: array
          items:
            type: object
            additionalProperties: true
          description: 'With `invalid_input`: the validation issues.'
        monitors:
          type: array
          description: 'With `in_use`: the monitors still running on the key.'
          items:
            type: object
            required:
              - id
              - name
            properties:
              id:
                type: string
                format: uuid
              name:
                type: string
    Error:
      type: object
      required:
        - error
      properties:
        error:
          type: string
          description: >-
            Short error name: `Unauthorized`, `Validation failed`, `Not found`,
            or a stable snake_case code you can match on, such as
            `unknown_query_parameter`, `invalid_parameter`, `payload_too_large`
            or `not_found`.
        message:
          type: string
          description: A plain-English sentence saying what is wrong and how to fix it.
        code:
          type: string
          description: >-
            Stable, machine-readable cause; match on this rather than on `error`
            or `message`. On a 401: `missing_credentials`,
            `malformed_credentials`, `ingest_key_not_allowed` (a write-only
            observability ingest key was used on an endpoint that needs an API
            key), `key_expired` or `invalid_credentials`. Elsewhere, for
            example: `not_found`, `invalid_parameter`,
            `unknown_query_parameter`, `missing_parameter`, `validation_failed`,
            `invalid_json`, `payload_too_large`, `conversation_not_found`,
            `plan_required`.
        hint:
          type: string
          description: >-
            The next step to try: where to find the right id, which parameters
            the endpoint takes, how to upgrade the plan, how to authenticate.
        parameter:
          type: string
          description: 'With `invalid_parameter`: the query parameter that was rejected.'
        unknown:
          type: array
          items:
            type: string
          description: >-
            With `unknown_query_parameter`: the parameters that were sent but
            are not accepted here.
        valid:
          type: array
          items:
            type: string
          description: >-
            With `unknown_query_parameter`: the parameters this endpoint
            accepts.
        details:
          type: object
          additionalProperties: true
  responses:
    Unauthorized:
      description: >-
        Missing or invalid API key. The body names the cause in `code` (for
        example `ingest_key_not_allowed` when a write-only ingest key is used
        here) with a `message` and `hint`.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    Forbidden:
      description: >-
        The key is valid but not allowed to perform this operation (e.g. a
        read-only org-scoped customer key calling a service-only endpoint).
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: >-
        Send `Authorization: Bearer YOUR_API_KEY`. The key resolves to a single
        organization.

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.