Tower Api Keys API

The Api Keys API from Tower — 1 operation(s) for api keys.

OpenAPI Specification

tower-api-keys-api-openapi.yml Raw ↑
openapi: 3.1.0
info:
  contact:
    email: hello@tower.dev
    name: Tower Computing GmbH
    url: https://tower.dev
  description: REST API to interact with Tower Services.
  termsOfService: https://tower.dev/terms
  title: Tower Accounts Api Keys API
  version: v0.11.16
servers:
- url: https://api.tower.dev/v1
tags:
- name: Api Keys
paths:
  /api-keys:
    delete:
      operationId: delete-api-key
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/DeleteAPIKeyParams'
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DeleteAPIKeyResponse'
          description: OK
        default:
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ErrorModel'
          description: Error
      security:
      - AccessTokenAuth:
        - api_keys:delete
      - APIKeyAuth:
        - api_keys:delete
      summary: Delete API key
      tags:
      - Api Keys
    get:
      description: List all the API keys associated with your current account.
      operationId: list-api-keys
      parameters:
      - description: The page number to fetch.
        explode: false
        in: query
        name: page
        schema:
          default: 1
          description: The page number to fetch.
          format: int64
          type: integer
      - description: The number of records to fetch on each page.
        explode: false
        in: query
        name: page_size
        schema:
          default: 20
          description: The number of records to fetch on each page.
          format: int64
          type: integer
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ListAPIKeysResponse'
          description: OK
        default:
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ErrorModel'
          description: Error
      security:
      - AccessTokenAuth:
        - api_keys:read
      - APIKeyAuth:
        - api_keys:read
      summary: List API keys
      tags:
      - Api Keys
    post:
      operationId: create-api-key
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateAPIKeyParams'
        required: true
      responses:
        '201':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CreateAPIKeyResponse'
          description: Created
        default:
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ErrorModel'
          description: Error
      security:
      - AccessTokenAuth:
        - api_keys:create
      - APIKeyAuth:
        - api_keys:create
      summary: Create API Key
      tags:
      - Api Keys
components:
  schemas:
    ErrorDetail:
      additionalProperties: false
      properties:
        location:
          description: Where the error occurred, e.g. 'body.items[3].tags' or 'path.thing-id'
          type: string
        message:
          description: Error message text
          type: string
        value:
          description: The value at the given location
      type: object
    CreateAPIKeyResponse:
      additionalProperties: false
      properties:
        $schema:
          description: A URL to the JSON Schema for this object.
          examples:
          - https://api.tower.dev/v1/schemas/CreateAPIKeyResponse.json
          format: uri
          readOnly: true
          type: string
        api_key:
          $ref: '#/components/schemas/APIKey'
          description: Created API key
      required:
      - api_key
      type: object
    APIKeyOwner:
      additionalProperties: false
      properties:
        name:
          description: 'The owner''s name: a user''s full name (or email) or a service account''s name.'
          readOnly: true
          type: string
        type:
          description: The kind of principal this API key authenticates as.
          enum:
          - user
          - service_account
          type: string
      required:
      - type
      - name
      type: object
    DeleteAPIKeyResponse:
      additionalProperties: false
      properties:
        $schema:
          description: A URL to the JSON Schema for this object.
          examples:
          - https://api.tower.dev/v1/schemas/DeleteAPIKeyResponse.json
          format: uri
          readOnly: true
          type: string
        api_key:
          $ref: '#/components/schemas/APIKey'
          description: Created API key
      required:
      - api_key
      type: object
    ErrorModel:
      additionalProperties: false
      properties:
        $schema:
          description: A URL to the JSON Schema for this object.
          examples:
          - https://api.tower.dev/v1/schemas/ErrorModel.json
          format: uri
          readOnly: true
          type: string
        detail:
          description: A human-readable explanation specific to this occurrence of the problem.
          examples:
          - Property foo is required but is missing.
          type: string
        errors:
          description: Optional list of individual error details
          items:
            $ref: '#/components/schemas/ErrorDetail'
          type: array
        instance:
          description: A URI reference that identifies the specific occurrence of the problem.
          examples:
          - https://example.com/error-log/abc123
          format: uri
          type: string
        status:
          description: HTTP status code
          examples:
          - 400
          format: int64
          type: integer
        title:
          description: A short, human-readable summary of the problem type. This value should not change between occurrences of the error.
          examples:
          - Bad Request
          type: string
        type:
          default: about:blank
          description: A URI reference to human-readable documentation for the error.
          examples:
          - https://example.com/errors/example
          format: uri
          type: string
      type: object
    CreateAPIKeyParams:
      additionalProperties: false
      properties:
        $schema:
          description: A URL to the JSON Schema for this object.
          examples:
          - https://api.tower.dev/v1/schemas/CreateAPIKeyParams.json
          format: uri
          readOnly: true
          type: string
        expires_at:
          description: When this API key expires.
          format: date-time
          type:
          - string
          - 'null'
        name:
          type: string
        scopes:
          description: Space separated scopes that this API key is valid for.
          type:
          - string
          - 'null'
        team:
          description: The team this API key is associated with. This field is optional. You must be a member of the team that you're creating the API key for, and if you're using an API key to create a new API key, the API key you use to authenticate this request must be a personal API key.
          type:
          - string
          - 'null'
      required:
      - name
      type: object
    APIKey:
      additionalProperties: false
      properties:
        created_at:
          format: date-time
          type: string
        expires_at:
          format: date-time
          type: string
        identifier:
          type: string
        last_used_at:
          format: date-time
          type:
          - string
          - 'null'
        name:
          type: string
        owner:
          $ref: '#/components/schemas/APIKeyOwner'
          description: The principal this API key authenticates as. Omitted on legacy user-key responses that do not yet resolve the owner.
        scopes:
          type: string
      required:
      - name
      - identifier
      - last_used_at
      - created_at
      type: object
    DeleteAPIKeyParams:
      additionalProperties: false
      properties:
        $schema:
          description: A URL to the JSON Schema for this object.
          examples:
          - https://api.tower.dev/v1/schemas/DeleteAPIKeyParams.json
          format: uri
          readOnly: true
          type: string
        identifier:
          type: string
      required:
      - identifier
      type: object
    Pagination:
      additionalProperties: false
      properties:
        num_pages:
          format: int64
          type: integer
        page:
          format: int64
          type: integer
        page_size:
          format: int64
          type: integer
        total:
          format: int64
          type: integer
      required:
      - page
      - total
      - num_pages
      - page_size
      type: object
    ListAPIKeysResponse:
      additionalProperties: false
      properties:
        $schema:
          description: A URL to the JSON Schema for this object.
          examples:
          - https://api.tower.dev/v1/schemas/ListAPIKeysResponse.json
          format: uri
          readOnly: true
          type: string
        api_keys:
          description: List of API keys
          items:
            $ref: '#/components/schemas/APIKey'
          type: array
        pages:
          $ref: '#/components/schemas/Pagination'
          description: Pagination information
      required:
      - api_keys
      - pages
      type: object
  securitySchemes:
    APIKeyAuth:
      description: API key created by a Tower user or Tower service account to authenticate an API request.
      in: header
      name: X-API-Key
      type: apiKey
    AccessTokenAuth:
      description: Access token authentication scheme which uses an access token provided by the Tower API as part of a Tower session (see documentation about creating sessions).
      scheme: Bearer
      type: http