Docs home
About Red Hat Marketplace
Access Red Hat Marketplace
My profile
Recommended browsers
Account management
User management
Roles
Get started with Red Hat Marketplace API
Create an API key
Authenticate API requests
API reference
Billing and invoices
Clusters
Red Hat Marketplace Operator
Operators
Troubleshooting
Getting started
Partner account
Partner payments
Subscription management service
Product renewal and termination
Identifying clients for trial or purchase
Tax considerations
Export compliance
Approve products for purchase
Buy products on Marketplace Select
Customize the Home page
Tag products to enable spend visibility

Authenticate API requests

Request an access token

When using Red Hat Marketplace API, access tokens allow access to Red Hat Marketplace resources. To get an access token, refer to the following procedure.

Prerequisites

Procedure

  • Call the Authentication API. Pass the API key in the body of the request.

Result

The access token shows on the response.

Authentication API reference

Refer to the following details when making a request for an access token.

MethodPath
POST/api-security/om-auth/cloud/token

Request headers

  • Content-Type: application/x-www-form-urlencoded
  • Accept: application/json

Request body parameters

  • grant_type=urn:ibm:params:oauth:grant-type:apikey
  • apikey=${API_KEY}

Example request

Use the following curl command to generate an access token using an API key.

curl -l \
-X POST "https://{host}/api-security/om-auth/cloud/token" \
-H "Content-Type: application/x-www-form-urlencoded" \
-H "Accept: application/json" \
-d "grant_type=urn:ibm:params:oauth:grant-type:apikey&apikey=${API_KEY}" \
jq -r '.access_token')

Use an access token to authenticate a request

To authenticate, use bearer auth and pass your access token in the header of your request.

Example authentication header

curl https://marketplace.redhat.com/account/api/v1/accounts?
-X GET \
-H "Authorization: Bearer ${access_token}" \