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

# Create an AI agent



## OpenAPI

````yaml /api-reference/openapi.json post /agents
openapi: 3.1.0
info:
  title: Autoposting API
  description: >-
    Schedule, publish, and AI-enhance social content across X, LinkedIn,
    Instagram, Threads, and YouTube. All responses use the `{ "success":
    boolean, "data": ... }` envelope. Authenticate with an API key
    (`Authorization: Bearer sk-social-...` or `x-api-key: sk-social-...`).
  version: 1.0.0
servers:
  - url: https://app.autoposting.ai/api-proxy
    description: Production
security:
  - bearerAuth: []
  - apiKeyHeader: []
tags:
  - name: Agents
    description: >-
      Create and manage AI agents that autonomously generate and schedule
      content, trigger runs, inspect outputs, and track statistics.
  - name: API Keys
    description: >-
      Create, list, update, and revoke API keys for programmatic access to the
      Autoposting.ai API.
  - name: Auth
    description: >-
      Signup, login, logout, social login, profile management, email change, and
      session management.
  - name: Billing
    description: >-
      Manage subscriptions, credits, plan changes, billing history, and the
      customer portal.
  - name: Brands
    description: >-
      Create, list, update, delete, and reorder brands. Each brand maps to a set
      of social media accounts.
  - name: Carousels
    description: >-
      Create, manage, and AI-generate carousel posts for LinkedIn and other
      platforms.
  - name: Clips
    description: >-
      Upload, manage, render, and publish video clips, including multipart
      upload, AI candidate generation, and credit billing.
  - name: Knowledge Base
    description: >-
      Knowledge bases, document ingestion, semantic search, and AI content idea
      generation.
  - name: Notifications
    description: List, read, and manage in-app notifications and notification preferences.
  - name: Organizations
    description: >-
      Create, list, update, and delete organizations (workspaces), including a
      safeguarded deletion flow with a grace period.
  - name: Platform OAuth
    description: >-
      Connect social media accounts via OAuth and manage platform tokens for X,
      LinkedIn, Instagram, Threads, and YouTube.
  - name: Posts
    description: Create, manage, schedule, publish, and AI-enhance posts across platforms.
  - name: Teams
    description: >-
      Manage team members, invitations, invite links, permission groups,
      brand-level overrides, ownership transfers, and allowed email domains.
  - name: Usage
    description: >-
      Usage summaries, token breakdowns, feature access, onboarding progress,
      and account management endpoints.
  - name: Webhooks
    description: >-
      Configure outbound webhook endpoints to receive real-time event
      notifications from Autoposting.ai.
paths:
  /agents:
    post:
      tags:
        - Agents
      summary: Create an AI agent
      operationId: createAgent
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - name
                - brandSlug
                - platforms
              properties:
                name:
                  type: string
                  description: Display name for the agent.
                brandSlug:
                  type: string
                  description: Brand the agent posts on behalf of.
                platforms:
                  type: array
                  items:
                    type: string
                    enum:
                      - x
                      - linkedin
                      - instagram
                      - threads
                      - youtube
                  description: Target platforms.
                schedule:
                  type: string
                  description: >-
                    Cron expression defining when the agent runs (UTC). Example:
                    "0 9 * * 1-5" runs at 9 AM UTC Monday-Friday.
                knowledgeBaseId:
                  type: string
                  description: ID of the knowledge base the agent draws content ideas from.
                postsPerRun:
                  type: integer
                  default: 1
                  description: Number of posts to generate per run.
                tone:
                  type: string
                  enum:
                    - professional
                    - casual
                    - educational
                    - inspirational
                    - humorous
                  description: Writing tone.
                instructions:
                  type: string
                  description: >-
                    Custom instructions for the agent (e.g., "Always end with a
                    question to boost engagement").
                autoPublish:
                  type: boolean
                  default: false
                  description: >-
                    If true, the agent publishes posts immediately. If false,
                    posts are saved as drafts for review.
            example:
              name: Daily LinkedIn Poster
              brandSlug: acme-corp
              platforms:
                - linkedin
              schedule: 0 9 * * 1-5
              knowledgeBaseId: kb_01HXYZ
              postsPerRun: 1
              tone: professional
      responses:
        '200':
          description: Agent created.
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                  data:
                    $ref: '#/components/schemas/Agent'
              example:
                success: true
                data:
                  id: agent_01HXYZ
                  name: Daily LinkedIn Poster
                  brandSlug: acme-corp
                  platforms:
                    - linkedin
                  schedule: 0 9 * * 1-5
                  enabled: true
                  autoPublish: false
                  createdAt: '2024-01-01T00:00:00Z'
        '401':
          description: Authentication required.
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                  error:
                    type: string
                  message:
                    type: string
              example:
                success: false
                error: unauthorized
                message: Authentication required.
components:
  schemas:
    Agent:
      type: object
      description: An AI agent that autonomously generates and schedules content.
      properties:
        id:
          type: string
        name:
          type: string
        brandSlug:
          type: string
        platforms:
          type: array
          items:
            type: string
            enum:
              - x
              - linkedin
              - instagram
              - threads
              - youtube
        schedule:
          type: string
          description: Cron expression defining when the agent runs (UTC).
        enabled:
          type: boolean
        autoPublish:
          type: boolean
        tone:
          type: string
          enum:
            - professional
            - casual
            - educational
            - inspirational
            - humorous
        instructions:
          type:
            - string
            - 'null'
        knowledgeBaseId:
          type: string
        postsPerRun:
          type: integer
        lastRunAt:
          type:
            - string
            - 'null'
          format: date-time
        nextRunAt:
          type:
            - string
            - 'null'
          format: date-time
        createdAt:
          type: string
          format: date-time
        updatedAt:
          type: string
          format: date-time
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: 'API key as `Authorization: Bearer sk-social-...`'
    apiKeyHeader:
      type: apiKey
      in: header
      name: x-api-key
      description: 'API key as `x-api-key: sk-social-...`'

````