---
title: "Get an OpenID token object to verify the requester's identity."
method: POST
path: "/_matrix/client/v3/user/{userId}/openid/request_token"
tags: ["OpenID"]
---

# Get an OpenID token object to verify the requester's identity.

`POST /_matrix/client/v3/user/{userId}/openid/request_token`

## Request

- Base URL: `https://matrix.org`
- URL: `https://matrix.org/_matrix/client/v3/user/{userId}/openid/request_token`
- Auth: one of:
  - API key in query parameter `access_token`
  - HTTP bearer
- TypeScript: <https://skmtc.dev/matrix/apis/matrix-client-server-api/docs/_matrix/client/v3/user/:userId/openid/request_token/post.ts> (a function with typed inputs; its response is checked against the schema)

Gets an OpenID token object that the requester may supply to another
service to verify their identity in Matrix. The generated token is only
valid for exchanging for user information from the federation API for
OpenID.

The access token generated is only valid for the OpenID API. It cannot
be used to request another OpenID access token or call `/sync`, for
example.

## Path parameters

- `userId` string, required

## Request body

- object

## Response `200`

OpenID token information. This response is nearly compatible with the
response documented in the
[OpenID Connect 1.0 Specification](http://openid.net/specs/openid-connect-core-1_0.html#TokenResponse)
with the only difference being the lack of an `id_token`. Instead,
the Matrix homeserver's name is provided.

- object
  - `access_token` string, required: An access token the consumer may use to verify the identity of the person who generated the token. This is given to the federation API `GET /openid/userinfo` to verify the user's identity.
  - `expires_in` integer, required: The number of seconds before this token expires and a new one must be generated.
  - `matrix_server_name` string, required: The homeserver domain the consumer should use when attempting to verify the user's identity.
  - `token_type` string, required: The string `Bearer`.

## Other responses

- `429`: This request was rate-limited.

---

[API](https://skmtc.dev/matrix/apis/matrix-client-server-api.md) - [All operations](https://skmtc.dev/matrix/apis/matrix-client-server-api/llms.txt) - [OpenAPI document](https://skmtc.dev/matrix/apis/matrix-client-server-api/revisions/c7fe4072c681?raw)
