# Users

Read more about users management from [Users Management documentation](https://prompteasy.eu/docs/administration/user-management).

## Get the user's own details

`GET /v1/user`

Authentication (security requirement alternatives):

```json
[
  {
    "ApiKeyAuth": [],
    "BearerAuth": []
  }
]
```

- ApiKeyAuth: apiKey, header X-Api-Key
- BearerAuth: http (bearer)

Responses:

- 200: User object

Content type: application/json

Type: object

Schema: [UserWithDevices](https://api.prompteasy.eu/docs/api/models/userwithdevices/index.md)

- `user` (optional)
  Reference: [User](https://api.prompteasy.eu/docs/api/models/user/index.md); Type: object

- `devices` (optional)
  Type: array
  
  Items:
    Reference: [UserDevice](https://api.prompteasy.eu/docs/api/models/userdevice/index.md); Type: object

- 401: Unauthorized

- 403: Forbidden

## Examples

### cURL

```bash
curl -X GET 'https://api.prompteasy.eu/v1/user' \
  -H 'X-Api-Key: YOUR_TOKEN' \
  -H 'Authorization: Bearer YOUR_TOKEN'
```

### JavaScript

```javascript
const response = await fetch('https://api.prompteasy.eu/v1/user', {
  method: 'GET',
  headers: {
    'X-Api-Key': 'YOUR_TOKEN',
    'Authorization': 'Bearer YOUR_TOKEN',
  },
});

const data = await response.text();
```

### Python

```python
import requests

response = requests.get(
    'https://api.prompteasy.eu/v1/user',
    headers={
        'X-Api-Key': 'YOUR_TOKEN',
        'Authorization': 'Bearer YOUR_TOKEN',
    },
)
print(response.text)
```


## Update own user details

`PUT /v1/user`

Authentication (security requirement alternatives):

```json
[
  {
    "ApiKeyAuth": [],
    "BearerAuth": []
  }
]
```

- ApiKeyAuth: apiKey, header X-Api-Key
- BearerAuth: http (bearer)

Request body: application/json (required)

Type: object

Schema: [UpdateOwnRequest](https://api.prompteasy.eu/docs/api/models/updateownrequest/index.md)

- `name` (optional)
  Type: string

- `email` (optional)
  Type: string

- `password` (optional)
  Type: string

- `password_confirmation` (optional)
  Type: string

- `current_password` (optional)
  Type: string

Responses:

- 200: User object

Content type: application/json

Type: object

Schema: [User](https://api.prompteasy.eu/docs/api/models/user/index.md)

- `id` (optional)
  Type: integer
  
  Example:
  
  ```json
  1
  ```

- `name` (optional)
  Type: string
  
  Example:
  
  ```json
  "John Doe"
  ```

- `email` (optional)
  Type: string
  
  Example:
  
  ```json
  "foo@bar.invalid"
  ```

- `email_verified_at` (optional)
  Type: string, date-time
  
  Example:
  
  ```json
  "2025-12-02T18:24:52+00:00"
  ```

- `user_level` (optional)
  Type: string
  
  Example:
  
  ```json
  "moderator"
  ```

- `superadmin_capabilities` (optional)
  Type: array; nullable
  
  Granular capabilities array for superadmin users (operative, finance, legal)
  
  Example:
  
  ```json
  [
    "operative",
    "finance",
    "legal"
  ]
  ```
  
  Items:
    Type: string
    
    enum: ["operative","finance","legal"]

- `created_at` (optional)
  Type: string, date-time
  
  Example:
  
  ```json
  "2025-12-02T18:24:52+00:00"
  ```

- `updated_at` (optional)
  Type: string, date-time
  
  Example:
  
  ```json
  "2025-12-02T18:24:52+00:00"
  ```

- `tenant_id` (optional)
  Type: integer
  
  Example:
  
  ```json
  1
  ```

- `last_active_at` (optional)
  Type: string, date-time
  
  Example:
  
  ```json
  "2025-12-02T18:24:52+00:00"
  ```

- `aup_accepted_at` (optional)
  Type: string, date-time; nullable
  
  Example:
  
  ```json
  "2026-08-15T12:00:00+00:00"
  ```

- `aup_version_number` (optional)
  Type: integer; nullable
  
  Example:
  
  ```json
  1
  ```

- `tokens` (optional)
  Type: array
  
  In some cases superadmin can see user tokens
  
  Items:
    Reference: [TokenInfo](https://api.prompteasy.eu/docs/api/models/tokeninfo/index.md); Type: object

- 403: Forbidden

## Examples

### cURL

```bash
curl -X PUT 'https://api.prompteasy.eu/v1/user' \
  -H 'X-Api-Key: YOUR_TOKEN' \
  -H 'Authorization: Bearer YOUR_TOKEN' \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "name": "string",
  "email": "string",
  "password": "string",
  "password_confirmation": "string",
  "current_password": "string"
}'
```

### JavaScript

```javascript
const body = `{
  "name": "string",
  "email": "string",
  "password": "string",
  "password_confirmation": "string",
  "current_password": "string"
}`;

const response = await fetch('https://api.prompteasy.eu/v1/user', {
  method: 'PUT',
  headers: {
    'X-Api-Key': 'YOUR_TOKEN',
    'Authorization': 'Bearer YOUR_TOKEN',
    'Content-Type': 'application/json',
  },
  body,
});

const data = await response.text();
```

### Python

```python
import requests

body = '''{
  "name": "string",
  "email": "string",
  "password": "string",
  "password_confirmation": "string",
  "current_password": "string"
}'''

response = requests.put(
    'https://api.prompteasy.eu/v1/user',
    data=body.encode('utf-8'),
    headers={
        'X-Api-Key': 'YOUR_TOKEN',
        'Authorization': 'Bearer YOUR_TOKEN',
        'Content-Type': 'application/json',
    },
)
print(response.text)
```


## Accept latest Acceptable Use Policy

`POST /v1/user/aup`

Authentication (security requirement alternatives):

```json
[
  {
    "ApiKeyAuth": [],
    "BearerAuth": []
  }
]
```

- ApiKeyAuth: apiKey, header X-Api-Key
- BearerAuth: http (bearer)

Responses:

- 200: AUP accepted or already agreed

Content type: application/json

Type: object

- `message` (optional)
  Type: string
  
  Example:
  
  ```json
  "AUP accepted."
  ```

- 401: Unauthorized

- 403: Forbidden

- 404: AUP contract not found

## Examples

### cURL

```bash
curl -X POST 'https://api.prompteasy.eu/v1/user/aup' \
  -H 'X-Api-Key: YOUR_TOKEN' \
  -H 'Authorization: Bearer YOUR_TOKEN'
```

### JavaScript

```javascript
const response = await fetch('https://api.prompteasy.eu/v1/user/aup', {
  method: 'POST',
  headers: {
    'X-Api-Key': 'YOUR_TOKEN',
    'Authorization': 'Bearer YOUR_TOKEN',
  },
});

const data = await response.text();
```

### Python

```python
import requests

response = requests.post(
    'https://api.prompteasy.eu/v1/user/aup',
    headers={
        'X-Api-Key': 'YOUR_TOKEN',
        'Authorization': 'Bearer YOUR_TOKEN',
    },
)
print(response.text)
```


## Remove own safe devices which doesn't require 2FA code

`DELETE /v1/user/2fa/devices`

Authentication (security requirement alternatives):

```json
[
  {
    "ApiKeyAuth": [],
    "BearerAuth": []
  }
]
```

- ApiKeyAuth: apiKey, header X-Api-Key
- BearerAuth: http (bearer)

Responses:

- 204: No Content

## Examples

### cURL

```bash
curl -X DELETE 'https://api.prompteasy.eu/v1/user/2fa/devices' \
  -H 'X-Api-Key: YOUR_TOKEN' \
  -H 'Authorization: Bearer YOUR_TOKEN'
```

### JavaScript

```javascript
const response = await fetch('https://api.prompteasy.eu/v1/user/2fa/devices', {
  method: 'DELETE',
  headers: {
    'X-Api-Key': 'YOUR_TOKEN',
    'Authorization': 'Bearer YOUR_TOKEN',
  },
});

const data = await response.text();
```

### Python

```python
import requests

response = requests.delete(
    'https://api.prompteasy.eu/v1/user/2fa/devices',
    headers={
        'X-Api-Key': 'YOUR_TOKEN',
        'Authorization': 'Bearer YOUR_TOKEN',
    },
)
print(response.text)
```


## Show current user recovery codes

`POST /v1/user/2fa/recovery-codes/view`

Authentication (security requirement alternatives):

```json
[
  {
    "ApiKeyAuth": [],
    "BearerAuth": []
  }
]
```

- ApiKeyAuth: apiKey, header X-Api-Key
- BearerAuth: http (bearer)

Request body: application/json (required)

Type: object

Schema: [CurrentPasswordRequest](https://api.prompteasy.eu/docs/api/models/currentpasswordrequest/index.md)

- `current_password` (optional)
  Type: string

Responses:

- 200: User recovery codes object

Content type: application/json

Type: object

Schema: [RecoveryCodesList](https://api.prompteasy.eu/docs/api/models/recoverycodeslist/index.md)

- `message` (optional)
  Type: string
  
  Example:
  
  ```json
  "Recovery codes generated"
  ```

- `recovery_codes` (optional)
  Type: array
  
  Items:
    Reference: [RecoveryCode](https://api.prompteasy.eu/docs/api/models/recoverycode/index.md); Type: object

- 422: Unprocessable Entity

Content type: application/json

Type: object

Schema: [ValidationError](https://api.prompteasy.eu/docs/api/models/validationerror/index.md)

- `message` (optional)
  Type: string
  
  Example:
  
  ```json
  "Validation failed"
  ```

- `errors` (optional)
  Reference: [ValidationErrorErrors](https://api.prompteasy.eu/docs/api/models/validationerrorerrors/index.md); Type: object

## Examples

### cURL

```bash
curl -X POST 'https://api.prompteasy.eu/v1/user/2fa/recovery-codes/view' \
  -H 'X-Api-Key: YOUR_TOKEN' \
  -H 'Authorization: Bearer YOUR_TOKEN' \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "current_password": "string"
}'
```

### JavaScript

```javascript
const body = `{
  "current_password": "string"
}`;

const response = await fetch('https://api.prompteasy.eu/v1/user/2fa/recovery-codes/view', {
  method: 'POST',
  headers: {
    'X-Api-Key': 'YOUR_TOKEN',
    'Authorization': 'Bearer YOUR_TOKEN',
    'Content-Type': 'application/json',
  },
  body,
});

const data = await response.text();
```

### Python

```python
import requests

body = '''{
  "current_password": "string"
}'''

response = requests.post(
    'https://api.prompteasy.eu/v1/user/2fa/recovery-codes/view',
    data=body.encode('utf-8'),
    headers={
        'X-Api-Key': 'YOUR_TOKEN',
        'Authorization': 'Bearer YOUR_TOKEN',
        'Content-Type': 'application/json',
    },
)
print(response.text)
```


## Generate recovery codes for current user

`POST /v1/user/2fa/recovery-codes/regenerate`

Authentication (security requirement alternatives):

```json
[
  {
    "ApiKeyAuth": [],
    "BearerAuth": []
  }
]
```

- ApiKeyAuth: apiKey, header X-Api-Key
- BearerAuth: http (bearer)

Request body: application/json (required)

Type: object

Schema: [CurrentPasswordRequest](https://api.prompteasy.eu/docs/api/models/currentpasswordrequest/index.md)

- `current_password` (optional)
  Type: string

Responses:

- 200: User recovery codes object

Content type: application/json

Type: object

Schema: [RecoveryCodesList](https://api.prompteasy.eu/docs/api/models/recoverycodeslist/index.md)

- `message` (optional)
  Type: string
  
  Example:
  
  ```json
  "Recovery codes generated"
  ```

- `recovery_codes` (optional)
  Type: array
  
  Items:
    Reference: [RecoveryCode](https://api.prompteasy.eu/docs/api/models/recoverycode/index.md); Type: object

- 422: Unprocessable Entity

Content type: application/json

Type: object

Schema: [ValidationError](https://api.prompteasy.eu/docs/api/models/validationerror/index.md)

- `message` (optional)
  Type: string
  
  Example:
  
  ```json
  "Validation failed"
  ```

- `errors` (optional)
  Reference: [ValidationErrorErrors](https://api.prompteasy.eu/docs/api/models/validationerrorerrors/index.md); Type: object

## Examples

### cURL

```bash
curl -X POST 'https://api.prompteasy.eu/v1/user/2fa/recovery-codes/regenerate' \
  -H 'X-Api-Key: YOUR_TOKEN' \
  -H 'Authorization: Bearer YOUR_TOKEN' \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "current_password": "string"
}'
```

### JavaScript

```javascript
const body = `{
  "current_password": "string"
}`;

const response = await fetch('https://api.prompteasy.eu/v1/user/2fa/recovery-codes/regenerate', {
  method: 'POST',
  headers: {
    'X-Api-Key': 'YOUR_TOKEN',
    'Authorization': 'Bearer YOUR_TOKEN',
    'Content-Type': 'application/json',
  },
  body,
});

const data = await response.text();
```

### Python

```python
import requests

body = '''{
  "current_password": "string"
}'''

response = requests.post(
    'https://api.prompteasy.eu/v1/user/2fa/recovery-codes/regenerate',
    data=body.encode('utf-8'),
    headers={
        'X-Api-Key': 'YOUR_TOKEN',
        'Authorization': 'Bearer YOUR_TOKEN',
        'Content-Type': 'application/json',
    },
)
print(response.text)
```


## Get a list of users in the tenant

`GET /v1/users`

Authentication (security requirement alternatives):

```json
[
  {
    "ApiKeyAuth": [],
    "BearerAuth": []
  }
]
```

- ApiKeyAuth: apiKey, header X-Api-Key
- BearerAuth: http (bearer)

Responses:

- 200: A list of users

Content type: application/json

Type: array

Items:
  Reference: [User](https://api.prompteasy.eu/docs/api/models/user/index.md); Type: object

- 403: Forbidden

## Examples

### cURL

```bash
curl -X GET 'https://api.prompteasy.eu/v1/users' \
  -H 'X-Api-Key: YOUR_TOKEN' \
  -H 'Authorization: Bearer YOUR_TOKEN'
```

### JavaScript

```javascript
const response = await fetch('https://api.prompteasy.eu/v1/users', {
  method: 'GET',
  headers: {
    'X-Api-Key': 'YOUR_TOKEN',
    'Authorization': 'Bearer YOUR_TOKEN',
  },
});

const data = await response.text();
```

### Python

```python
import requests

response = requests.get(
    'https://api.prompteasy.eu/v1/users',
    headers={
        'X-Api-Key': 'YOUR_TOKEN',
        'Authorization': 'Bearer YOUR_TOKEN',
    },
)
print(response.text)
```


## Create a new user

`POST /v1/users`

Authentication (security requirement alternatives):

```json
[
  {
    "ApiKeyAuth": [],
    "BearerAuth": []
  }
]
```

- ApiKeyAuth: apiKey, header X-Api-Key
- BearerAuth: http (bearer)

Request body: application/json (required)

Type: object

Schema: [StoreUserRequest](https://api.prompteasy.eu/docs/api/models/storeuserrequest/index.md)

- `name` (optional)
  Type: string

- `email` (optional)
  Type: string

- `user_level` (optional)
  Type: string

- `superadmin_capabilities` (optional)
  Type: array; nullable
  
  Granular capabilities array for superadmin users (operative, finance, legal)
  
  Example:
  
  ```json
  [
    "operative",
    "finance",
    "legal"
  ]
  ```
  
  Items:
    Type: string
    
    enum: ["operative","finance","legal"]

Responses:

- 201: User object

Content type: application/json

Type: object

Schema: [User](https://api.prompteasy.eu/docs/api/models/user/index.md)

- `id` (optional)
  Type: integer
  
  Example:
  
  ```json
  1
  ```

- `name` (optional)
  Type: string
  
  Example:
  
  ```json
  "John Doe"
  ```

- `email` (optional)
  Type: string
  
  Example:
  
  ```json
  "foo@bar.invalid"
  ```

- `email_verified_at` (optional)
  Type: string, date-time
  
  Example:
  
  ```json
  "2025-12-02T18:24:52+00:00"
  ```

- `user_level` (optional)
  Type: string
  
  Example:
  
  ```json
  "moderator"
  ```

- `superadmin_capabilities` (optional)
  Type: array; nullable
  
  Granular capabilities array for superadmin users (operative, finance, legal)
  
  Example:
  
  ```json
  [
    "operative",
    "finance",
    "legal"
  ]
  ```
  
  Items:
    Type: string
    
    enum: ["operative","finance","legal"]

- `created_at` (optional)
  Type: string, date-time
  
  Example:
  
  ```json
  "2025-12-02T18:24:52+00:00"
  ```

- `updated_at` (optional)
  Type: string, date-time
  
  Example:
  
  ```json
  "2025-12-02T18:24:52+00:00"
  ```

- `tenant_id` (optional)
  Type: integer
  
  Example:
  
  ```json
  1
  ```

- `last_active_at` (optional)
  Type: string, date-time
  
  Example:
  
  ```json
  "2025-12-02T18:24:52+00:00"
  ```

- `aup_accepted_at` (optional)
  Type: string, date-time; nullable
  
  Example:
  
  ```json
  "2026-08-15T12:00:00+00:00"
  ```

- `aup_version_number` (optional)
  Type: integer; nullable
  
  Example:
  
  ```json
  1
  ```

- `tokens` (optional)
  Type: array
  
  In some cases superadmin can see user tokens
  
  Items:
    Reference: [TokenInfo](https://api.prompteasy.eu/docs/api/models/tokeninfo/index.md); Type: object

- 403: Forbidden

- 422: Unprocessable Entity

Content type: application/json

Type: object

Schema: [ValidationError](https://api.prompteasy.eu/docs/api/models/validationerror/index.md)

- `message` (optional)
  Type: string
  
  Example:
  
  ```json
  "Validation failed"
  ```

- `errors` (optional)
  Reference: [ValidationErrorErrors](https://api.prompteasy.eu/docs/api/models/validationerrorerrors/index.md); Type: object

## Examples

### cURL

```bash
curl -X POST 'https://api.prompteasy.eu/v1/users' \
  -H 'X-Api-Key: YOUR_TOKEN' \
  -H 'Authorization: Bearer YOUR_TOKEN' \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "name": "string",
  "email": "string",
  "user_level": "string",
  "superadmin_capabilities": [
    "operative",
    "finance",
    "legal"
  ]
}'
```

### JavaScript

```javascript
const body = `{
  "name": "string",
  "email": "string",
  "user_level": "string",
  "superadmin_capabilities": [
    "operative",
    "finance",
    "legal"
  ]
}`;

const response = await fetch('https://api.prompteasy.eu/v1/users', {
  method: 'POST',
  headers: {
    'X-Api-Key': 'YOUR_TOKEN',
    'Authorization': 'Bearer YOUR_TOKEN',
    'Content-Type': 'application/json',
  },
  body,
});

const data = await response.text();
```

### Python

```python
import requests

body = '''{
  "name": "string",
  "email": "string",
  "user_level": "string",
  "superadmin_capabilities": [
    "operative",
    "finance",
    "legal"
  ]
}'''

response = requests.post(
    'https://api.prompteasy.eu/v1/users',
    data=body.encode('utf-8'),
    headers={
        'X-Api-Key': 'YOUR_TOKEN',
        'Authorization': 'Bearer YOUR_TOKEN',
        'Content-Type': 'application/json',
    },
)
print(response.text)
```


## Create a service account (bot user)

`POST /v1/users/service-account`

Authentication (security requirement alternatives):

```json
[
  {
    "ApiKeyAuth": [],
    "BearerAuth": []
  }
]
```

- ApiKeyAuth: apiKey, header X-Api-Key
- BearerAuth: http (bearer)

Request body: application/json (required)

Type: object

Schema: [CreateServiceAccountRequest](https://api.prompteasy.eu/docs/api/models/createserviceaccountrequest/index.md)

- `name` (optional)
  Type: string
  
  Example:
  
  ```json
  "Bot User"
  ```

- `is_admin` (optional)
  Type: boolean
  
  Example:
  
  ```json
  false
  ```

- `api_access` (optional)
  Type: boolean
  
  Whether the service account has API access
  
  Example:
  
  ```json
  true
  ```

Responses:

- 201: Service account object with token

Content type: application/json

Type: object

Schema: [ServiceAccount](https://api.prompteasy.eu/docs/api/models/serviceaccount/index.md)

- `user` (optional)
  Reference: [User](https://api.prompteasy.eu/docs/api/models/user/index.md); Type: object

- `token` (optional)
  Type: string
  
  Example:
  
  ```json
  "1|..."
  ```

- 403: Forbidden

- 422: Unprocessable Entity

Content type: application/json

Type: object

Schema: [ValidationError](https://api.prompteasy.eu/docs/api/models/validationerror/index.md)

- `message` (optional)
  Type: string
  
  Example:
  
  ```json
  "Validation failed"
  ```

- `errors` (optional)
  Reference: [ValidationErrorErrors](https://api.prompteasy.eu/docs/api/models/validationerrorerrors/index.md); Type: object

## Examples

### cURL

```bash
curl -X POST 'https://api.prompteasy.eu/v1/users/service-account' \
  -H 'X-Api-Key: YOUR_TOKEN' \
  -H 'Authorization: Bearer YOUR_TOKEN' \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "name": "Bot User",
  "is_admin": false,
  "api_access": true
}'
```

### JavaScript

```javascript
const body = `{
  "name": "Bot User",
  "is_admin": false,
  "api_access": true
}`;

const response = await fetch('https://api.prompteasy.eu/v1/users/service-account', {
  method: 'POST',
  headers: {
    'X-Api-Key': 'YOUR_TOKEN',
    'Authorization': 'Bearer YOUR_TOKEN',
    'Content-Type': 'application/json',
  },
  body,
});

const data = await response.text();
```

### Python

```python
import requests

body = '''{
  "name": "Bot User",
  "is_admin": false,
  "api_access": true
}'''

response = requests.post(
    'https://api.prompteasy.eu/v1/users/service-account',
    data=body.encode('utf-8'),
    headers={
        'X-Api-Key': 'YOUR_TOKEN',
        'Authorization': 'Bearer YOUR_TOKEN',
        'Content-Type': 'application/json',
    },
)
print(response.text)
```


## Get user details

`GET /v1/users/{user}`

Authentication (security requirement alternatives):

```json
[
  {
    "ApiKeyAuth": [],
    "BearerAuth": []
  }
]
```

- ApiKeyAuth: apiKey, header X-Api-Key
- BearerAuth: http (bearer)

Parameters:

- `user` (path, integer, required)
  Type: integer

Responses:

- 200: User object

Content type: application/json

Type: object

Schema: [User](https://api.prompteasy.eu/docs/api/models/user/index.md)

- `id` (optional)
  Type: integer
  
  Example:
  
  ```json
  1
  ```

- `name` (optional)
  Type: string
  
  Example:
  
  ```json
  "John Doe"
  ```

- `email` (optional)
  Type: string
  
  Example:
  
  ```json
  "foo@bar.invalid"
  ```

- `email_verified_at` (optional)
  Type: string, date-time
  
  Example:
  
  ```json
  "2025-12-02T18:24:52+00:00"
  ```

- `user_level` (optional)
  Type: string
  
  Example:
  
  ```json
  "moderator"
  ```

- `superadmin_capabilities` (optional)
  Type: array; nullable
  
  Granular capabilities array for superadmin users (operative, finance, legal)
  
  Example:
  
  ```json
  [
    "operative",
    "finance",
    "legal"
  ]
  ```
  
  Items:
    Type: string
    
    enum: ["operative","finance","legal"]

- `created_at` (optional)
  Type: string, date-time
  
  Example:
  
  ```json
  "2025-12-02T18:24:52+00:00"
  ```

- `updated_at` (optional)
  Type: string, date-time
  
  Example:
  
  ```json
  "2025-12-02T18:24:52+00:00"
  ```

- `tenant_id` (optional)
  Type: integer
  
  Example:
  
  ```json
  1
  ```

- `last_active_at` (optional)
  Type: string, date-time
  
  Example:
  
  ```json
  "2025-12-02T18:24:52+00:00"
  ```

- `aup_accepted_at` (optional)
  Type: string, date-time; nullable
  
  Example:
  
  ```json
  "2026-08-15T12:00:00+00:00"
  ```

- `aup_version_number` (optional)
  Type: integer; nullable
  
  Example:
  
  ```json
  1
  ```

- `tokens` (optional)
  Type: array
  
  In some cases superadmin can see user tokens
  
  Items:
    Reference: [TokenInfo](https://api.prompteasy.eu/docs/api/models/tokeninfo/index.md); Type: object

- 401: Unauthorized

- 403: Forbidden

## Examples

### cURL

```bash
curl -X GET 'https://api.prompteasy.eu/v1/users/0' \
  -H 'X-Api-Key: YOUR_TOKEN' \
  -H 'Authorization: Bearer YOUR_TOKEN'
```

### JavaScript

```javascript
const response = await fetch('https://api.prompteasy.eu/v1/users/0', {
  method: 'GET',
  headers: {
    'X-Api-Key': 'YOUR_TOKEN',
    'Authorization': 'Bearer YOUR_TOKEN',
  },
});

const data = await response.text();
```

### Python

```python
import requests

response = requests.get(
    'https://api.prompteasy.eu/v1/users/0',
    headers={
        'X-Api-Key': 'YOUR_TOKEN',
        'Authorization': 'Bearer YOUR_TOKEN',
    },
)
print(response.text)
```


## Update a user

`PUT /v1/users/{user}`

Authentication (security requirement alternatives):

```json
[
  {
    "ApiKeyAuth": [],
    "BearerAuth": []
  }
]
```

- ApiKeyAuth: apiKey, header X-Api-Key
- BearerAuth: http (bearer)

Parameters:

- `user` (path, integer, required)
  Type: integer

Request body: application/json (required)

Type: unknown

oneOf:
  Reference: [UpdateUserRequest](https://api.prompteasy.eu/docs/api/models/updateuserrequest/index.md); Type: object

  Reference: [UpdateServiceAccountRequest](https://api.prompteasy.eu/docs/api/models/updateserviceaccountrequest/index.md); Type: object

Responses:

- 200: User object

Content type: application/json

Type: object

Schema: [User](https://api.prompteasy.eu/docs/api/models/user/index.md)

- `id` (optional)
  Type: integer
  
  Example:
  
  ```json
  1
  ```

- `name` (optional)
  Type: string
  
  Example:
  
  ```json
  "John Doe"
  ```

- `email` (optional)
  Type: string
  
  Example:
  
  ```json
  "foo@bar.invalid"
  ```

- `email_verified_at` (optional)
  Type: string, date-time
  
  Example:
  
  ```json
  "2025-12-02T18:24:52+00:00"
  ```

- `user_level` (optional)
  Type: string
  
  Example:
  
  ```json
  "moderator"
  ```

- `superadmin_capabilities` (optional)
  Type: array; nullable
  
  Granular capabilities array for superadmin users (operative, finance, legal)
  
  Example:
  
  ```json
  [
    "operative",
    "finance",
    "legal"
  ]
  ```
  
  Items:
    Type: string
    
    enum: ["operative","finance","legal"]

- `created_at` (optional)
  Type: string, date-time
  
  Example:
  
  ```json
  "2025-12-02T18:24:52+00:00"
  ```

- `updated_at` (optional)
  Type: string, date-time
  
  Example:
  
  ```json
  "2025-12-02T18:24:52+00:00"
  ```

- `tenant_id` (optional)
  Type: integer
  
  Example:
  
  ```json
  1
  ```

- `last_active_at` (optional)
  Type: string, date-time
  
  Example:
  
  ```json
  "2025-12-02T18:24:52+00:00"
  ```

- `aup_accepted_at` (optional)
  Type: string, date-time; nullable
  
  Example:
  
  ```json
  "2026-08-15T12:00:00+00:00"
  ```

- `aup_version_number` (optional)
  Type: integer; nullable
  
  Example:
  
  ```json
  1
  ```

- `tokens` (optional)
  Type: array
  
  In some cases superadmin can see user tokens
  
  Items:
    Reference: [TokenInfo](https://api.prompteasy.eu/docs/api/models/tokeninfo/index.md); Type: object

- 403: Forbidden

- 422: Unprocessable Entity

Content type: application/json

Type: object

Schema: [ValidationError](https://api.prompteasy.eu/docs/api/models/validationerror/index.md)

- `message` (optional)
  Type: string
  
  Example:
  
  ```json
  "Validation failed"
  ```

- `errors` (optional)
  Reference: [ValidationErrorErrors](https://api.prompteasy.eu/docs/api/models/validationerrorerrors/index.md); Type: object

## Examples

### cURL

```bash
curl -X PUT 'https://api.prompteasy.eu/v1/users/0' \
  -H 'X-Api-Key: YOUR_TOKEN' \
  -H 'Authorization: Bearer YOUR_TOKEN' \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "name": "string",
  "email": "string",
  "password": "string",
  "password_confirmation": "string",
  "email_verified_at": true,
  "user_level": "string",
  "superadmin_capabilities": [
    "operative",
    "finance",
    "legal"
  ]
}'
```

### JavaScript

```javascript
const body = `{
  "name": "string",
  "email": "string",
  "password": "string",
  "password_confirmation": "string",
  "email_verified_at": true,
  "user_level": "string",
  "superadmin_capabilities": [
    "operative",
    "finance",
    "legal"
  ]
}`;

const response = await fetch('https://api.prompteasy.eu/v1/users/0', {
  method: 'PUT',
  headers: {
    'X-Api-Key': 'YOUR_TOKEN',
    'Authorization': 'Bearer YOUR_TOKEN',
    'Content-Type': 'application/json',
  },
  body,
});

const data = await response.text();
```

### Python

```python
import requests

body = '''{
  "name": "string",
  "email": "string",
  "password": "string",
  "password_confirmation": "string",
  "email_verified_at": true,
  "user_level": "string",
  "superadmin_capabilities": [
    "operative",
    "finance",
    "legal"
  ]
}'''

response = requests.put(
    'https://api.prompteasy.eu/v1/users/0',
    data=body.encode('utf-8'),
    headers={
        'X-Api-Key': 'YOUR_TOKEN',
        'Authorization': 'Bearer YOUR_TOKEN',
        'Content-Type': 'application/json',
    },
)
print(response.text)
```


## Delete a user

`DELETE /v1/users/{user}`

Authentication (security requirement alternatives):

```json
[
  {
    "ApiKeyAuth": [],
    "BearerAuth": []
  }
]
```

- ApiKeyAuth: apiKey, header X-Api-Key
- BearerAuth: http (bearer)

Parameters:

- `user` (path, integer, required)
  Type: integer

Responses:

- 204: No Content

- 403: Forbidden

## Examples

### cURL

```bash
curl -X DELETE 'https://api.prompteasy.eu/v1/users/0' \
  -H 'X-Api-Key: YOUR_TOKEN' \
  -H 'Authorization: Bearer YOUR_TOKEN'
```

### JavaScript

```javascript
const response = await fetch('https://api.prompteasy.eu/v1/users/0', {
  method: 'DELETE',
  headers: {
    'X-Api-Key': 'YOUR_TOKEN',
    'Authorization': 'Bearer YOUR_TOKEN',
  },
});

const data = await response.text();
```

### Python

```python
import requests

response = requests.delete(
    'https://api.prompteasy.eu/v1/users/0',
    headers={
        'X-Api-Key': 'YOUR_TOKEN',
        'Authorization': 'Bearer YOUR_TOKEN',
    },
)
print(response.text)
```


## Remove current user 2FA and send email notification to user to set up 2FA again

`DELETE /v1/users/{user}/2fa`

Authentication (security requirement alternatives):

```json
[
  {
    "ApiKeyAuth": [],
    "BearerAuth": []
  }
]
```

- ApiKeyAuth: apiKey, header X-Api-Key
- BearerAuth: http (bearer)

Parameters:

- `user` (path, integer, required)
  Type: integer

Responses:

- 204: No Content

- 403: Forbidden

## Examples

### cURL

```bash
curl -X DELETE 'https://api.prompteasy.eu/v1/users/0/2fa' \
  -H 'X-Api-Key: YOUR_TOKEN' \
  -H 'Authorization: Bearer YOUR_TOKEN'
```

### JavaScript

```javascript
const response = await fetch('https://api.prompteasy.eu/v1/users/0/2fa', {
  method: 'DELETE',
  headers: {
    'X-Api-Key': 'YOUR_TOKEN',
    'Authorization': 'Bearer YOUR_TOKEN',
  },
});

const data = await response.text();
```

### Python

```python
import requests

response = requests.delete(
    'https://api.prompteasy.eu/v1/users/0/2fa',
    headers={
        'X-Api-Key': 'YOUR_TOKEN',
        'Authorization': 'Bearer YOUR_TOKEN',
    },
)
print(response.text)
```


## Get active user and tenant metadata

`GET /v1/metadata`

Authentication (security requirement alternatives):

```json
[
  {
    "ApiKeyAuth": [],
    "BearerAuth": []
  }
]
```

- ApiKeyAuth: apiKey, header X-Api-Key
- BearerAuth: http (bearer)

Responses:

- 200: User metadata

Content type: application/json

Type: object

Schema: [HeartbeatMetadata](https://api.prompteasy.eu/docs/api/models/heartbeatmetadata/index.md)

- `user_id` (optional)
  Type: integer
  
  Example:
  
  ```json
  1
  ```

- `user` (optional)
  Type: string
  
  Example:
  
  ```json
  "John Doe"
  ```

- `level` (optional)
  Type: string
  
  Example:
  
  ```json
  "superadmin"
  ```

- `superadmin_capabilities` (optional)
  Type: array; nullable
  
  Granular capabilities array for superadmin users (operative, finance, legal)
  
  Example:
  
  ```json
  [
    "operative",
    "finance",
    "legal"
  ]
  ```
  
  Items:
    Type: string
    
    enum: ["operative","finance","legal"]

- `tenant` (optional)
  Type: string
  
  Example:
  
  ```json
  "Acme Inc."
  ```

- `days_to_next_payment` (optional)
  Type: integer
  
  Example:
  
  ```json
  -6
  ```

- `is_trial` (optional)
  Type: boolean
  
  Example:
  
  ```json
  true
  ```

- `has_set_payment_details` (optional)
  Type: boolean
  
  Example:
  
  ```json
  true
  ```

- `country_code` (optional)
  Type: string
  
  Example:
  
  ```json
  "BE"
  ```

- `individual` (optional)
  Type: boolean
  
  Example:
  
  ```json
  false
  ```

- `ai_enabled` (optional)
  Type: boolean
  
  Example:
  
  ```json
  false
  ```

- `auto_approve_suggestions` (optional)
  Type: boolean
  
  Example:
  
  ```json
  false
  ```

- `cfo_board_enabled` (optional)
  Type: boolean
  
  Indicates whether the CFO Board telemetry pipeline is enabled for the tenant
  
  Example:
  
  ```json
  true
  ```

- `plan` (optional)
  Type: string
  
  Example:
  
  ```json
  "premium"
  ```

- `aup_missing` (optional)
  Type: boolean
  
  Indicates whether the user still needs to agree to the latest Acceptable Use Policy
  
  Example:
  
  ```json
  false
  ```

- `teams` (optional)
  Type: array
  
  Items:
    Reference: [UserTeam](https://api.prompteasy.eu/docs/api/models/userteam/index.md); Type: object

- 401: Unauthorized

## Examples

### cURL

```bash
curl -X GET 'https://api.prompteasy.eu/v1/metadata' \
  -H 'X-Api-Key: YOUR_TOKEN' \
  -H 'Authorization: Bearer YOUR_TOKEN'
```

### JavaScript

```javascript
const response = await fetch('https://api.prompteasy.eu/v1/metadata', {
  method: 'GET',
  headers: {
    'X-Api-Key': 'YOUR_TOKEN',
    'Authorization': 'Bearer YOUR_TOKEN',
  },
});

const data = await response.text();
```

### Python

```python
import requests

response = requests.get(
    'https://api.prompteasy.eu/v1/metadata',
    headers={
        'X-Api-Key': 'YOUR_TOKEN',
        'Authorization': 'Bearer YOUR_TOKEN',
    },
)
print(response.text)
```
