Relationship between apiID and apiKey

new to tyk oss version, create-api-key is very confusing when reference to the geting started doc,Access an API (

what is difference between apiId and apiKey? can not found explain about relationship between apiID and apiKey

Hello @siaochun and welcome to the community.

The API ID is the unique identifier of the API definition. It is an alphabetic, numeric, or alphanumeric string that is associated with a single API definition and separates it from the rest. For example, in your API definition you would have

  "api_id": "alphanemueric_string"

The API Key is a token that gives access to an auth-protected API definition(s). An API key is either associated with a list of API definitions (access rights) or a policy that contains a list of access rights to APIs.The access rights contain the API ID as well as some other fields that are used to determine the behavior of the key e.g. endpoint restriction, rate limit, quota, etc. To create a key, you need to define or specify the properties that the key would have. One of those properties can be the API ID via the access_rights or policies field

"access_rights": {
      "{API-ID}": {
        "api_id": "{API-ID}",
        "api_name": "{API-NAME}",
        "versions": ["Default"]

Hope this helps

1 Like