---
title: "Claim a username"
description: "Claim a globally unique username.\n\nClaiming is one-time: once you have a username, this endpoint returns\n409. Changing it afterwards goes through ``PUT /auth/username``, which\nis subject to a 14-day cooldown."
---

> Documentation Index
> Fetch the complete documentation index at: https://truememory-docs.mvstg.com/llms.txt
> Use this file to discover all available pages before exploring further.

Path: Auth API › Auth

`POST /auth/username/claim`

Claim a globally unique username.

Claiming is one-time: once you have a username, this endpoint returns
409. Changing it afterwards goes through ``PUT /auth/username``, which
is subject to a 14-day cooldown.

## Authentication

- `HTTPBearer`, http, header `Authorization`

## Request body

_Required._

- `username` (`claim_username_auth_username_claim_post.username`; string, required) — Desired username. 3-30 chars, lowercase alphanumeric, hyphens, underscores.

## Example request

```json
{
  "username": "jane_doe"
}
```

## Code samples

### cURL

```bash
curl --request POST \
  --url https://truememory-auth.mvstg.com/auth/username/claim \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "username": "jane_doe"
}
'
```

### TypeScript

```typescript
const url = 'https://truememory-auth.mvstg.com/auth/username/claim';
const options = {
  method: 'POST',
  headers: {'Content-Type': 'application/json', Authorization: 'Bearer <token>'},
  body: JSON.stringify({username: 'jane_doe'})
};

fetch(url, options)
  .then(res => res.json())
  .then(json => console.log(json))
  .catch(err => console.error(err));
```

### Python

```python
import requests

url = "https://truememory-auth.mvstg.com/auth/username/claim"

payload = { "username": "jane_doe" }
headers = {
    "Content-Type": "application/json",
    "Authorization": "Bearer <token>"
}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
```

## Responses

### 200

Successful Response

#### Example

```json
{
  "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
  "tenant_id": "34f5c98e-f430-457b-a812-92637d0c6fd0",
  "gip_uid": "string",
  "email": "string",
  "email_verified": false,
  "username": "string",
  "display_name": "string",
  "photo_url": "string",
  "phone_number": "string",
  "disabled": false,
  "role": "user",
  "metadata": {},
  "raw_app_meta_data": {},
  "custom_claims": {},
  "last_sign_in_at": "2019-08-24T14:15:22Z",
  "created_at": "2019-08-24T14:15:22Z",
  "updated_at": "2019-08-24T14:15:22Z",
  "deleted_at": "2019-08-24T14:15:22Z",
  "deletion_completed_at": "2019-08-24T14:15:22Z"
}
```

- `id` (`claim_username_auth_username_claim_post.response.200.id`; string, required)
  - format `uuid`
- `gip_uid` (`claim_username_auth_username_claim_post.response.200.gip_uid`; string, required)
- `tenant_id` (`claim_username_auth_username_claim_post.response.200.tenant_id`; any of, optional)
  - any of: `string`, `null`
- `email` (`claim_username_auth_username_claim_post.response.200.email`; any of, optional)
  - any of: `string`, `null`
- `email_verified` (`claim_username_auth_username_claim_post.response.200.email_verified`; boolean, optional)
  - default `false`
- `username` (`claim_username_auth_username_claim_post.response.200.username`; any of, optional)
  - any of: `string`, `null`
- `display_name` (`claim_username_auth_username_claim_post.response.200.display_name`; any of, optional)
  - any of: `string`, `null`
- `photo_url` (`claim_username_auth_username_claim_post.response.200.photo_url`; any of, optional)
  - any of: `string`, `null`
- `phone_number` (`claim_username_auth_username_claim_post.response.200.phone_number`; any of, optional)
  - any of: `string`, `null`
- `disabled` (`claim_username_auth_username_claim_post.response.200.disabled`; boolean, optional)
  - default `false`
- `role` (`claim_username_auth_username_claim_post.response.200.role`; string, optional)
  - default `"user"`
- `metadata` (`claim_username_auth_username_claim_post.response.200.metadata`; object, optional)
- `raw_app_meta_data` (`claim_username_auth_username_claim_post.response.200.raw_app_meta_data`; object, optional)
- `custom_claims` (`claim_username_auth_username_claim_post.response.200.custom_claims`; object, optional)
- `last_sign_in_at` (`claim_username_auth_username_claim_post.response.200.last_sign_in_at`; any of, optional)
  - any of: `string`, `null`
- `created_at` (`claim_username_auth_username_claim_post.response.200.created_at`; any of, optional)
  - any of: `string`, `null`
- `updated_at` (`claim_username_auth_username_claim_post.response.200.updated_at`; any of, optional)
  - any of: `string`, `null`
- `deleted_at` (`claim_username_auth_username_claim_post.response.200.deleted_at`; any of, optional)
  - any of: `string`, `null`
- `deletion_completed_at` (`claim_username_auth_username_claim_post.response.200.deletion_completed_at`; any of, optional)
  - any of: `string`, `null`

### 422

Validation Error

#### Example

```json
{
  "detail": [
    {
      "loc": [
        "string"
      ],
      "msg": "string",
      "type": "string",
      "input": null,
      "ctx": {}
    }
  ]
}
```

- `detail` (`claim_username_auth_username_claim_post.response.422.detail`; array<object>, optional)
  - `loc` (`claim_username_auth_username_claim_post.response.422.detail.loc`; array<any of>, required)
    - any of: `string`, `integer`
  - `msg` (`claim_username_auth_username_claim_post.response.422.detail.msg`; string, required)
  - `type` (`claim_username_auth_username_claim_post.response.422.detail.type`; string, required)
  - `input` (`claim_username_auth_username_claim_post.response.422.detail.input`; unknown, optional)
  - `ctx` (`claim_username_auth_username_claim_post.response.422.detail.ctx`; object, optional)


Source: https://truememory-docs.mvstg.com/auth/username/claim/index.md
