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

# Create or update an AI agent

> **Destructive.** It sends, publishes, launches or deletes. Get a person to confirm before calling it.

Create an AI agent, or update one by passing `agentId`. A CHAT agent will reply to real prospects once it is active and attached to a campaign — set `isActive: false` while iterating on its instructions. The behaviour comes from `personality` (who it is), `intent` (what it is trying to achieve) and `instructions` (how it should write). This creates or edits the agent and nothing else. It does not attach it to a campaign (`campaign_update`), give it source material (`kb_upsert` then `kb_attach`), or build its embeddings (`agent_train`, which must run after any knowledge change). Test with `agent_query` before it touches a real conversation. There is no endpoint to delete an agent. Requires the "Agents" permission on the plan.



## OpenAPI

````yaml /api-v2/openapi.json post /agent_upsert
openapi: 3.1.0
info:
  title: LinkedCamp API
  version: 2.0.0
  description: >-
    Version 2 of the LinkedCamp API. Every endpoint is a POST to `/{endpoint}`
    with its arguments as a JSON object, and returns JSON.
servers:
  - url: https://api.linkedcamp.com/v2
security:
  - ApiKey: []
  - Bearer: []
tags:
  - name: Account
  - name: Notifications
  - name: Reference
  - name: Campaigns
  - name: Campaign audience
  - name: Sequences
  - name: Blocked dates
  - name: Leads
  - name: Lead notes
  - name: Activities
  - name: Tags
  - name: Blacklist
  - name: Conversations
  - name: Messages
  - name: Saved replies
  - name: Templates
  - name: Merge fields
  - name: Personalised images
  - name: LinkedIn accounts
  - name: Email accounts
  - name: AI agents
  - name: Knowledge base
  - name: Personas
  - name: Analytics
  - name: Posts
  - name: Posting schedule
  - name: Tasks
  - name: Appointments
  - name: Reminders
  - name: Automations
