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

# Get Agent

> Get an agent by ID.



## OpenAPI

````yaml /openapi.json get /agents/{agent_id}
openapi: 3.1.0
info:
  title: Kejue Public API
  description: >-
    The Kejue Public API lets you programmatically create calls, manage
    campaigns, and retrieve call results.


    ## Authentication


    All requests require an API key passed in the `X-API-Key` header:


    ```

    X-API-Key: kej_live_...

    ```


    API keys are scoped to a workspace. Create and manage keys from the Kejue
    dashboard under **Settings → API Keys**.


    ## Base URL


    ```

    https://api.kejue.co/api/v1

    ```


    ## Rate Limits


    API requests are rate-limited per workspace. If you exceed the limit you'll
    receive a `429 Too Many Requests` response.


    ## Errors


    All error responses follow a consistent format:


    ```json

    {
      "error": "Human-readable message",
      "code": "ERROR_CODE",
      "details": {}
    }

    ```
  version: 1.0.0
servers:
  - url: https://api.kejue.co/api/v1
    description: Production
security:
  - ApiKeyAuth: []
tags:
  - name: Agents
    description: >-
      Create and manage AI agents (personas). Each agent has a name, prompt,
      voice configuration, and optional tools. Agents are the core building
      block — attach voice configs, tools, and use them to make calls.
  - name: Calls
    description: >-
      Create outbound calls, retrieve call details and transcripts, and list
      calls with filtering. Each call is associated with a contact and
      optionally an agent and campaign.
  - name: Persona Calls
    description: >-
      Create calls with the full agent configuration pre-loaded. Applies the
      complete settings hierarchy (workspace → agent → campaign → overrides)
      with all agent tools, tags, scoring, and webhooks inherited automatically.
  - name: Contacts
    description: >-
      Create and manage contacts. Contacts represent the people your agents
      call. Each contact has a phone number, name, and optional metadata.
      Supports single creation, bulk import, and CSV upload.
  - name: Campaigns
    description: >-
      Create and manage calling campaigns. Campaigns let you batch-call a list
      of contacts with shared settings, scheduling, and retry logic.
  - name: Tools
    description: >-
      Create and manage custom HTTP tools that agents can invoke during calls.
      Tools let agents fetch data, trigger actions, or integrate with external
      systems mid-conversation.


      Each tool supports three parameter types:

      - **Dynamic parameters** — filled by the AI at runtime (visible to the AI)

      - **Static parameters** — fixed values sent with every invocation (hidden
      from the AI)

      - **System parameters** — values injected from the execution context at
      runtime, such as `call_id`, `contact_id`, or `workspace_id` (hidden from
      the AI)
  - name: Voices
    description: List available voices for use in agent voice configurations.
  - name: Phone Numbers
    description: List phone numbers available in your workspace for making outbound calls.
  - name: Webhooks
    description: >-
      Create and manage webhook subscriptions. Receive real-time notifications
      for call events (started, ended, etc.) at your specified URL.
  - name: Models
    description: List available AI models for use in agent voice configurations.
