withHuman Agent enrollment API

Connect an agent from a developer machine. The agent asks for a code, a person approves it in the browser, and the agent exchanges the code for a credential. A withHuman extension, not part of the protocol.

GitHub OpenAPI
Pull this API's OpenAPI, operations, scores and pricing into your own code or AI agent with a free APIs.io key — sign in with GitHub, Google or LinkedIn. No form to fill in; signing in shares your email address with us (Privacy).

Operations 2

POST /auth/agent_enrollments Start an enrollment #
POST /auth/agent_enrollments/token Exchange an enrollment code #

Work with this as data

Every API here is available over the APIs.io API and to AI agents over MCP.

MCP server

One button, every client — Claude, Cursor, VS Code and the rest.

https://apis.io/mcp

Tools for apis

7 MCP tools reach this
  • find_apisBrowse and filter every API in the catalog.
  • get_api_artifactsOne API's artifacts, grouped by type.
  • get_openapiThe primary OpenAPI for this API.
  • find_similar_apisAPIs that look like this one.
  • apis_io_searchSTART HERE — APIs, providers and tags for one query, each with its total.
  • resolveTurn a domain, URL or GitHub org into the provider it belongs to.
  • find_cohortsEvery scored population of providers in the catalog.
All 92 tools →

Call it yourself

curl for this page
This API
curl "https://apis.io/api/v1/apis/withhuman-ai:withhuman-ai-agent-enrollment-api"
All apis
curl "https://apis.io/api/v1/apis?limit=25"

Calls without X-API-Key need no key. Calls with it need a paid plan — get a key.

Get an API key

Free tier, no form to fill in. Signing in shares your email address with us — we store it to create your key and to recognise you if you sign in with another provider. By signing up you are subscribing to the APIs.io and API Evangelist newsletters — you can unsubscribe from any issue. See our Privacy Policy and Terms.

A second provider on the same verified email joins the account you already have.

OpenAPI Specification

withhuman-ai-agent-enrollment-api-openapi.yml Raw ↑
openapi: 3.2.0
info:
  title: withHuman provider Agent enrollment API
  version: 1.0.0
  description: Agent Approval Protocol and reviewer product endpoints.
servers:
- url: /
tags:
- name: Agent enrollment
  description: Connect an agent from a developer machine. The agent asks for a code, a person approves it in the browser, and the agent exchanges the code for a credential. A withHuman extension, not part of the protocol.
paths:
  /auth/agent_enrollments:
    post:
      tags:
      - Agent enrollment
      summary: Start an enrollment
      description: Starts an enrollment and returns two codes. The `enrollment_code` stays on the machine. The `user_code` is for a person to enter at the `verification_uri`. Both expire at `expires_at`, ten minutes after this call. The person selects an existing agent or creates one in the browser, then authorizes the instance. An optional requested agent name fixes the target within the organization they sign into.
      operationId: beginAgentEnrollment
      x-withhuman-permission: public
      security: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              additionalProperties: false
              required:
              - runtime
              - instance_name
              properties:
                runtime:
                  type: string
                  minLength: 1
                  example: claude-code
                  description: The runtime being installed, independent of its parent agent.
                requested_agent_slug:
                  type: string
                  pattern: ^[a-z0-9][a-z0-9._-]{0,62}$
                  example: codex
                  description: Optional slug of an existing agent. The browser must authorize this target; it cannot create or substitute another agent.
                instance_name:
                  type: string
                  example: eces-macbook
                  description: A name for this instance, unique within the agent. The CLI defaults to the machine's hostname plus a unique suffix. Reviewers see it next to the agent's name.
                instance_metadata:
                  type: object
                  additionalProperties: true
                  example:
                    hostname: eces-macbook
                    os: darwin
                  description: Any JSON object to store with the instance, such as the hostname or operating system.
      responses:
        '201':
          description: The codes and where to use them
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/EnrollmentCode'
        '400':
          description: A required field is missing or blank
  /auth/agent_enrollments/token:
    post:
      tags:
      - Agent enrollment
      summary: Exchange an enrollment code
      description: Exchanges an authorized enrollment code for the new instance and its credential. Call this every few seconds after starting an enrollment. It returns `404` until a person has authorized the user code. Once it succeeds, the code is used up and a second call returns `404` as well. The credential's token appears only in this response, so store it right away.
      operationId: exchangeAgentEnrollment
      x-withhuman-permission: public
      security: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              additionalProperties: false
              required:
              - enrollment_code
              properties:
                enrollment_code:
                  type: string
                  example: whe_7c1f2a9e-4b3d-4f2e-9a1c-2d6e8b5f0a11_3f6b9c1d0e7a4b2c
                  description: The `enrollment_code` returned when the enrollment started.
      responses:
        '200':
          description: The instance and its credential. The credential's token appears only in this response.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AgentEnrollmentCredential'
        '401':
          description: The enrollment code is not in the expected format
        '403':
          description: The agent or the instance has been disabled since it was authorized
        '404':
          description: The code has not been authorized yet, has expired, or has already been exchanged
