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

# Register a new agent

> POST /v1/agents



## OpenAPI

````yaml /openapi/v1.json post /agents
openapi: 3.1.0
info:
  title: HASP AI API
  version: '2026-07-12'
  description: >-
    The HASP Public AI API is the regulated-AI substrate for healthcare and
    other

    regulated industries — identity, policy, audit, compliance, and PHI handling

    for AI inference, exposed via two surfaces:


    - **Native (`/v1/ai/*`)**: HASP-native chat with full event taxonomy, run
    lifecycle,
      and PHI metadata.
    - **Anthropic-compat (`/v1/messages`)**: Drop-in replacement for
    `@anthropic-ai/sdk` —
      change only `baseURL`. All Gateway compliance checks (BAA, credits, PHI policy) apply.

    All requests require an API key (`Authorization: Bearer
    hasp_api_live_<key>`). See

    [Authentication](https://docs.usehasp.com/ai-api/authentication) for key
    management.
servers:
  - url: https://api.usehasp.com/v1
    description: Production
security:
  - http: []
paths:
  /agents:
    post:
      tags:
        - Agents
      summary: Register a new agent
      description: POST /v1/agents
      operationId: v1.agents.store
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                name:
                  type: string
                  minLength: 2
                  maxLength: 64
                description:
                  type:
                    - string
                    - 'null'
                  maxLength: 500
                default_expiry_hours:
                  type: integer
                  minimum: 1
                  maximum: 720
                default_revocation_policy:
                  type: string
                  enum:
                    - drain
                    - kill
                capabilities:
                  type:
                    - array
                    - 'null'
                  items:
                    type: string
                    pattern: ^[a-z0-9][a-z0-9\-]{0,30}[a-z0-9]$
                  maxItems: 12
                allowed_scope_types:
                  type:
                    - array
                    - 'null'
                  items:
                    type: string
                    enum:
                      - hasp.data.read
                      - hasp.data.write
                      - external.tool.invoke
                      - tool.destructive
                      - agent.delegate
                      - agent.compose
                      - human.escalate
                      - workflow.schedule
                      - workflow.invoke
              required:
                - name
                - default_expiry_hours
                - default_revocation_policy
      responses:
        '201':
          description: The newly registered agent.
          content:
            application/json:
              schema:
                type: object
                examples:
                  - success: true
                    data:
                      agent:
                        object: agent
                        id: agt_01JQREQ7XZQK5N6PZ1VVXHYB8T
                        name: Intake Triage Agent
                        description: Processes inbound patient intake documents.
                        capabilities:
                          - knowledge.search
                          - workflow.trigger
                        default_expiry_hours: 24
                        default_revocation_policy: drain
                        allowed_scope_types:
                          - knowledge.search
                          - workflow.trigger
                        status: active
                        archived_at: null
                        created_at: '2026-07-10T14:32:00Z'
                        updated_at: '2026-07-10T14:32:00Z'
                properties:
                  success:
                    type: boolean
                  data:
                    type: object
                    properties:
                      agent:
                        type: array
                        items: {}
                    required:
                      - agent
                required:
                  - success
                  - data
        '401':
          description: Bearer token is missing, malformed, or revoked.
          content:
            application/json:
              schema:
                type: object
                example:
                  success: false
                  error:
                    type: authentication
                    code: INVALID_API_KEY
                    message: Bearer token is missing, malformed, or revoked.
                    param: null
                    details: null
                    retryable: false
                    request_id: 01JQREQ7XZQK5N6PZ1VVXHYB8T
                  meta:
                    request_id: 01JQREQ7XZQK5N6PZ1VVXHYB8T
        '403':
          description: >-
            The caller is authenticated but lacks the scope or capability this
            route requires.
          content:
            application/json:
              schema:
                type: object
                example:
                  success: false
                  error:
                    type: permission
                    code: MISSING_SCOPE
                    message: >-
                      The caller is authenticated but lacks the scope or
                      capability this route requires.
                    param: null
                    details: null
                    retryable: false
                    request_id: 01JQREQ7XZQK5N6PZ1VVXHYB8T
                  meta:
                    request_id: 01JQREQ7XZQK5N6PZ1VVXHYB8T
        '422':
          $ref: '#/components/responses/ValidationException'
components:
  responses:
    ValidationException:
      description: Validation error
      content:
        application/json:
          schema:
            type: object
            properties:
              message:
                type: string
                description: Errors overview.
              errors:
                type: object
                description: A detailed description of each field that failed validation.
                additionalProperties:
                  type: array
                  items:
                    type: string
            required:
              - message
              - errors
  securitySchemes:
    http:
      type: http
      scheme: bearer

````