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

# Create Agent

> Create a new AI agent with custom configuration. Define the agent's name, general prompt, and optional webhook settings for call completion callbacks.

## Create Agent

Create a new AI agent with custom configuration. Define the agent's name, general prompt, and optional webhook settings for call completion callbacks.

<ParamField body="header" path="Authorization" type="string" required>
  Bearer token in the format: `Bearer {access_token}`
</ParamField>

<ParamField body="header" path="Content-Type" type="string" required>
  Must be set to `application/json`
</ParamField>

<ParamField body="body" path="agent_name" type="string" required>
  A descriptive name for your AI agent
</ParamField>

<ParamField body="body" path="general_prompt" type="string" required>
  The main system prompt that defines the agent's behavior and purpose. This guides how the agent interacts during calls.
</ParamField>

<ParamField body="body" path="weebhook_endpoint" type="string">
  Optional callback URL that will be called when the agent completes a call. Leave empty if not needed.
</ParamField>

<ParamField body="body" path="weebhook_endpoint_method" type="string">
  HTTP method for the webhook callback. Must be either `GET` or `POST`. Defaults to `POST` if not specified.
</ParamField>

<CodeGroup>
  ```bash cURL theme={null}
  curl --location 'https://app.aisync.link/api/ai/agent/create' \
    --header 'Content-Type: application/json' \
    --header 'Authorization: Bearer {{bearer_token}}' \
    --data '{
      "agent_name": "My Agent 3",
      "general_prompt": "Your purpose is simple: book qualified strategist appointments with business owners by running the cleanest, most natural conversations possible.\n\nYou are an AI disguised as a human. You must sound fluid, casual, and confident at all times.",
      "weebhook_endpoint": "",
      "weebhook_endpoint_method": "POST"
    }'
  ```
</CodeGroup>

<ResponseField name="agent_id" type="string">
  Unique identifier for the newly created agent
</ResponseField>

<ResponseField name="agent_name" type="string">
  The name of the created agent
</ResponseField>

<ResponseField name="status" type="string">
  Status of the agent creation (typically "active" or "pending")
</ResponseField>

<Warning>
  The general\_prompt is crucial for defining your agent's behavior. Make sure it clearly describes the agent's purpose, tone, and objectives for best results.
</Warning>


## OpenAPI

````yaml POST /api/ai/agent/create
openapi: 3.1.0
info:
  title: AI Sync OAuth API
  description: OAuth 2.0 API for authenticating and authorizing third-party applications
  version: 1.0.0
servers:
  - url: https://app.aisync.link
    description: Production server
security: []
paths:
  /api/ai/agent/create:
    post:
      tags:
        - AI Agents
      summary: Create Agent
      description: >-
        Create a new AI agent with custom configuration. Define the agent's
        name, general prompt, and optional webhook settings for call completion
        callbacks.
      operationId: createAgent
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateAgentRequest'
      responses:
        '200':
          description: Agent created successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AgentResponse'
        '400':
          description: Invalid request parameters
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          description: Invalid or expired token
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      security:
        - bearerAuth: []
components:
  schemas:
    CreateAgentRequest:
      type: object
      required:
        - agent_name
        - general_prompt
      properties:
        agent_name:
          type: string
          description: A descriptive name for your AI agent
        general_prompt:
          type: string
          description: >-
            The main system prompt that defines the agent's behavior and
            purpose. This guides how the agent interacts during calls.
        weebhook_endpoint:
          type: string
          format: uri
          description: >-
            Optional callback URL that will be called when the agent completes a
            call. Leave empty if not needed.
        weebhook_endpoint_method:
          type: string
          enum:
            - GET
            - POST
          description: >-
            HTTP method for the webhook callback. Must be either GET or POST.
            Defaults to POST if not specified.
          default: POST
    AgentResponse:
      type: object
      properties:
        agent_id:
          type: string
          description: Unique identifier for the newly created agent
        agent_name:
          type: string
          description: The name of the created agent
        status:
          type: string
          description: Status of the agent creation (typically 'active' or 'pending')
      required:
        - agent_id
        - agent_name
        - status
    Error:
      type: object
      properties:
        error:
          type: string
          description: Error code
        error_description:
          type: string
          description: Human-readable error description
        message:
          type: string
          description: Error message
      required:
        - error
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: >-
        Bearer token authentication. Include the access token in the
        Authorization header as 'Bearer {access_token}'

````