components:
  schemas:
    AgentInstanceDelivery:
      type: object
      description: The verified receiver of an instance using asynchronous mode, returned when the instance is created. The signing secret is never returned.
      required:
      - type
      - url
      - registration_id
      properties:
        type:
          type: string
          enum:
          - webhook
        url:
          type: string
          format: uri
          example: https://harness.example.com/aap/events
        registration_id:
          type: string
          format: uuid
    AgentInstance:
      type: object
      description: One running copy of an agent.
      required:
      - id
      - organization_id
      - agent_slug
      - name
      - status
      - metadata
      - created_at
      - last_seen_at
      properties:
        id:
          type: string
          format: uuid
        organization_id:
          type: string
          format: uuid
        agent_slug:
          type: string
          pattern: ^[a-z0-9][a-z0-9._-]{0,62}$
          description: The slug of the agent this is an instance of.
        membership_id:
          type: string
          format: uuid
          description: The member this instance belongs to and acts for. Present exactly when the agent is `personal`.
        name:
          type: string
          example: ci-runner-07
          description: Unique within the agent.
        status:
          type: string
          enum:
          - active
          - disabled
          description: A disabled instance cannot create requests.
        metadata:
          type: object
          additionalProperties: true
          example:
            region: eu-west
          description: The JSON stored when the instance was created.
        created_at:
          type: string
          format: date-time
        last_seen_at:
          type: string
          format: date-time
          description: The last time this instance called the API.
        delivery:
          $ref: '#/components/schemas/AgentInstanceDelivery'
    AgentEnrollmentCredential:
      type: object
      description: The selected parent agent, its new instance, and the instance credential shown once.
      required:
      - agent
      - agent_instance
      - credential
      properties:
        agent:
          $ref: '#/components/schemas/Agent'
        agent_instance:
          $ref: '#/components/schemas/AgentInstance'
        credential:
          $ref: '#/components/schemas/IssuedCredential'
    IssuedCredential:
      type: object
      required:
      - id
      - token
      - expires_at
      properties:
        id:
          type: string
          format: uuid
          description: Identifies the credential, for example when revoking it.
        token:
          type: string
          description: The secret. It appears only in this response and cannot be retrieved again.
          example: whc_live_3f6b9c1d0e7a4b2c
        expires_at:
          type: string
          format: date-time
          description: When the credential stops working.
    Agent:
      type: object
      description: 'An agent identity. The slug identifies it everywhere: URLs, role scopes, pipeline scopes, audit data and conditions. The name is a label for people.'
      required:
      - slug
      - organization_id
      - created_by_actor_id
      - name
      - kind
      - status
      - created_at
      - updated_at
      properties:
        slug:
          type: string
          pattern: ^[a-z0-9][a-z0-9._-]{0,62}$
          example: support-bot
          description: The agent's identity, chosen once at creation. It never changes and is never reused, not even after the agent is archived.
        organization_id:
          type: string
          format: uuid
        created_by_actor_id:
          type: string
          format: uuid
          description: The membership or organization-key actor that created the agent.
        name:
          type: string
          example: Support bot
          description: The display name. Reviewers see it on every request. Editable, and unique among the organization's live agents.
        kind:
          type: string
          enum:
          - service
          - personal
          description: 'Whose behalf the agent''s instances act on, chosen once. A `service` agent is one the organization runs, such as a support bot: its instances share one identity, administrators enroll them, and provisioner tokens mint them. A `personal` agent is one people run for themselves, such as a coding assistant: every instance belongs to the member who enrolled it, any active member may connect their own, and the instances are disabled when that member is removed. Personal agents have no provisioner tokens.'
        status:
          type: string
          enum:
          - active
          - disabled
          - archived
          description: 'A `disabled` agent''s instances cannot authenticate until it is enabled again. An `archived` agent is retired: nothing of it authenticates, nothing can be enrolled under it, and its status cannot change until it is restored.'
        created_at:
          type: string
          format: date-time
        updated_at:
          type: string
          format: date-time
        archived_at:
          type: string
          format: date-time
          description: When the agent was archived. Present exactly when `status` is `archived`.
    EnrollmentCode:
      type: object
      description: The two codes of a pending enrollment.
      required:
      - enrollment_code
      - user_code
      - verification_uri
      - expires_at
      properties:
        enrollment_code:
          type: string
          example: whe_7c1f2a9e-4b3d-4f2e-9a1c-2d6e8b5f0a11_3f6b9c1d0e7a4b2c
          description: The secret the machine keeps. Send it to the exchange endpoint. Never show it to the person.
        user_code:
          type: string
          example: K7M-3PQ2
          description: The short code the person enters in the browser. Three letters, a hyphen, and four letters or digits. Case does not matter.
        verification_uri:
          type: string
          format: uri
          example: https://app.withhuman.ai/connect/authorize
          description: The page where the person enters the user code.
        expires_at:
          type: string
          format: date-time
          description: When both codes stop working. Start a new enrollment after this.
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
    cookieAuth:
      type: apiKey
      in: cookie
      name: withhuman_session
    apiKeyAuth:
      type: http
      scheme: bearer
      bearerFormat: whk_ / who_
      description: 'A personal whk_ or organization who_ API key sent as Authorization: Bearer <token>. Personal keys act as their member with live, optionally narrowed access. Organization keys act as themselves with live RBAC permission policies. The x-withhuman-credential-kinds extension lists the kinds supported by each operation. Revocation, expiry, organization status, and the policy switch for that key kind are checked on every request.'