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

# Org Generate Token

> Endpoint for organization admins to generate an access token scoped to their organization.

Args:
    org_name (str): The name (or ID) of the organization for which the token is being generated.
    expiry_duration (Optional[int]): Token expiry duration in seconds. If not provided, uses default expiry.

Returns:
    dict: A dictionary containing the `org_token`.

Raises:
    HTTPException 403: If the current user is not authorized to manage the specified organization.



## OpenAPI

````yaml post /api/org/{org_name}/generate_token
openapi: 3.1.0
info:
  title: Apigene
  description: Apigene API
  version: 1.0.0
  contact:
    name: Apigene Support
    url: https://app.apigene.ai
    email: support@apigene.ai
servers:
  - url: https://app.apigene.ai
security:
  - BearerAuth: []
paths:
  /api/org/{org_name}/generate_token:
    post:
      tags:
        - Org
      summary: Org Generate Token
      description: >-
        Endpoint for organization admins to generate an access token scoped to
        their organization.


        Args:
            org_name (str): The name (or ID) of the organization for which the token is being generated.
            expiry_duration (Optional[int]): Token expiry duration in seconds. If not provided, uses default expiry.

        Returns:
            dict: A dictionary containing the `org_token`.

        Raises:
            HTTPException 403: If the current user is not authorized to manage the specified organization.
      operationId: org_generate_token
      parameters:
        - name: org_name
          in: path
          required: true
          schema:
            type: string
            title: Org Name
        - name: expiry_duration
          in: query
          required: false
          schema:
            anyOf:
              - type: integer
              - type: 'null'
            description: Token expiry duration in seconds (optional)
            title: Expiry Duration
          description: Token expiry duration in seconds (optional)
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - BearerAuth: []
components:
  schemas:
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: >-
        JWT Authorization header using the Bearer scheme. Example:
        'Authorization: Bearer {token}'

````