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

# Create a tool credential

> Creates a tool credential limited to the runner's current work assignment. The request cannot select another workspace. A removed or revoked GitHub App returns 409 `UZ-GH-001` with `reconnect_required`; reconnect GitHub before retrying.



## OpenAPI

````yaml https://raw.githubusercontent.com/agentsfleet/agentsfleet/main/public/openapi.json post /v1/runners/me/credentials/mint
openapi: 3.1.0
info:
  title: agentsfleet API
  description: API for managing workspaces, fleets, triggers, and runs.
  contact:
    name: agentsfleet
    url: https://agentsfleet.net
  license:
    name: MIT
    identifier: MIT
  version: 1.0.0
servers:
  - url: https://api.agentsfleet.net
    description: Production
security: []
paths:
  /v1/runners/me/credentials/mint:
    post:
      tags:
        - Runners
      summary: Create a tool credential
      description: >-
        Creates a tool credential limited to the runner's current work
        assignment. The request cannot select another workspace. A removed or
        revoked GitHub App returns 409 `UZ-GH-001` with `reconnect_required`;
        reconnect GitHub before retrying.
      operationId: runner_mint_credential
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/MintCredentialRequest'
        required: true
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MintCredentialResponse'
        '400':
          description: The request is invalid
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ProblemBody'
        '401':
          description: Authentication is missing, invalid, or not accepted by this endpoint
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ProblemBody'
        '403':
          description: You do not have permission for this action
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ProblemBody'
        '404':
          description: The resource was not found or is not accessible to you
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ProblemBody'
        '409':
          description: The request conflicts with the resource's current state
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ProblemBody'
        '413':
          description: The request body exceeds this endpoint's size limit
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ProblemBody'
        '429':
          description: A request or capacity limit has been reached
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ProblemBody'
        '500':
          description: An internal server error occurred
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ProblemBody'
        '502':
          description: A required external service rejected the request
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ProblemBody'
        '503':
          description: A required service is unavailable
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ProblemBody'
      security:
        - RunnerBearerAuth: []
components:
  schemas:
    MintCredentialRequest:
      type: object
      description: >-
        Requests a tool credential for the current work assignment. `lease_id`
        determines

        workspace access; the body cannot select another workspace and contains
        no token.
      required:
        - lease_id
        - integration
      properties:
        integration:
          type: string
          description: Connected integration that needs a credential.
        lease_id:
          type: string
          description: Current work assignment authorizing this credential request.
        scope:
          type:
            - string
            - 'null'
          description: An integration-specific narrowing the broker may honour.
      additionalProperties: false
    MintCredentialResponse:
      type: object
      description: Newly issued tool credential.
      required:
        - token
        - expires_at
      properties:
        expires_at:
          type: string
          format: date-time
          description: >-
            When it stops working, so the caller re-mints before expiry rather
            than on failure.


            A credential with no upstream expiry carries the far-future instant

            `9999-12-30T22:00:00.999Z`, so the caller's one comparison covers
            it.
        token:
          type: string
          description: |-
            The short-lived, workspace-scoped credential. Secret — never logged,
            never echoed into a frame.
    ProblemBody:
      type: object
      description: The body every refusal carries, under `application/problem+json`.
      required:
        - docs_uri
        - title
        - detail
        - error_code
        - request_id
      properties:
        action_id:
          type:
            - string
            - 'null'
          description: 'On that 409 only: the action the gate held.'
        current_state:
          type:
            - string
            - 'null'
          description: 'On a 409 only: the state that forbade the transition.'
        detail:
          type: string
          description: One sentence on what was refused and why.
        docs_uri:
          type: string
          description: Where the error code is documented.
        error_code:
          type: string
          description: The registry code, stable across releases.
        etag:
          type:
            - string
            - 'null'
          description: >-
            On a 412 only: the resource's current entity tag, to refetch and
            retry.
        gate_id:
          type:
            - string
            - 'null'
          description: 'On an answered approval gate''s 409 only: the gate that was answered.'
        outcome:
          type:
            - string
            - 'null'
          description: 'On that 409 only: the answer that stands.'
        request_id:
          type: string
          description: The request this refusal answers, for support.
        resolved_at:
          type:
            - string
            - 'null'
          format: date-time
          description: 'On that 409 only: when the standing answer was given.'
        resolved_by:
          type:
            - string
            - 'null'
          description: 'On that 409 only: who gave it.'
        title:
          type: string
          description: A short name for the refusal, safe to show a person.
        user_message:
          type:
            - string
            - 'null'
          description: A curated sentence for end users, where the code has one.
  securitySchemes:
    RunnerBearerAuth:
      type: http
      scheme: bearer
      bearerFormat: agt_r
      description: Runner token beginning with agt_r, returned once by POST /v1/runners

````

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