---
title: "Create consumer portal token"
method: POST
path: "/api/v1/portal/tokens"
tags: ["Portal"]
---

# Create consumer portal token

`POST /api/v1/portal/tokens`

Create a consumer portal token.

## Request body

- PortalToken — A consumer portal token. Validator doesn't obey required for readOnly properties See: https://github.com/stoplightio/spectral/issues/1274
  - `id` string — ULID (Universally Unique Lexicographically Sortable Identifier).
  - `subject` string, required
  - `expiresAt` string, date-time — [RFC3339](https://tools.ietf.org/html/rfc3339) formatted date-time string in UTC.
  - `expired` boolean
  - `createdAt` string, date-time — [RFC3339](https://tools.ietf.org/html/rfc3339) formatted date-time string in UTC.
  - `token` string — The token is only returned at creation.
  - `allowedMeterSlugs` string[] — Optional, if defined only the specified meters will be allowed.

## Response `200`

The request has succeeded.

- PortalToken — A consumer portal token. Validator doesn't obey required for readOnly properties See: https://github.com/stoplightio/spectral/issues/1274
  - `id` string — ULID (Universally Unique Lexicographically Sortable Identifier).
  - `subject` string, required
  - `expiresAt` string, date-time — [RFC3339](https://tools.ietf.org/html/rfc3339) formatted date-time string in UTC.
  - `expired` boolean
  - `createdAt` string, date-time — [RFC3339](https://tools.ietf.org/html/rfc3339) formatted date-time string in UTC.
  - `token` string — The token is only returned at creation.
  - `allowedMeterSlugs` string[] — Optional, if defined only the specified meters will be allowed.

## Other responses

- `400` — The server cannot or will not process the request due to something that is perceived to be a client error (e.g., malformed request syntax, invalid request message framing, or deceptive request routing).
- `401` — The request has not been applied because it lacks valid authentication credentials for the target resource.
- `403` — The server understood the request but refuses to authorize it.
- `412` — One or more conditions given in the request header fields evaluated to false when tested on the server.
- `500` — The server encountered an unexpected condition that prevented it from fulfilling the request.
- `503` — The server is currently unable to handle the request due to a temporary overload or scheduled maintenance, which will likely be alleviated after some delay.
- `default` — An unexpected error response.

---

[API](https://skmtc.net/openmeterio/apis/openmeter-api.md) · [All operations](https://skmtc.net/openmeterio/apis/openmeter-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/openmeterio/openmeter-api/revisions/1cd97f063f4a/schema)
