nexos.ai User Management API

Manage user API keys.

OpenAPI Specification

nexosai-user-management-api-openapi.yml Raw ↑
openapi: 3.0.0
info:
  title: Nexos AI Public API Production Agent Management User Management API
  version: 1.0.0
  description: Manage agents.
servers:
- url: https://api.nexos.ai
security:
- bearerAuth: []
- apiKeyHeader: []
tags:
- name: User Management
  description: Manage user API keys.
paths:
  /v1/apikey/rotate:
    patch:
      operationId: rotate-api-key-v1
      tags:
      - User Management
      summary: Rotate API key
      description: Rotates the API key used to authenticate this request. Returns a new key value.
      responses:
        '200':
          $ref: '#/components/responses/RotateAPIKeyResponse'
        '401':
          description: Unauthorized — request not authenticated via API key.
        '500':
          description: Internal server error.
  /v1/user/api_keys:
    get:
      operationId: list-user-api-keys-v1
      tags:
      - User Management
      summary: List user API keys
      description: Return all API keys that belong to the current user.
      responses:
        '200':
          description: List of user API keys
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/APIKey'
    post:
      operationId: create-user-api-key-v1
      tags:
      - User Management
      summary: Create user API key
      description: Create a new API key for the current user.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/APIKeyRequest'
      responses:
        '201':
          $ref: '#/components/responses/UserAPIKeyResponse'
  /v1/user/api_keys/bulk:
    post:
      operationId: update-many-user-api-keys-v1
      tags:
      - User Management
      summary: Update many user API keys
      description: Update multiple user API keys in a single request.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/APIKeyBulkUpdateRequest'
      responses:
        '200':
          description: Updated API keys
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/APIKey'
  /v1/user/api_keys/{keyId}:
    delete:
      operationId: delete-user-api-key-v1
      tags:
      - User Management
      summary: Delete user API key
      description: Permanently delete a user API key.
      parameters:
      - name: keyId
        in: path
        required: true
        description: The ID of the key.
        schema:
          type: string
      responses:
        '204':
          description: API key deleted successfully.
        '400':
          description: Bad request
        '404':
          description: User/Key not found.
    patch:
      operationId: update-user-api-key-v1
      tags:
      - User Management
      summary: Update user API key
      description: Update a user API key.
      parameters:
      - name: keyId
        in: path
        required: true
        description: The ID of the key.
        schema:
          type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/APIKeyRequest'
      responses:
        '200':
          $ref: '#/components/responses/UserAPIKeyResponse'
        '400':
          description: Invalid request.
        '404':
          description: User/Key not found.
  /v1/user/api_keys/{keyId}/regenerate:
    patch:
      operationId: regenerate-user-api-key-v1
      deprecated: true
      tags:
      - User Management
      summary: Regenerate user API key
      description: Regenerate the value of a user API key.
      parameters:
      - name: keyId
        in: path
        required: true
        description: The ID of the key.
        schema:
          type: string
      responses:
        '200':
          $ref: '#/components/responses/UserAPIKeyResponse'
        '400':
          description: Invalid request.
        '404':
          description: User/Key not found.
components:
  schemas:
    APIKeyBulkUpdateItem:
      type: object
      properties:
        id:
          type: string
          format: uuid
          description: The UUID of the key to update.
        name:
          type: string
          description: The name of the key.
          minLength: 1
          maxLength: 255
        enabled:
          type: boolean
          description: Whether the API key is enabled.
        expiration_date:
          type: string
          format: date-time
          nullable: true
          description: The date when the key expires.
        remove:
          type: boolean
          description: If you want to remove api key, set this to true - other cases skip.
      required:
      - id
    APIKeyRequest:
      type: object
      properties:
        name:
          type: string
          description: The name of the key (needs to be unique).
          minLength: 1
          maxLength: 255
        enabled:
          type: boolean
          description: Whether the API key is enabled. Only applicable when updating a key.
        expiration_date:
          type: string
          format: date-time
          nullable: true
          description: The date when the key expires. Null means no expiration.
      required:
      - name
    APIKeyBulkUpdateRequest:
      type: object
      properties:
        items:
          type: array
          items:
            $ref: '#/components/schemas/APIKeyBulkUpdateItem'
          maxItems: 100
      required:
      - items
    APIKey:
      type: object
      properties:
        api_key:
          type: string
          description: API Key for use with completions API
        id:
          type: string
          description: Unique identifier for the API key
        name:
          type: string
          description: Display name for the API key
        enabled:
          type: boolean
          description: Whether the API key is enabled.
        removed:
          type: boolean
          description: Whether the API key has been soft-deleted
        created_at:
          type: string
          format: date-time
          description: The time the key was created.
        updated_at:
          type: string
          format: date-time
          description: The time the key was last updated.
        last_used_at:
          type: string
          format: date-time
          description: The time the key was last used.
        expiration_date:
          type: string
          format: date-time
          description: The date when the key expires. Null if the key does not expire.
      required:
      - id
      - api_key
      - name
      - enabled
      - removed
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
    apiKeyHeader:
      type: apiKey
      in: header
      name: X-Api-Key
      description: 'Authenticate by sending your nexos API key in the `X-Api-Key` header (e.g. `X-Api-Key: nexos-...` for a user key or `X-Api-Key: nexos-team-...` for a team key). This is an alternative to the `Authorization: Bearer` scheme. If both `X-Nexos-Key` and `X-Api-Key` are sent, `X-Nexos-Key` takes precedence.'