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

# Add context to a lead

> Adds context or a timeline event to a lead. Use `event` for things that happened at a point in time (a status change, a completed step, an update from your system) — Apten places it in the conversation timeline so the AI knows when it occurred relative to the lead's messages and can react to it. Use `context` for standing facts and instructions that should always apply regardless of when they were added (preferences, rules, background). At least one of `context`, `event`, `additionalInfo`, or `command` is required; they can be combined in one call.



## OpenAPI

````yaml post /leads/{leadId}/addContext
openapi: 3.0.1
info:
  title: AttentPublicAPI
  version: '2024-05-17T21:09:13Z'
servers:
  - url: https://api.attent.app/v1
security: []
paths:
  /leads/{leadId}/addContext:
    post:
      description: >-
        Adds context or a timeline event to a lead. Use `event` for things that
        happened at a point in time (a status change, a completed step, an
        update from your system) — Apten places it in the conversation timeline
        so the AI knows when it occurred relative to the lead's messages and can
        react to it. Use `context` for standing facts and instructions that
        should always apply regardless of when they were added (preferences,
        rules, background). At least one of `context`, `event`,
        `additionalInfo`, or `command` is required; they can be combined in one
        call.
      parameters:
        - name: leadId
          in: path
          required: true
          schema:
            type: string
          description: The ID of the lead to add context to.
      requestBody:
        description: The lead's context and/or timeline event, and an optional command.
        content:
          application/json:
            schema:
              type: object
              properties:
                context:
                  type: string
                  description: >-
                    A standing fact or instruction about the lead that should
                    always apply, regardless of when it was added. For something
                    that happened at a point in time, use `event` instead.
                event:
                  type: string
                  description: >-
                    Something that just happened, stated as a short factual
                    sentence (what changed, and the next step if there is one).
                    Apten records it in the conversation timeline with a
                    timestamp: the AI knows when it occurred relative to the
                    lead's messages, treats it as information the lead has not
                    seen, and can bring it up naturally or act on it in the
                    flow-chart conversation. Example: 'Application submitted.
                    Next step: upload proof of residence.'
                additionalInfo:
                  type: object
                  description: >-
                    An key-value object containing structured data to store with
                    the lead. These will be stored as variables that can be
                    accessed in the flow-chart conversation prompts.
                command:
                  type: string
                  description: >-
                    An optional command for Apten regarding the lead. Currently
                    allowed commands are scheduling a follow up and sending a
                    message.
              example:
                context: The lead prefers to be contacted in the evenings.
                event: The lead scheduled a meeting with our team for Monday at 2pm.
                additionalInfo:
                  favoriteColor: blue
                  favoriteFood: pizza
                command: Schedule a follow up for next week.
      responses:
        '200':
          description: Context has successfully been added to the lead.
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    description: Returns `"Success"` if the context was added successfully.
                example:
                  message: Success
        '400':
          description: Bad request.
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
        '403':
          $ref: '#/components/responses/403'
        '500':
          $ref: '#/components/responses/500'
      security:
        - api_key: []
components:
  responses:
    '403':
      description: Forbidden API key
      content:
        application/json:
          schema:
            type: object
            properties:
              message:
                type: string
            example:
              message: Forbidden
    '500':
      description: Internal Server Error
      content:
        application/json:
          schema:
            type: object
            properties:
              message:
                type: string
            example:
              message: Internal Server Error
  securitySchemes:
    api_key:
      type: apiKey
      name: x-api-key
      in: header

````