paths:
  /agents/{agent_id}:
    get:
      tags:
        - Agents
      summary: Get Agent
      description: Get an agent by ID.
      operationId: get_agent_agents__agent_id__get
      parameters:
        - name: agent_id
          in: path
          required: true
          schema:
            type: string
            title: Agent Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AgentResponse'
        '401':
          description: >-
            Missing or invalid API key. Pass a workspace API key in the
            `X-API-Key` header.
          content:
            application/json:
              example:
                error: Invalid or missing API key
                code: UNAUTHORIZED
                details: {}
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '404':
          description: Agent not found in this workspace.
          content:
            application/json:
              example:
                error: Agent not found
                code: NOT_FOUND
                details:
                  agent_id: non_existent_id
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - ApiKeyAuth: []
components:
  schemas:
    AgentResponse:
      properties:
        id:
          type: string
          title: Id
        name:
          type: string
          title: Name
        description:
          anyOf:
            - type: string
            - type: 'null'
          title: Description
        is_active:
          type: boolean
          title: Is Active
        memory_enabled:
          type: boolean
          title: Memory Enabled
        call_settings:
          anyOf:
            - $ref: '#/components/schemas/CallSettingsInput'
            - type: 'null'
        voice_configs:
          items:
            $ref: '#/components/schemas/VoiceConfigResponse'
          type: array
          title: Voice Configs
        tools:
          items:
            $ref: '#/components/schemas/AgentToolResponse'
          type: array
          title: Tools
        created_at:
          anyOf:
            - type: string
            - type: 'null'
          title: Created At
        updated_at:
          anyOf:
            - type: string
            - type: 'null'
          title: Updated At
      type: object
      required:
        - id
        - name
        - is_active
        - memory_enabled
      title: AgentResponse
      description: Full agent (persona) response (public-safe).
    ErrorResponse:
      properties:
        error:
          type: string
          title: Error
        code:
          type: string
          title: Code
        details:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Details
      type: object
      required:
        - error
        - code
      title: ErrorResponse
      description: Standard error response.
      example:
        code: NOT_FOUND
        details:
          contact_id: '123'
        error: Contact not found
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    CallSettingsInput:
      properties:
        call_start_hour:
          anyOf:
            - type: integer
              maximum: 23
              minimum: 0
            - type: 'null'
          title: Call Start Hour
          description: 'Earliest hour to call (0-23, contact timezone). Default: 9'
        call_start_minute:
          anyOf:
            - type: integer
              maximum: 59
              minimum: 0
            - type: 'null'
          title: Call Start Minute
          description: 'Earliest minute. Default: 0'
        call_end_hour:
          anyOf:
            - type: integer
              maximum: 23
              minimum: 0
            - type: 'null'
          title: Call End Hour
          description: 'Latest hour to call (0-23). Default: 18'
        call_end_minute:
          anyOf:
            - type: integer
              maximum: 59
              minimum: 0
            - type: 'null'
          title: Call End Minute
          description: 'Latest minute. Default: 0'
        allowed_days:
          anyOf:
            - items:
                type: integer
              type: array
            - type: 'null'
          title: Allowed Days
          description: >-
            Days of the week to call. 0=Monday, 6=Sunday. Default: [0,1,2,3,4]
            (Mon-Fri)
        auto_retry:
          anyOf:
            - type: boolean
            - type: 'null'
          title: Auto Retry
          description: 'Retry when contact doesn''t answer. Default: true'
        retry_schedule:
          anyOf:
            - items:
                type: integer
              type: array
            - type: 'null'
          title: Retry Schedule
          description: >-
            Minutes between retries, e.g. [60, 240] = retry after 1h, then 4h.
            Default: [60, 240]
        phone_assignment_mode:
          anyOf:
            - $ref: '#/components/schemas/PhoneAssignmentMode'
            - type: 'null'
          description: >-
            How to pick the origin phone number. 'local' = match contact's
            country, 'foreign' = use a different country, 'any' = no preference.
            Default: 'any'
        scoring_criteria:
          anyOf:
            - type: string
            - type: 'null'
          title: Scoring Criteria
          description: >-
            Free-text instructions for scoring the call 0-100. Example: 'Score
            based on buying intent and engagement level'
        tags:
          anyOf:
            - items:
                $ref: '#/components/schemas/TagDefinition'
              type: array
            - type: 'null'
          title: Tags
          description: Tag definitions -- AI applies matching tags after the call
        structured_data_schema:
          anyOf:
            - items:
                $ref: '#/components/schemas/StructuredDataField'
              type: array
            - type: 'null'
          title: Structured Data Schema
          description: Fields to extract from the conversation after the call
        server_url:
          anyOf:
            - type: string
            - type: 'null'
          title: Server Url
          description: URL to POST call events to (simple inline webhook)
        server_secret:
          anyOf:
            - type: string
            - type: 'null'
          title: Server Secret
          description: HMAC-SHA256 signing secret for server_url
      type: object
      title: CallSettingsInput
      description: >-
        Unified call settings -- controls call window, retry, scoring, tags, and
        post-call behavior.


        Can be set at agent level or campaign level. Null fields inherit from
        the parent level.

        Hierarchy (lowest -> highest priority): System Defaults -> Workspace ->
        Agent -> Campaign -> API Override.
      example:
        allowed_days:
          - 0
          - 1
          - 2
          - 3
          - 4
        auto_retry: true
        call_end_hour: 17
        call_start_hour: 9
        phone_assignment_mode: local
        retry_schedule:
          - 60
          - 240
        scoring_criteria: Score 0-100 based on buying intent
        structured_data_schema:
          - description: Stated budget range
            key: budget
          - description: Decision timeline
            key: timeline
        tags:
          - description: Contact expressed buying interest
            name: Interested
          - description: Contact requested a follow-up call
            name: Follow-up
    VoiceConfigResponse:
      properties:
        id:
          type: string
          title: Id
        name:
          type: string
          title: Name
        language_locale:
          type: string
          title: Language Locale
        prompt:
          type: string
          title: Prompt
        first_speaker:
          type: string
          title: First Speaker
        first_message:
          anyOf:
            - type: string
            - type: 'null'
          title: First Message
        first_message_uninterruptible:
          type: boolean
          title: First Message Uninterruptible
          default: false
        first_message_delay_ms:
          anyOf:
            - type: integer
            - type: 'null'
          title: First Message Delay Ms
        voice_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Voice Id
        voice_name:
          anyOf:
            - type: string
            - type: 'null'
          title: Voice Name
        model:
          anyOf:
            - type: string
            - type: 'null'
          title: Model
        temperature:
          anyOf:
            - type: number
            - type: 'null'
          title: Temperature
        recording_enabled:
          type: boolean
          title: Recording Enabled
        inactivity_messages:
          anyOf:
            - items:
                additionalProperties: true
                type: object
              type: array
            - type: 'null'
          title: Inactivity Messages
        silence_timeout:
          type: integer
          title: Silence Timeout
        max_duration:
          type: integer
          title: Max Duration
        corpus_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Corpus Id
        is_default:
          type: boolean
          title: Is Default
        is_active:
          type: boolean
          title: Is Active
        created_at:
          anyOf:
            - type: string
            - type: 'null'
          title: Created At
        updated_at:
          anyOf:
            - type: string
            - type: 'null'
          title: Updated At
      type: object
      required:
        - id
        - name
        - language_locale
        - prompt
        - first_speaker
        - recording_enabled
        - silence_timeout
        - max_duration
        - is_default
        - is_active
      title: VoiceConfigResponse
      description: Voice configuration in API responses (public-safe).
    AgentToolResponse:
      properties:
        tool_name:
          type: string
          title: Tool Name
        tool_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Tool Id
        channels:
          items:
            type: string
          type: array
          title: Channels
        config:
          additionalProperties: true
          type: object
          title: Config
      type: object
      required:
        - tool_name
        - channels
        - config
      title: AgentToolResponse
      description: A tool attached to an agent.
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
        input:
          title: Input
        ctx:
          type: object
          title: Context
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
    PhoneAssignmentMode:
      type: string
      enum:
        - local
        - foreign
        - any
      title: PhoneAssignmentMode
      description: How to assign the origin phone number.
    TagDefinition:
      properties:
        name:
          type: string
          title: Name
          description: Tag label, e.g. 'Interested'
        description:
          type: string
          title: Description
          description: When to apply this tag -- the AI uses this to decide
      type: object
      required:
        - name
        - description
      title: TagDefinition
      description: A tag that can be applied to a call based on conversation content.
    StructuredDataField:
      properties:
        key:
          type: string
          title: Key
          description: Output field key, e.g. 'budget'
        description:
          type: string
          title: Description
          description: What to extract from the conversation
      type: object
      required:
        - key
        - description
      title: StructuredDataField
      description: A field to extract from the conversation after the call.
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: X-API-Key
      description: Workspace API key (e.g. `kej_live_...`)

````