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

# Create Agent Token

> Issues a new TrueFoundry-backed token for the agent's linked identity. Fails with 409 when a valid token already exists — use the get-token endpoint to retrieve it. An expired token is replaced by a new one. An optional expirationDate (yyyy-mm-dd) sets the token's expiry; the identity manifest is not modified. Requires manage access on the agent since the token authenticates as it.



## OpenAPI

````yaml /openapi.json post /api/svc/v1/agents/{id}/token
openapi: 3.1.0
info:
  title: TrueFoundry API
  description: API for TrueFoundry
  version: 0.1.0
  contact: {}
servers:
  - url: https://{controlPlaneURL}
    variables:
      controlPlaneURL:
        default: app.truefoundry.com
        description: Control Plane URL
security: []
tags:
  - name: Agent
  - name: Agent Skills
  - name: Applications
  - name: Metrics
  - name: Apply
  - name: Artifacts
  - name: Audit Logs
  - name: Clusters
  - name: Jobs
  - name: LLM Gateway Budgets
  - name: Logs
  - name: MCP Registry
  - name: MCP Servers V2
  - name: MLRepos
  - name: Model Deployments
  - name: Models
  - name: Personal Access Tokens
  - name: Prompts
  - name: Provider Integrations
  - name: SCIM v2
  - name: Secret Groups
  - name: Secrets
  - name: Teams
  - name: Traces
  - name: Users
  - name: Virtual Accounts
  - name: Role Bindings
  - name: Workspaces
  - name: Provider Accounts
paths:
  /api/svc/v1/agents/{id}/token:
    post:
      tags:
        - Agent
        - public
      summary: Create Agent Token
      description: >-
        Issues a new TrueFoundry-backed token for the agent's linked identity.
        Fails with 409 when a valid token already exists — use the get-token
        endpoint to retrieve it. An expired token is replaced by a new one. An
        optional expirationDate (yyyy-mm-dd) sets the token's expiry; the
        identity manifest is not modified. Requires manage access on the agent
        since the token authenticates as it.
      operationId: Agent.createAgentToken
      parameters:
        - name: id
          required: true
          in: path
          description: System-generated agent ID.
          schema:
            example: jqfwg345gi25n5ju2yz5iz6m
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateAgentIdentityTokenRequest'
      responses:
        '201':
          description: The newly issued TrueFoundry-backed token for the agent's identity.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GetAgentIdentityTokenResponse'
        '401':
          description: Missing or invalid bearer token
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HttpError'
        '403':
          description: >-
            The caller does not have manage access on the agent, or it does not
            exist.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HttpError'
        '404':
          description: The agent has no linked identity.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HttpError'
        '409':
          description: Conflict — a valid token already exists for the agent's identity.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HttpError'
        '422':
          description: >-
            Unprocessable Entity — the agent identity is not TrueFoundry-backed,
            or the expiry is malformed or in the past.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HttpError'
      security:
        - jwt: []
components:
  schemas:
    CreateAgentIdentityTokenRequest:
      type: object
      properties:
        expirationDate:
          type: string
          description: >-
            Token expiry as yyyy-mm-dd, applied to the issued token's own expiry
            only (the identity manifest is not modified). Defaults to a
            long-lived, effectively non-expiring token when omitted.
          nullable: true
      title: CreateAgentIdentityTokenRequest
      x-fern-type-name: CreateAgentIdentityTokenRequest
    GetAgentIdentityTokenResponse:
      type: object
      properties:
        token:
          type: string
          description: The TrueFoundry-backed agent identity token.
      required:
        - token
      title: GetAgentIdentityTokenResponse
      x-fern-type-name: GetAgentIdentityTokenResponse
    HttpError:
      type: object
      properties:
        statusCode:
          type: integer
          description: HTTP Status Code
        message:
          type: string
          description: Error Message
        code:
          oneOf:
            - type: integer
            - type: string
          description: Error code
          nullable: true
        details:
          type: array
          description: Error details
          items:
            type: object
          nullable: true
      required:
        - statusCode
        - message
      title: HttpError
      x-fern-type-name: HttpError
  securitySchemes:
    jwt:
      type: http
      scheme: bearer
      bearerFormat: JWT

````