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

# Create a mandate

> Schedule an agent to run autonomously for a user on a cron schedule. The agent has access to the user's memory and the soul's permissions.



## OpenAPI

````yaml POST /v1/mandates
openapi: 3.1.0
info:
  title: Kairn API
  version: 1.0.0
  description: >-
    The Kairn API. All requests require an `X-API-Key` header with your tenant
    API key.
servers:
  - url: https://api.kairn.sh
    description: Production
security:
  - ApiKey: []
tags:
  - name: Agent
    description: Invoke agents and stream responses.
  - name: Memory
    description: Read and write per-user agent memory.
  - name: Souls
    description: Manage agent identities.
  - name: Skills
    description: Manage custom skills (instructions and webhook tools).
  - name: Mandates
    description: Schedule autonomous agent tasks.
  - name: Invocations
    description: Inspect past agent runs.
  - name: Sessions
    description: Access multi-turn conversation history.
  - name: Audit
    description: Audit log for all agent activity.
paths:
  /v1/mandates:
    post:
      tags:
        - Mandates
      summary: Create a mandate
      description: >-
        Schedule an agent to run autonomously for a user on a cron schedule. The
        agent has access to the user's memory and the soul's permissions.
      operationId: mandates-create
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - user_id
                - soul
                - role
                - label
                - task_prompt
                - trigger_type
              properties:
                user_id:
                  type: string
                  example: user_123
                soul:
                  type: string
                  example: advisor
                role:
                  type: string
                  default: default
                label:
                  type: string
                  example: Weekly check-in
                task_prompt:
                  type: string
                  description: The task the agent will execute each time the mandate fires.
                  example: Review goals and write a weekly summary to memory.
                trigger_type:
                  type: string
                  enum:
                    - cron
                  example: cron
                trigger_config:
                  type: object
                  properties:
                    cron:
                      type: string
                      description: Standard cron expression (UTC).
                      example: 0 9 * * 1
      responses:
        '200':
          description: Mandate created.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Mandate'
        '400':
          description: Invalid cron expression or missing fields.
components:
  schemas:
    Mandate:
      type: object
      properties:
        id:
          type: string
        tenant_id:
          type: string
        user_id:
          type: string
        soul:
          type: string
        role:
          type: string
        label:
          type: string
        task_prompt:
          type: string
        trigger_type:
          type: string
          enum:
            - cron
            - event
        trigger_config:
          type: object
        status:
          type: string
          enum:
            - active
            - paused
            - cancelled
        next_run_at:
          type: string
          format: date-time
          nullable: true
        last_run_at:
          type: string
          format: date-time
          nullable: true
        run_count:
          type: integer
        created_at:
          type: string
          format: date-time
  securitySchemes:
    ApiKey:
      type: apiKey
      in: header
      name: X-API-Key

````

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