paths:
  /agent_upsert:
    post:
      tags:
        - AI agents
      summary: Create or update an AI agent
      description: >-
        **Destructive.** It sends, publishes, launches or deletes. Get a person
        to confirm before calling it.


        Create an AI agent, or update one by passing `agentId`. A CHAT agent
        will reply to real prospects once it is active and attached to a
        campaign — set `isActive: false` while iterating on its instructions.
        The behaviour comes from `personality` (who it is), `intent` (what it is
        trying to achieve) and `instructions` (how it should write). This
        creates or edits the agent and nothing else. It does not attach it to a
        campaign (`campaign_update`), give it source material (`kb_upsert` then
        `kb_attach`), or build its embeddings (`agent_train`, which must run
        after any knowledge change). Test with `agent_query` before it touches a
        real conversation. There is no endpoint to delete an agent. Requires the
        "Agents" permission on the plan.
      operationId: agent_upsert
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                agentId:
                  type: string
                  description: Omit to create a new agent.
                name:
                  type: string
                  description: Internal name.
                type:
                  type: string
                  enum:
                    - CHAT
                    - VOICE
                    - CONTENT
                    - CAMPAIGN
                    - REPORTING
                  description: CHAT for inbox replies, CONTENT for post drafting.
                businessName:
                  type: string
                  description: Company the agent represents; injected into its prompt.
                provider:
                  type: string
                  enum:
                    - OPENAI
                    - ANTHROPIC
                    - GEMINI
                    - GROK
                    - DEEPSEEK
                  description: Primary model provider. Must be connected.
                fallbackProvider:
                  type: string
                  enum:
                    - OPENAI
                    - ANTHROPIC
                    - GEMINI
                    - GROK
                    - DEEPSEEK
                  description: Used when the primary provider errors.
                language:
                  type: string
                  description: Language code, e.g. "en", "fr", "de", "it", "pt", "ja".
                channels:
                  type: array
                  items:
                    type: string
                  description: Where the agent operates, e.g. ["linkedin","email"].
                personality:
                  type: string
                  description: Who the agent is and how it carries itself.
                intent:
                  type: string
                  description: The outcome it is steering the conversation toward.
                instructions:
                  type: string
                  description: 'Concrete writing rules: tone, length, what to avoid.'
                prompt:
                  type: string
                  description: Raw system prompt override. Usually leave unset.
                topics:
                  type: array
                  items:
                    type: string
                  description: Subjects the agent is allowed to discuss.
                faqs:
                  type: array
                  items:
                    type: object
                    properties:
                      question:
                        type: string
                        description: A question leads ask.
                      answer:
                        type: string
                        description: The answer the agent gives, verbatim.
                    required:
                      - question
                      - answer
                    additionalProperties: false
                  description: Canned answers the agent should use verbatim.
                followups:
                  type: array
                  items:
                    type: object
                    additionalProperties: {}
                  description: Follow-up messages sent when a lead goes quiet.
                prohabitedWords:
                  type: array
                  items:
                    type: string
                  description: >-
                    Words the agent must never use. Field name is spelled this
                    way in the schema.
                waitTime:
                  type: integer
                  minimum: 0
                  description: Minutes to wait before replying, so it reads as human.
                maxMessages:
                  type: integer
                  minimum: 1
                  description: Cap on agent messages per conversation.
                pauseBotOnManualMessage:
                  type: boolean
                  description: Stand down as soon as a human replies in the thread.
                stopScenarios:
                  type: object
                  properties:
                    aggressive:
                      type: boolean
                      description: Stop when the lead becomes hostile.
                    goodbye:
                      type: boolean
                      description: Stop when the lead signs off.
                    notInterested:
                      type: boolean
                      description: Stop when the lead declines.
                  additionalProperties: false
                  description: Situations in which the agent stops replying.
                action:
                  type: string
                  const: APPOINTMENT
                  description: Enable calendar booking.
                actionSettings:
                  type: object
                  properties:
                    calendar:
                      type: string
                      description: >-
                        Which calendar to book into: a Calendly event, a
                        GoHighLevel calendar id, or "CUSTOM" to share
                        `customCalendarLink`.
                    calendarType:
                      type: string
                      description: e.g. "calendly", "ghl".
                    customCalendarLink:
                      type: string
                      description: >-
                        Booking page URL the agent shares. Required when
                        `calendar` is "CUSTOM", which also forces
                        `sendLinkOnly`.
                    sendLinkOnly:
                      type: boolean
                      description: Send the booking link instead of negotiating a time.
                    pauseBotOnBooking:
                      type: boolean
                      description: Stop replying to a lead once they have booked.
                  additionalProperties: false
                  description: Booking settings. Used when `action` is "APPOINTMENT".
                userIds:
                  type: array
                  items:
                    type: string
                  description: Share this agent with these sub-accounts.
                notify:
                  type: boolean
                  description: Notify you when the agent replies.
                isActive:
                  type: boolean
                  description: Whether the agent runs. Keep false while drafting.
              required:
                - name
              additionalProperties: false
      responses:
        '200':
          description: >-
            The result, as JSON. Writes answer `{ "ok": true, "message": ...,
            "data": ... }`.
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
        '400':
          description: >-
            The body is not valid JSON, an argument is invalid, or the request
            was refused.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          description: No API key, or the key was rejected.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: >-
            Your plan, permissions or access tier don't include this, or a
            record belongs to another account.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: A record named in the arguments does not exist.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '422':
          description: >-
            The request was valid but the operation was refused, such as
            launching a campaign that is not ready.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '502':
          description: The service failed or could not be reached. Reads are safe to retry.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '504':
          description: >-
            The operation timed out. A write may still complete; read it back
            before retrying.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
components:
  schemas:
    Error:
      type: object
      required:
        - error
      properties:
        error:
          type: object
          required:
            - code
            - message
          properties:
            code:
              type: string
              enum:
                - UNAUTHENTICATED
                - FORBIDDEN
                - PLAN_REQUIRED
                - VALIDATION
                - INVALID_JSON
                - NOT_FOUND
                - METHOD_NOT_ALLOWED
                - UPSTREAM
                - TOOL_ERROR
            message:
              type: string
            hint:
              type: string
              description: What to do about it, when there is something to do.
  securitySchemes:
    ApiKey:
      type: apiKey
      in: header
      name: X-Api-Key
      description: Your LinkedCamp API key.
    Bearer:
      type: http
      scheme: bearer
      description: Your LinkedCamp API key as a bearer token.

````

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