Auth

POST Obtain an API access token

POST /v2/token

Operation ID: getAccessToken.

Obtain a unique token that authorizes you to submit requests to the Marketing Cloud API. You can use the token for up to 20 minutes. When the token expires, request a new one to continue issuing API requests.

Request body (required)

Media type: application/json. Schema: tokenRequestBody.

Responses

  • 200 A successful request returns a response that includes the API token that you must provide to execute other API operations.

    Media type: application/json. Schema: tokenResponseBody.

    Example

    {
      "access_token": "E0VHY1VmkiLCJjbGllbnRfaWQiOiIxb3pIcXd2ZzV2VtaUtkU0_vp8n_M3pfLtSlnFEoZL7VYZfj4-hlqscpnj3cJgmoPI...",
      "token_type": "Bearer",
      "expires_in": 1079,
      "scope": "offline documents_and_images_read documents_and_images_write saved_content_read saved_content_write automations_execute automations_read automations_write journeys_execute journeys_read journeys_write email_read email_send email_write push_read push_send push_write sms_read sms_send sms_write ...",
      "soap_instance_url": "https://{tsd}.soap.marketingcloudapis.com/",
      "rest_instance_url": "https://{tsd}.rest.marketingcloudapis.com/"
    }
  • 401 This response indicates that Marketing Cloud wasn’t able to authorize your request. When you receive a 401 response, verify that your request contains the correct client ID, client secret, and member ID.

    Media type: application/json. Schema: authTokenErrorResponseBody.

    Example

    {
      "error": "invalid_client",
      "error_description": "Invalid client ID. Use the client ID in Marketing Cloud Installed Packages.",
      "error_uri": "https://developer.salesforce.com/docs"
    }
  • 404 This response indicates that the URI in your request couldn’t be reached. When you receive a 404 response, verify that the request contains the correct endpoint URI.

    Media type: application/json. Schema: httpErrorResponseBody.

    Example

    {
      "documentation": "https://developer.salesforce.com/docs/atlas.en-us.mc-apis.meta/mc-apis/error-handling.htm",
      "errorcode": 404,
      "message": "Not Found"
    }