Skip to content

🪢 Open source agent evals & observability: Trace, evaluate, and improve LLM applications with one open platform.

7.2 KB
Raw Blame
# yaml-language-server: $schema=https://raw.githubusercontent.com/fern-api/fern/main/fern.schema.json
imports:
  commons: ./commons.yml

service:
  auth: true
  base-path: /api/admin
  endpoints:
    getAll:
      docs: Get all organizations
      method: GET
      path: /organizations
      response: Organizations
      errors:
        - commons.UnauthorizedError
        - commons.MethodNotAllowedError

    create:
      docs: Create a new organization
      method: POST
      path: /organizations
      request:
        name: CreateOrganizationRequest
        body:
          properties:
            name: string
            metadata:
              type: optional<map<string, unknown>>
              docs: Optional metadata for the organization
      response: Organization
      errors:
        - commons.Error
        - commons.UnauthorizedError
        - commons.MethodNotAllowedError

    getById:
      docs: Get organization by ID
      method: GET
      path: /organizations/{organizationId}
      path-parameters:
        organizationId: string
      response: Organization
      errors:
        - commons.Error
        - commons.UnauthorizedError
        - commons.MethodNotAllowedError

    update:
      docs: Update an organization
      method: PUT
      path: /organizations/{organizationId}
      path-parameters:
        organizationId: string
      request:
        name: UpdateOrganizationRequest
        body:
          properties:
            name: string
            metadata:
              type: optional<map<string, unknown>>
              docs: Optional metadata for the organization
      response: Organization
      errors:
        - commons.Error
        - commons.UnauthorizedError
        - commons.MethodNotAllowedError

    delete:
      docs: Delete an organization
      method: DELETE
      path: /organizations/{organizationId}
      path-parameters:
        organizationId: string
      response: DeleteOrganizationResponse
      errors:
        - commons.Error
        - commons.UnauthorizedError
        - commons.MethodNotAllowedError

    # API Key endpoints
    getApiKeys:
      docs: Get all API keys for an organization
      method: GET
      path: /organizations/{organizationId}/apiKeys
      path-parameters:
        organizationId: string
      response: ApiKeyList
      errors:
        - commons.Error
        - commons.UnauthorizedError
        - commons.MethodNotAllowedError

    createApiKey:
      docs: Create a new API key for an organization
      method: POST
      path: /organizations/{organizationId}/apiKeys
      path-parameters:
        organizationId: string
      request:
        name: CreateApiKeyRequest
        body:
          properties:
            name:
              type: optional<string>
              docs: Optional name for the API key. Cannot be provided together with note, even if either value is an empty string.
            note:
              type: optional<string>
              availability:
                status: deprecated
                message: Use name instead.
              docs: Deprecated alias for name. Cannot be provided together with name, even if either value is an empty string.
            expiresAt:
              type: optional<nullable<datetime>>
              docs: Optional expiration timestamp in ISO 8601 format. Must be in the future. Omit or set to null for a key that does not expire.
      response: ApiKeyResponse
      errors:
        - commons.Error
        - commons.UnauthorizedError
        - commons.MethodNotAllowedError

    deleteApiKey:
      docs: Delete an API key for an organization
      method: DELETE
      path: /organizations/{organizationId}/apiKeys/{apiKeyId}
      path-parameters:
        organizationId: string
        apiKeyId: string
      response: DeleteOrganizationResponse
      errors:
        - commons.Error
        - commons.UnauthorizedError
        - commons.MethodNotAllowedError

    # Project endpoints
    transferProject:
      docs: |
        Transfer a project to another organization. The project keeps its data and its project-scoped API keys. Its project memberships and project-level user roles are removed, so members of the target organization get access through their organization role, and organization-scoped API keys of the source organization lose access.

        Transferring a project to the organization it already belongs to is a no-op.
      method: POST
      path: /projects/{projectId}/transfer
      path-parameters:
        projectId: string
      request:
        name: TransferProjectRequest
        body:
          properties:
            targetOrganizationId:
              type: string
              docs: ID of the organization to move the project into
      response: TransferProjectResponse
      errors:
        - commons.Error
        - commons.UnauthorizedError
        - commons.MethodNotAllowedError

types:
  Organizations:
    docs: List of organizations
    properties:
      organizations: list<Organization>

  Organization:
    docs: Organization object
    properties:
      id: string
      name: string
      createdAt: datetime
      metadata:
        type: map<string, unknown>
        docs: Metadata for the organization
      projects: list<OrganizationProject>

  OrganizationProject:
    docs: Project belonging to an organization
    properties:
      id: string
      name: string
      metadata:
        type: optional<map<string, unknown>>
        docs: Metadata for the project
      createdAt: datetime
      updatedAt: datetime

  DeleteOrganizationResponse:
    docs: Response for successful organization deletion
    properties:
      success: boolean

  TransferProjectResponse:
    docs: Response for a project transfer
    properties:
      projectId: string
      organizationId:
        type: string
        docs: ID of the organization the project belongs to after the transfer

  ApiKeyList:
    docs: List of API keys for an organization
    properties:
      apiKeys: list<ApiKeySummary>

  ApiKeySummary:
    docs: Summary of an API key
    properties:
      id: string
      createdAt: datetime
      expiresAt:
        type: optional<datetime>
        docs: Expiration timestamp. Null if the key does not expire.
      lastUsedAt: optional<datetime>
      name:
        type: optional<nullable<string>>
        docs: Name of the API key. Contains the same value as note; null if no name was provided.
      note:
        type: optional<string>
        availability:
          status: deprecated
          message: Use name instead.
        docs: Deprecated alias for name. Contains the same value as name.
      publicKey: string
      displaySecretKey: string

  ApiKeyResponse:
    docs: Response for API key creation
    properties:
      id: string
      createdAt: datetime
      expiresAt:
        type: optional<nullable<datetime>>
        docs: Expiration timestamp. Null if the key does not expire.
      publicKey: string
      secretKey: string
      displaySecretKey: string
      name:
        type: optional<nullable<string>>
        docs: Name of the API key. Contains the same value as note; null if no name was provided.
      note:
        type: optional<string>
        availability:
          status: deprecated
          message: Use name instead.
        docs: Deprecated alias for name. Contains the same value as name.