---
title: "Request M2M access token."
method: POST
path: "/v2/m2m/token"
tags: ["M2M Authentication"]
---

# Request M2M access token.

`POST /v2/m2m/token`

## Request

- Base URL: `https://api.alianza.com`
- URL: `https://api.alianza.com/v2/m2m/token`
- Auth: none required
- TypeScript: <https://skmtc.dev/alianza/apis/alianza-public-api/docs/v2/m2m/token/post.ts> (a function with typed inputs; its response is checked against the schema)

Public token endpoint using OAuth 2.0 Client Credentials Grant (RFC 6749).

**Required**: `grant_type=client_credentials` as a form parameter.

Supports two authentication methods (mutually exclusive):
1. **HTTP Basic Auth (preferred)**: `Authorization` header with Base64-encoded `client_id:client_secret`
2. **Form parameters (fallback)**: `client_id` and `client_secret` as form-urlencoded body parameters

Returns 400 if credentials are provided via both methods simultaneously.

## Request body `application/x-www-form-urlencoded`

- object
  - `grant_type` 'client_credentials', required: OAuth 2.0 grant type. Must be 'client_credentials'.
  - `client_id` string: Client ID. Required if not using HTTP Basic Auth.
  - `client_secret` string: Client secret. Required if not using HTTP Basic Auth.

## Response `200`

Token successfully issued.

- M2MTokenResponse: Response containing the issued M2M access token.
  - `jwt` string, required: The M2M access token (JWT) to be forwarded in API requests.
  - `tokenType` string, required: Token type. Always 'Bearer'.
  - `ttl` integer, required: Time-to-live of the token in seconds.

## Other responses

- `400`: Invalid request. Returned when: grant_type is missing or not 'client_credentials', credentials are provided via both Authorization header and form parameters, no credentials are provided, or the Basic Auth format is invalid.
- `401`: Invalid client credentials.

---

[API](https://skmtc.dev/alianza/apis/alianza-public-api.md) - [All operations](https://skmtc.dev/alianza/apis/alianza-public-api/llms.txt) - [OpenAPI document](https://skmtc.dev/alianza/apis/alianza-public-api/revisions/7223246c352c?raw)
