basePath: /v1beta1
definitions:
  api.OpenApiApiKey:
    properties:
      accessKey:
        description: The access key of the API key.
        example: ABCDEFGH
        type: string
      displayName:
        description: The display name of the API key.
        example: New Key
        type: string
      name:
        description: The name of the API key.
        example: orgs/1/apiKeys/2
        type: string
      role:
        description: The role of the API key.
        example: org:owner
        type: string
      secretKey:
        description: The secret key of the API key.
        example: 498c7f44-656f-4944-b455-0695faa5d4f9
        type: string
    type: object
  api.OpenApiCreateApiKeyReq:
    properties:
      displayName:
        description: The display name of API key.
        example: New Key
        type: string
      projectId:
        description: The project to which the API key belongs. If not set, the API
          key belongs to org.
        example: 123456
        type: integer
      role:
        description: |-
          The role of API key. If the projectId is set to 0, the role should be Organization roles, if the projectId is not set to 0, the role should be Project roles.

          Organization roles:
          - `org:owner`: indicates the 'Organization Owner' role.
          - `org:member`: indicates the 'Organization Viewer'.
          - `org:billing_admin`: indicates the 'Organization Billing Manager' role.
          - `org:billing_viewer`: indicates the 'Organization Billing Viewer' role.
          - `org:audit_admin`: indicates the 'Organization Console Audit Manager' role.

          Project roles:
          - `project:owner`: indicates the 'Project Owner' role.
          - `project:dev`: indicates the 'Project Data Access Read-Write' role.
          - `project:readonly`: indicates the 'Project Data Access Read-Only' role.
          - `project:ctl_plane_viewer`: indicates the 'Project Viewer' role.
        example: org:owner
        type: string
    type: object
  api.OpenApiError:
    properties:
      code:
        type: string
      error: {}
      msgPrefix:
        type: string
      status:
        type: integer
    type: object
  api.OpenApiListApiKeyRsp:
    properties:
      apiKeys:
        description: The list of matching API keys.
        items:
          $ref: '#/definitions/api.OpenApiApiKey'
        type: array
      nextPageToken:
        description: '`nextPageToken` A token, which can be sent as `pageToken` to
          retrieve the next page. If this field is omitted, there are no subsequent
          pages.'
        example: 498c7f44-656f-4944-b455-0695faa5d4f9
        type: string
    type: object
  api.OpenApiUpdateApiKeyReq:
    properties:
      displayName:
        description: The display name of the API key.
        example: New Key
        type: string
      projectId:
        description: The project to which the API key belongs. If not set, the API
          key belongs to org.
        example: 123456
        type: integer
      role:
        description: |-
          The role of API key. If the projectId is set to 0, the role should be Organization roles, if the projectId is not set to 0, the role should be Project roles.

          Organization roles:
          - `org:owner`: indicates the 'Organization Owner' role.
          - `org:member`: indicates the 'Organization Viewer'.
          - `org:billing_admin`: indicates the 'Organization Billing Manager' role.
          - `org:billing_viewer`: indicates the 'Organization Billing Viewer' role.
          - `org:audit_admin`: indicates the 'Organization Console Audit Manager' role.

          Project roles:
          - `project:owner`: indicates the 'Project Owner' role.
          - `project:dev`: indicates the 'Project Data Access Read-Write' role.
          - `project:readonly`: indicates the 'Project Data Access Read-Only' role.
          - `project:ctl_plane_viewer`: indicates the 'Project Viewer' role.
        example: org:owner
        type: string
    type: object
host: iam.tidbapi.com
info:
  contact: {}
  description: This is an account system server.
  title: Account System OPENAPI
  version: v1beta1
paths:
  /apikeys:
    get:
      consumes:
      - application/json
      description: This endpoint returns a list of API keys.
      parameters:
      - description: The project to which returned API key belongs. If not set, return
          the API keys belongs to org.
        in: query
        name: projectId
        type: integer
      - description: A page token received from a previous call. Provide this to retrieve
          the subsequent page.
        in: query
        name: pageToken
        type: string
      - description: The page size. If unspecified, at most 100 API keys will be returned
          in one page.
        in: query
        name: pageSize
        type: integer
      produces:
      - application/json
      responses:
        "200":
          description: OK
          schema:
            $ref: '#/definitions/api.OpenApiListApiKeyRsp'
        "400":
          description: Bad Request
          schema:
            $ref: '#/definitions/api.OpenApiError'
      summary: Get a list of API keys
      tags:
      - API Key
    post:
      consumes:
      - application/json
      description: This endpoint creates a new API key.
      parameters:
      - description: create API key request
        in: body
        name: apiKey
        required: true
        schema:
          $ref: '#/definitions/api.OpenApiCreateApiKeyReq'
      produces:
      - application/json
      responses:
        "200":
          description: OK
          schema:
            $ref: '#/definitions/api.OpenApiApiKey'
        "400":
          description: Bad Request
          schema:
            $ref: '#/definitions/api.OpenApiError'
      summary: Create a new API key
      tags:
      - API Key
  /apikeys/{accessKey}:
    delete:
      consumes:
      - application/json
      description: This endpoint deletes an API key.
      parameters:
      - description: The access key of the API key to delete.
        in: path
        name: accessKey
        required: true
        type: string
      produces:
      - application/json
      responses:
        "200":
          description: OK
        "400":
          description: Bad Request
          schema:
            $ref: '#/definitions/api.OpenApiError'
      summary: Delete an API key
      tags:
      - API Key
    get:
      consumes:
      - application/json
      description: This endpoint retrieves a single API key.
      parameters:
      - description: The access key of the API key.
        in: path
        name: accessKey
        required: true
        type: string
      produces:
      - application/json
      responses:
        "200":
          description: OK
          schema:
            $ref: '#/definitions/api.OpenApiApiKey'
        "400":
          description: Bad Request
          schema:
            $ref: '#/definitions/api.OpenApiError'
      summary: Get a single API key
      tags:
      - API Key
    patch:
      consumes:
      - application/json
      description: This endpoint updates an API key by overwriting the specified values.
      parameters:
      - description: The access key of the API key to update.
        in: path
        name: accessKey
        required: true
        type: string
      - description: update api key
        in: body
        name: apiKey
        required: true
        schema:
          $ref: '#/definitions/api.OpenApiUpdateApiKeyReq'
      produces:
      - application/json
      responses:
        "200":
          description: OK
        "400":
          description: Bad Request
          schema:
            $ref: '#/definitions/api.OpenApiError'
      summary: Update an API key
      tags:
      - API Key
swagger: "2.0"
