Tyk

Tyk APIs API

Use the endpoints under this tags to update,add ,delete and fetch the classic APIs.

OpenAPI Specification

tyk-apis-api-openapi.yml Raw ↑
openapi: 3.0.0
info:
  title: Tyk Dashboard Admin Additional Permissions APIs API
  version: 5.3.0
  description: 'For Tyk On-Premises installations only, the Dashboard Admin API has two endpoints and is used to set up and provision a Tyk Dashboard instance without the command line.


    In order to use the Dashboard Admin API, you''ll need to get the `admin_secret` value from your Tyk Dashboard configurations.


    The secret you set should then be sent along as a header with each Dashboard Admin API Request in order for it to be successful:


    ```

    admin-auth: <your-secret>

    ```'
servers:
- url: http://localhost/
- url: https://localhost/
security:
- ApiKeyAuth: []
tags:
- description: Use the endpoints under this tags to update,add ,delete and fetch the classic APIs.
  name: APIs
paths:
  /api/apis:
    get:
      description: Get List of APIs.By default the returned apis will be sorted by created_at field in descending order but this can be changed via sort query parameter.The apis returned are paginated
      operationId: getApis
      parameters:
      - allowEmptyValue: true
        deprecated: true
        description: Return smaller API list payload.
        example: '1'
        in: query
        name: compressed
        required: false
        schema:
          enum:
          - '1'
          type: string
      - description: API Type, internal or external.
        example: rest
        in: query
        name: api_type
        required: false
        schema:
          enum:
          - tcp
          - rest
          - graphql
          - udg
          - subgraph
          - supergraph
          - internal
          type: string
      - description: Comma separated list of categories you want to filter Apis by.
        in: query
        name: category
        required: false
        schema:
          type: string
      - description: Comma separated list of authentication type you want to filter apis by.
        example: keyless,authToken
        in: query
        name: auth_type
        required: false
        schema:
          type: string
      - allowEmptyValue: true
        description: For versioned APIs, return only the base versions.If any value is sent in this query parameter only the base version will be returned
        example: '1'
        in: query
        name: base_apis
        required: false
        schema:
          type: string
      - description: Query string for search/filtering.This will return all apis whose names matches the given pattern
        example: Rate Limit Path API 1
        in: query
        name: q
        required: false
        schema:
          type: string
      - description: Use p query parameter to say which page you want returned. Send number less than 0 to return all items.
        example: 1
        in: query
        name: p
        required: false
        schema:
          type: integer
      - description: '* ''name'' - Sort by name in ascending order.

          * ''-name'' - Sort by name in descending order.

          * ''updated_at'' - Sort by updated_at in ascending order.

          * ''-updated_at'' - Sort by updated_at in descending order.

          * ''created_at'' - Sort by created_at in ascending order.

          * ''-created_at'' - Sort by created_at in descending order.'
        example: name
        in: query
        name: sort
        required: false
        schema:
          enum:
          - name
          - -name
          - created_at
          - -created_at
          - updated_at
          - -updated_at
          type: string
      responses:
        '200':
          content:
            application/json:
              examples:
                paginatedApiExample:
                  $ref: '#/components/examples/paginatedApiExample'
              schema:
                $ref: '#/components/schemas/ApiDefinitionsResponse'
          description: List of API definitions.
        '400':
          content:
            application/json:
              example:
                Message: Could not retrieve APIs.
                Meta: null
                Status: Error
              schema:
                $ref: '#/components/schemas/ApiResponse'
          description: Bad Request
        '401':
          content:
            application/json:
              example:
                Message: Not authorised
                Meta: null
                Status: Error
              schema:
                $ref: '#/components/schemas/ApiResponse'
          description: Unauthorized
        '403':
          content:
            application/json:
              example:
                Message: 'access denied: You do not have permission to access  /api/apis'
                Meta: null
                Status: Error
              schema:
                $ref: '#/components/schemas/ApiResponse'
          description: Forbidden
        '500':
          content:
            application/json:
              example:
                Message: Failed to marshal data for APIs.
                Meta: null
                Status: Error
              schema:
                $ref: '#/components/schemas/ApiResponse'
          description: Internal server error.
      summary: Get List of APIs
      tags:
      - APIs
    post:
      description: "Create an API Definition in Tyk Classic API format.\n  Note that the response includes the newly created Tyk Classic API Definition containing the unique identifier for the APIs (`api_id`). You can provide a value for the `api_id` in the request body, otherwise Tyk will automatically generate a value for you.\n    The `ID` field within the Tyk Classic API Definition is a proprietary field used by Tyk to identify the API within the database and cannot be chosen or modified by the user."
      operationId: postApis
      parameters:
      - description: The base API which the new version will be linked to.
        example: 663a4ed9b6be920001b191ae
        in: query
        name: base_api_id
        required: false
        schema:
          type: string
      - description: The version name of the base API while creating the first version. This doesn't have to be sent for the next versions but if it is set, it will override base API version name.
        example: Default
        in: query
        name: base_api_version_name
        required: false
        schema:
          type: string
      - description: The version name of the created version.
        example: v2
        in: query
        name: new_version_name
        required: false
        schema:
          type: string
      - description: If true, the new version is set as default version.
        example: true
        in: query
        name: set_default
        required: false
        schema:
          type: boolean
      requestBody:
        content:
          application/json:
            example:
              api_definition:
                api_id: b84fe1a04e5648927971c0557971565c
                auth:
                  auth_header_name: authorization
                definition:
                  key: version
                  location: header
                name: Tyk Test API
                org_id: 664a14650619d40001f1f00f
                proxy:
                  listen_path: /tyk-api-test/
                  strip_listen_path: true
                  target_url: https://httpbin.org
                use_oauth2: true
                version_data:
                  not_versioned: true
                  versions:
                    Default:
                      name: Default
            schema:
              $ref: '#/components/schemas/ApiDefinitionWrapper'
      responses:
        '200':
          content:
            application/json:
              example:
                ID: 284acad18f44f3d4e9a0832ccf5fd1
                Message: API created
                Meta: 663cd8615715ec1405aafbea
                Status: OK
              schema:
                $ref: '#/components/schemas/ApiResponse'
          description: API created
        '400':
          content:
            application/json:
              example:
                Message: version name header should be set with base API ID
                Meta: null
                Status: Error
              schema:
                $ref: '#/components/schemas/ApiResponse'
          description: Bad Request
        '401':
          content:
            application/json:
              example:
                Message: Not authorised
                Meta: null
                Status: Error
              schema:
                $ref: '#/components/schemas/ApiResponse'
          description: Unauthorized
        '403':
          content:
            application/json:
              example:
                Message: 'access denied: You do not have permission to access  /api/apis'
                Meta: null
                Status: Error
              schema:
                $ref: '#/components/schemas/ApiResponse'
          description: Forbidden
        '409':
          content:
            application/json:
              example:
                Message: Found API with the same ID
                Meta: null
                Status: Error
              schema:
                $ref: '#/components/schemas/ApiResponse'
          description: if API with given API ID  already exist
      summary: Create API Definition
      tags:
      - APIs
  /api/apis/{apiID}/access:
    get:
      description: This will return APIAccessManagementPayload that has two lists containing users and user groups that have access to an API.
      operationId: getApiAccessRights
      parameters:
      - description: The API ID
        example: b84fe1a04e5648927971c0557971565c
        in: path
        name: apiID
        required: true
        schema:
          type: string
      responses:
        '200':
          content:
            application/json:
              example:
                userGroupIds:
                - 663a4ed6b6be920001b191aa
                - 663a4ed6b6be920001b191ab
                userIds:
                - 663b2a835715ecb6edef24e3
                - 663a5bbf5715ec8040251f2a
              schema:
                $ref: '#/components/schemas/AccessManagementPayload'
          description: APIAccessManagementPayload represents two lists containing users and user groups that have access to an API
        '401':
          content:
            application/json:
              example:
                Message: Not authorised
                Meta: null
                Status: Error
              schema:
                $ref: '#/components/schemas/ApiResponse'
          description: Unauthorized
        '403':
          content:
            application/json:
              example:
                Message: 'access denied: You do not have permission to access  /api/apis/{apiID}/access'
                Meta: null
                Status: Error
              schema:
                $ref: '#/components/schemas/ApiResponse'
          description: Forbidden
        '404':
          content:
            application/json:
              example:
                Message: API not found
                Meta: null
                Status: Error
              schema:
                $ref: '#/components/schemas/ApiResponse'
          description: API with this ID does not exist
        '500':
          content:
            application/json:
              example:
                Message: failed to marshal ownership payload
                Meta: null
                Status: Error
              schema:
                $ref: '#/components/schemas/ApiResponse'
          description: Internal server error.
      summary: Get API access rights (users and userGroups)
      tags:
      - APIs
    put:
      description: This will update the user group and users that have access to an API.The userIds and userGroup sent will entirely replace the existing userIds IDs and userGroup ids.
      operationId: updateApiAccessRights
      parameters:
      - description: The API ID
        example: b84fe1a04e5648927971c0557971565c
        in: path
        name: apiID
        required: true
        schema:
          type: string
      requestBody:
        content:
          application/json:
            example:
              userGroupIds:
              - 663a4ed6b6be920001b191aa
              - 663a4ed6b6be920001b191ab
              userIds:
              - 663a5bbf5715ec8040251f2a
            schema:
              $ref: '#/components/schemas/AccessManagementPayload'
      responses:
        '200':
          content:
            application/json:
              example:
                Message: API access updated
                Meta: null
                Status: OK
              schema:
                $ref: '#/components/schemas/ApiResponse'
          description: API access updated
        '401':
          content:
            application/json:
              example:
                Message: Not authorised
                Meta: null
                Status: Error
              schema:
                $ref: '#/components/schemas/ApiResponse'
          description: Unauthorized
        '403':
          content:
            application/json:
              example:
                Message: 'access denied: You do not have permission to access  /api/apis/{apiID}/access'
                Meta: null
                Status: Error
              schema:
                $ref: '#/components/schemas/ApiResponse'
          description: Forbidden
        '404':
          content:
            application/json:
              example:
                Message: API not found
                Meta: null
                Status: Error
              schema:
                $ref: '#/components/schemas/ApiResponse'
          description: API with ID not found
        '500':
          content:
            application/json:
              example:
                Message: failed to unmarshal categories payload
                Meta: null
                Status: Error
              schema:
                $ref: '#/components/schemas/ApiResponse'
          description: Internal server error.
      summary: Update API access rights (users and userGroups)
      tags:
      - APIs
  /api/apis/{apiId}:
    delete:
      description: Delete an API by ID
      operationId: deleteApi
      parameters:
      - description: ID of API to delete. Can either be internal or public API ID.
        example: b84fe1a04e5648927971c0557971565c
        in: path
        name: apiId
        required: true
        schema:
          type: string
      responses:
        '200':
          content:
            application/json:
              example:
                Message: API deleted
                Meta: null
                Status: OK
              schema:
                $ref: '#/components/schemas/ApiResponse'
          description: OK
        '400':
          content:
            application/json:
              example:
                Message: Could not delete the API
                Meta: null
                Status: Error
              schema:
                $ref: '#/components/schemas/ApiResponse'
          description: Failed to delete
        '401':
          content:
            application/json:
              example:
                Message: Not authorised
                Meta: null
                Status: Error
              schema:
                $ref: '#/components/schemas/ApiResponse'
          description: Unauthorized
        '403':
          content:
            application/json:
              example:
                Message: 'access denied: You do not have permission to access  /api/apis/{apiId}'
                Meta: null
                Status: Error
              schema:
                $ref: '#/components/schemas/ApiResponse'
          description: Forbidden
        '404':
          content:
            application/json:
              example:
                Message: Could not retrieve API detail
                Meta: null
                Status: Error
              schema:
                $ref: '#/components/schemas/ApiResponse'
          description: API with given ID not found
      summary: Delete a single API by ID
      tags:
      - APIs
    get:
      description: Get an API by ID
      operationId: getApi
      parameters:
      - description: ID of API to get. Can either be internal or public API ID.
        example: b84fe1a04e5648927971c0557971565c
        in: path
        name: apiId
        required: true
        schema:
          type: string
      responses:
        '200':
          content:
            application/json:
              examples:
                singleAPIDef:
                  $ref: '#/components/examples/singleAPIDef'
              schema:
                $ref: '#/components/schemas/ApiDefinitionWrapper'
          description: API definition
          headers:
            x-tyk-base-api-id:
              description: ID of the base API if the requested API is a version.
              schema:
                type: string
              style: simple
        '400':
          content:
            application/json:
              example:
                Message: Could not retrieve API detail
                Meta: null
                Status: Error
              schema:
                $ref: '#/components/schemas/ApiResponse'
          description: Bad Request
        '401':
          content:
            application/json:
              example:
                Message: Not authorised
                Meta: null
                Status: Error
              schema:
                $ref: '#/components/schemas/ApiResponse'
          description: Unauthorized
        '403':
          content:
            application/json:
              example:
                Message: 'access denied: You do not have permission to access  /api/apis/{apiId}'
                Meta: null
                Status: Error
              schema:
                $ref: '#/components/schemas/ApiResponse'
          description: Forbidden
        '500':
          content:
            application/json:
              example:
                Message: Failed to marshal data for API detail
                Meta: null
                Status: Error
              schema:
                $ref: '#/components/schemas/ApiResponse'
          description: Internal server error.
      summary: Get a single API by ID
      tags:
      - APIs
    put:
      description: Update an API Definition. api_id can be updated for On-Premise installations, but it cannot be updated when the Dashboard resides in Tyk Cloud. Updates to api_id in Tyk Cloud will be ignored.
      operationId: putApi
      parameters:
      - description: ID of API to get. Can either be internal or public API ID.
        example: b84fe1a04e5648927971c0557971565c
        in: path
        name: apiId
        required: true
        schema:
          type: string
      requestBody:
        content:
          application/json:
            example:
              api_definition:
                api_id: b84fe1a04e5648927971c0557971565c
                auth:
                  auth_header_name: authorization
                definition:
                  key: version
                  location: header
                name: Update API name
                org_id: 664a14650619d40001f1f00f
                proxy:
                  listen_path: /updated-tyk-api-test/
                  strip_listen_path: true
                  target_url: https://httpbin.org
                use_oauth2: true
                version_data:
                  not_versioned: true
                  versions:
                    Default:
                      name: Default
            schema:
              $ref: '#/components/schemas/ApiDefinitionWrapper'
      responses:
        '200':
          content:
            application/json:
              example:
                Message: API updated
                Meta: null
                Status: OK
              schema:
                $ref: '#/components/schemas/ApiResponse'
          description: API updated
        '400':
          content:
            application/json:
              example:
                Message: Invalid `ID` value
                Meta: null
                Status: Error
              schema:
                $ref: '#/components/schemas/ApiResponse'
          description: the ID sent in the body is not same as the ID in the path parameter
        '401':
          content:
            application/json:
              example:
                Message: Not authorised
                Meta: null
                Status: Error
              schema:
                $ref: '#/components/schemas/ApiResponse'
          description: Unauthorized
        '403':
          content:
            application/json:
              example:
                Message: 'access denied: You do not have permission to access  /api/apis/{apiId}'
                Meta: null
                Status: Error
              schema:
                $ref: '#/components/schemas/ApiResponse'
          description: Forbidden
        '404':
          content:
            application/json:
              example:
                Message: API definition does not exist
                Meta: null
                Status: Error
              schema:
                $ref: '#/components/schemas/ApiResponse'
          description: API with given ID not found
        '500':
          content:
            application/json:
              example:
                Message: Error while validating schema
                Meta: null
                Status: Error
              schema:
                $ref: '#/components/schemas/ApiResponse'
          description: Internal server error.
      summary: Update API Definition
      tags:
      - APIs
  /api/apis/{apiId}/url:
    get:
      description: This will return your API BasePath(your API listen path) ,Host(your API domain or gateway hostname ) and API URL (full url to your API upstream which is a combination of the protocol the API uses (e.g http)+ host name(e.g tyk.io) and the API listen_path )
      operationId: getApiUrl
      parameters:
      - description: The API ID
        example: b84fe1a04e5648927971c0557971565c
        in: path
        name: apiId
        required: true
        schema:
          type: string
      responses:
        '200':
          content:
            application/json:
              example:
                ApiURL: http://localhost:8080/rate-limit-proxy-api/
                BasePath: /rate-limit-proxy-api/
                Host: localhost:8080
              schema:
                $ref: '#/components/schemas/URLVals'
          description: Urls returned successfully
        '400':
          content:
            application/json:
              example:
                Message: Could not retrieve API detail
                Meta: null
                Status: Error
              schema:
                $ref: '#/components/schemas/ApiResponse'
          description: API not found
        '401':
          content:
            application/json:
              example:
                Message: Not authorised
                Meta: null
                Status: Error
              schema:
                $ref: '#/components/schemas/ApiResponse'
          description: Unauthorized
        '403':
          content:
            application/json:
              example:
                Message: 'access denied: You do not have permission to access  /api/apis/{apiId}/url'
                Meta: null
                Status: Error
              schema:
                $ref: '#/components/schemas/ApiResponse'
          description: Forbidden
      summary: Get API URLs
      tags:
      - APIs
  /api/apis/categories:
    get:
      description: Get a list of all the defined API categories and the number(count) of APIs that are in each category.
      operationId: getAllApiCategories
      responses:
        '200':
          content:
            application/json:
              example:
                categories:
                - count: 3
                  name: tag2
                - count: 1
                  name: tag2
                - count: 1
                  name: tag3
              schema:
                $ref: '#/components/schemas/AllCategoriesResponse'
          description: API categories
        '401':
          content:
            application/json:
              example:
                Message: Not authorised
                Meta: null
                Status: Error
              schema:
                $ref: '#/components/schemas/ApiResponse'
          description: Unauthorized
        '403':
          content:
            application/json:
              example:
                Message: 'access denied: You do not have permission to access  /api/apis/categories'
                Meta: null
                Status: Error
              schema:
                $ref: '#/components/schemas/ApiResponse'
          description: Forbidden
        '500':
          content:
            application/json:
              example:
                Message: Could not retrieve APIs
                Meta: null
                Status: Error
              schema:
                $ref: '#/components/schemas/ApiResponse'
          description: Internal server error.
      summary: Get API Categories
      tags:
      - APIs
  /api/apis/groups:
    get:
      description: This will return a map/hashmap with categories as keys and the key values will be a list that contains all the APIIDs that belong to that category.
      operationId: getAPIGroups
      responses:
        '200':
          content:
            application/json:
              example:
                '#tag2':
                - d1dfc6a927a046c54c0ed470f19757cc
                '#tag3':
                - d1dfc6a927a046c54c0ed470f19757cc
                httpbin:
                - d1dfc6a927a046c54c0ed470f19757cc
                tag1:
                - d1dfc6a927a046c54c0ed470f19757cc
                - 627efb71ebae49df7a853b9769b65fce
                tag2:
                - d1dfc6a927a046c54c0ed470f19757cc
                - 627efb71ebae49df7a853b9769b65fce
              schema:
                additionalProperties:
                  items:
                    type: string
                  type: array
                type: object
          description: A map of groups with APIs IDs in that group.
        '400':
          content:
            application/json:
              example:
                Message: Could not retrieve APIs.
                Meta: null
                Status: Error
              schema:
                $ref: '#/components/schemas/ApiResponse'
          description: Unable to get groups e.g because database is down
        '401':
          content:
            application/json:
              example:
                Message: Not authorised
                Meta: null
                Status: Error
              schema:
                $ref: '#/components/schemas/ApiResponse'
          description: Unauthorized
        '403':
          content:
            application/json:
              example:
                Message: 'access denied: You do not have permission to access  /api/apis/groups'
                Meta: null
                Status: Error
              schema:
                $ref: '#/components/schemas/ApiResponse'
          description: Forbidden
        '500':
          content:
            application/json:
              example:
                Message: Failed to unmarshal API groups data
                Meta: null
                Status: Error
              schema:
                $ref: '#/components/schemas/ApiResponse'
          description: Internal server error.
      summary: Get API Groups.
      tags:
      - APIs
  /api/apis/search:
    get:
      description: This will return a list of APIs whose names matches the provided q query parameter.If q is not sent all APIs will be returned.The returned results are paginated.
      operationId: searchApis
      parameters:
      - description: Use p query parameter to say which page you want returned. Send number less than 0 to return all items.
        example: 1
        in: query
        name: p
        required: false
        schema:
          type: integer
      - description: The name of the APIs you want to search
        example: Rate Limit Path API 1
        in: query
        name: q
        required: false
        schema:
          type: string
      responses:
        '200':
          content:
            application/json:
              examples:
                paginatedApiExample:
                  $ref: '#/components/examples/paginatedApiExample'
              schema:
                $ref: '#/components/schemas/ApiDefinitionsResponse'
          description: List of API definitions
        '400':
          content:
            application/json:
              example:
                Message: Could not retrieve APIs
                Meta: null
                Status: Error
              schema:
                $ref: '#/components/schemas/ApiResponse'
          description: Bad Request
        '401':
          content:
            application/json:
              example:
                Message: Not authorised
                Meta: null
                Status: Error
              schema:
                $ref: '#/components/schemas/ApiResponse'
          description: Unauthorized
        '403':
          content:
            application/json:
              example:
                Message: 'access denied: You do not have permission to access  /api/apis/search'
                Meta: null
                Status: Error
              schema:
                $ref: '#/components/schemas/ApiResponse'
          description: Forbidden
        '500':
          content:
            application/json:
              example:
                Message: Failed to unmarshal APIs data
                Meta: null
                Status: Error
              schema:
                $ref: '#/components/schemas/ApiResponse'
          description: Internal server error.
      summary: Search List of APIs
      tags:
      - APIs
  /api/examples:
    get:
      description: Returns a list of all example API definitions available in "repository.json" file defined in "x-tyk-examples-index" header. If the header is not provided, Tyk will use the default value of this header which is `tyk-examples` repo.
      operationId: getAPIExamples
      parameters:
      - description: URL path to the repository.json in the repository defined in `x-tyk-repo-url.
        example: https://raw.githubusercontent.com/TykTechnologies/tyk-examples/main/repository.json
        in: header
        name: x-tyk-examples-index
        schema:
          default: https://raw.githubusercontent.com/TykTechnologies/tyk-examples/main/repository.json
          type: string
      responses:
        '200':
          content:
            application/json:
              example:
              - location: udg/vat-checker
                name: VAT number checker UDG
                shortDescription: Simple REST API wrapped in GQL using Universal Data Graph that allows user to check validity of a VAT number and display some details about it.
              - location: udg/geo-info
                name: Geo information about the World
                shortDescription: Countries GQL API extended with information from geocode.xyz
              - location: udg/react-conferences
                name: React conferences in Europe
                shortDescription: Information about React conferences in Europe. This Data Graph stitches together two GQL APIs. The flag image is added by using Trevorblades API as a data source.
              schema:
                items:
                  $ref: '#/components/schemas/ExampleAPIMetadata'
                type: array
          description: List of API examples response.
        '400':
          content:
            application/json:
              example:
                Message: Invalid examples index file or root path.
                Meta: null
                Status: Error
              schema:
                $ref: '#/components/schemas/ApiResponse'
          description: Bad Request
        '401':
          content:
            application/json:
              example:
                Message: Not authorised
                Meta: null
                Status: Error
              schema:
                $ref: '#/components/schemas/ApiResponse'
          description: Unauthorized
        '403':
          content:
            application/json

# --- truncated at 32 KB (89 KB total) ---
# Full source: https://raw.githubusercontent.com/api-evangelist/tyk/refs/heads/main/openapi/tyk-apis-api-openapi.yml