Create an API credential

How to create an API credential via API

To create a new API credential, send a POST request to the /api/api_credentials endpoint, passing the resource arguments in the request body.

Request

POST https://provisioning.commercelayer.io/api/api_credentials

Arguments

Body Parameter
Type
Required

type

string

Required

attributes.name

string

Required

attributes.kind

string

Required

attributes.redirect_uri

string

Optional

attributes.expires_in

integer

Optional

attributes.mode

string

Optional

attributes.custom

boolean

Optional

attributes.reference

string

Optional

attributes.reference_origin

string

Optional

attributes.metadata

object

Optional

relationships.organization

object

Required

relationships.role

object

Optional

Example

The following request creates a new API credential:

curl -g -X POST \
  'https://provisioning.commercelayer.io/api/api_credentials' \
  -H 'Accept: application/vnd.api+json' \
  -H 'Authorization: Bearer {{your_access_token}}' \
  -H 'Content-Type: application/vnd.api+json' \
  -d '{
  "data": {
    "type": "api_credentials",
    "attributes": {
      "name": "My app",
      "kind": "sales_channel"
    },
    "relationships": {
      "organization": {
        "data": {
          "type": "organizations",
          "id": "ABCRtyUpBa"
        }
      }
    }
  }
}'

Last updated