Which Credentials You Need
To call an API that is published in the API Portal & AI Hub, you need the endpoint URL of the API and the right credentials in the right headers. An API requires an OAuth2 access token, an API key, or both. A subscription token is needed only when the API has a subscription rate limiting policy. When an API requires more than one credential, send all of them.
| Credential | What It Proves | Where It Comes From | Header |
|---|---|---|---|
| Subscription token | You are subscribed to the API under a plan, so the gateway knows which rate limit to apply. Needed only when the API has a subscription rate limiting policy. | Subscribing to a plan of the API in the portal. | Subscription-Key |
| API key | You are an authorized caller of the API. | The API Keys page of the API in the portal, or the API publisher. | The header configured in the API Key Auth policy of the API. |
| OAuth2 access token | You hold valid client credentials on a key manager. | A key manager, through an OAuth2 key under Keys › OAuth2 Keys. | Authorization: Bearer <token> |
Find Out What an API Expects
The API's specification defines which credentials the API requires.
-
Open the API, and click Documentation, then API Definition.
-
In
securitySchemes, check what the API defines. A scheme of typeoauth2means an access token. A scheme of typeapiKeynames its header in thenamefield. -
In the
securityentries, check what the API requires. A root-levelsecurityblock applies to every operation, and an operation can override it with its own. A scheme that is defined but not referenced insecurityis not required. -
Check whether the API has subscription plans. If it does, you need a subscription token to call it.
The page of the API also shows a Subscription plans panel when the API has subscription plans.
Get Each Credential
| Credential | How to Get It |
|---|---|
| Subscription token | On the page of the API, under Subscription plans, click Subscribe on a plan, and copy the token. To view the token later, click View subscription on the plan. See Manage Subscriptions. |
| API key | On the page of the API, click API Keys, and generate a key. A publisher can also create keys in the API Control Plane. See Consume an API-Key-Secured API and API Keys. |
| OAuth2 access token | Generate an OAuth2 key under Keys › OAuth2 Keys, and get a token with it. ThunderID is the default key manager. See Consume an OAuth2-Secured API. |
Next Steps
- Consume an OAuth2-Secured API - Get an access token and invoke an OAuth2-secured API
- Consume an API-Key-Secured API - Invoke an API with an API key
Was this page helpful?