---
title: "Register with email/password"
description: "Register a new user and return tokens.\n\nWhen ``tenant_id`` is provided the user is scoped to that tenant and can\nonly authenticate within it.  When omitted the user is created as a\n*platform-wide* user who can access any tenant/app."
---

> 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/register`

Register a new user and return tokens.

When ``tenant_id`` is provided the user is scoped to that tenant and can
only authenticate within it.  When omitted the user is created as a
*platform-wide* user who can access any tenant/app.

## Request body

_Required._

- `email` (`register_auth_register_post.email`; string, required)
  - format `email`
- `password` (`register_auth_register_post.password`; string, required)
  - minLength 6
- `display_name` (`register_auth_register_post.display_name`; any of, optional)
  - any of: `string`, `null`
- `tenant_id` (`register_auth_register_post.tenant_id`; any of, optional) — Google Identity Platform tenant ID. When set, the user is scoped to this tenant and can only authenticate within it. When omitted, the user is platform-wide and can access any app. Contact your admin to obtain a tenant ID for tenant-scoped registration.
  - any of: `string`, `null`
- `metadata` (`register_auth_register_post.metadata`; any of, optional) — Arbitrary key/value profile data stored with the user account. Max 50 keys, 16 KB.
  - any of: `object`, `null`
- `app_name` (`register_auth_register_post.app_name`; any of, optional)
  - any of: `string`, `null`

## Example request

```json
{
  "email": "user@example.com",
  "password": "S3cur3P@ss!",
  "display_name": "Jane Doe",
  "tenant_id": "vibrantly-1234",
  "metadata": {},
  "app_name": "string"
}
```

## Code samples

### cURL

```bash
curl --request POST \
  --url https://truememory-auth.mvstg.com/auth/register \
  --header 'Content-Type: application/json' \
  --data '
{
  "email": "user@example.com",
  "password": "S3cur3P@ss!",
  "display_name": "Jane Doe",
  "tenant_id": "vibrantly-1234",
  "metadata": {},
  "app_name": "string"
}
'
```

### TypeScript

```typescript
const url = 'https://truememory-auth.mvstg.com/auth/register';
const options = {
  method: 'POST',
  headers: {'Content-Type': 'application/json'},
  body: JSON.stringify({
    email: 'user@example.com',
    password: 'S3cur3P@ss!',
    display_name: 'Jane Doe',
    tenant_id: 'vibrantly-1234',
    metadata: {},
    app_name: 'string'
  })
};

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/register"

payload = {
    "email": "user@example.com",
    "password": "S3cur3P@ss!",
    "display_name": "Jane Doe",
    "tenant_id": "vibrantly-1234",
    "metadata": {},
    "app_name": "string"
}
headers = {"Content-Type": "application/json"}

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

print(response.text)
```

## Responses

### 201

Successful Response

#### Example

```json
{
  "id_token": "string",
  "refresh_token": "string",
  "expires_in": "string",
  "user": {
    "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_token` (`register_auth_register_post.response.201.id_token`; string, required)
- `refresh_token` (`register_auth_register_post.response.201.refresh_token`; string, required)
- `expires_in` (`register_auth_register_post.response.201.expires_in`; string, required)
- `user` (`register_auth_register_post.response.201.user`; any of, optional)
  - any of: `AuthUser`, `null`

### 422

Validation Error

#### Example

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

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


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