---
title: "Request Access Token"
method: POST
path: "/oauth2/{auth}/v1/token"
tags: ["Request Access Token"]
---

# Request Access Token

`POST /oauth2/{auth}/v1/token`

Use this API to generate an access token.

## Query parameters

- `scope` 'machinelearning.predict' | 'machinelearning.model' | 'commercestudio.rules' | 'commercestudio.rewrites', required
- `grant_type` 'client_credentials', required

## Headers

- `Cache-Control` 'no-cache', required
- `Accept` 'application/json', required
- `Content-Type` 'application/x-www-form-urlencoded', required

## Response `200`

OK

- ResponseAuth — The token response object, which contains the `access_token` required by operation APIs.
  - `token_type` 'Bearer', required — The token type, which is always a bearer token.
  - `expires_in` 3600, required — The number of seconds before the `access_token` expires. Auth tokens expire in 1 hour. A new token is required after that time.
  - `access_token` string, required — This value is used for the **Token** parameter required by the API.
  - `scope` 'machinelearning.predict' | 'machinelearning.model' | 'commercestudio.rules' | 'commercestudio.rewrites', required — The value defines the scope of access granted and matches the `scope` value from the request. For the token used by the Lucidworks AI API `model` endpoint, use `"scope": "machinelearning.model"`. For the token used by all other Lucidworks AI endpoints, use `"scope": "machinelearning.predict"`. For the token used by the Commerce Studio Rules & Rewrites API rule operations, use `"scope": "commercestudio.rules"`. For the token used by the Commerce Studio Rules & Rewrites API query rewrite operations, use `"scope": "commercestudio.rewrites"`.

## Other responses

- `401` — Unauthorized

---

[API](https://skmtc.dev/lucidworks/apis/rules-rewrites-api.md) · [All operations](https://skmtc.dev/lucidworks/apis/rules-rewrites-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/lucidworks/rules-rewrites-api/revisions/f2d3747848e8/schema)
