# Users API Reference

> Platform documentation snapshot. Access, charging and provider requirements remain operation-specific; examples do not execute requests.

### What it does

Manage workspace membership and seats programmatically: list users, inspect roles and provision or deprovision access from your own systems.

### Use cases

- Automate onboarding and offboarding from your HR or identity system.
- Report seat utilization back into an internal admin console.
- Keep team membership in sync across multiple workspaces.

### Parameters

| Parameter | Type | Description |
|-----------|------|-------------|
| `email` | string | User email address (required for create) |
| `phone` | string | User phone number |
| `country` | string | Country code (e.g. "US", "GB") |
| `name` | string | Full display name |
| `givenName` | string | First name |
| `familyName` | string | Last name |
| `company` | string | Company name |
| `role` | enum | User role. Options: "Admin", "Viewer", "Editor" |
| `userId` | string | User ID (path parameter for get/update/delete/enable/disable) |

### Response Schema

_Complete documented fields for this section, with nested notation preserved. Endpoint-specific envelopes, availability and additional fields are described under each endpoint below._

| Field | Notes |
|-------|-------|
| id | |
| email | |
| name | |
| givenName | |
| familyName | |
| phone | |
| country | |
| company | |
| role | |
| status (enabled/disabled) | |
| created_at | |

**Illustrative Example Response (synthetic, not a complete endpoint schema):**

```json
{
  "data": {
    "id": "abc123",
    "email": "user@example.com",
    "name": "string",
    "givenName": "string",
    "familyName": "string",
    "phone": "+14155551234",
    "country": 0,
    "company": "string",
    "role": "string",
    "status": "string",
    "created_at": "2025-06-01T12:00:00Z"
  }
}
```

### GET /users — List Users

Retrieve all users in your account.

**cURL Example:**

```bash
curl -X POST 'https://bvjmtgaxijpyasjtaqiv.supabase.co/functions/v1/api-gateway' \
  -H 'Content-Type: application/json' \
  -H 'x-amz-security-token: YOUR-API-KEY' \
  -d '{
  "path": "/users",
  "method": "GET"
}'
```

### GET /users/{userId} — Get User

Retrieve a specific user by their ID.

**cURL Example:**

```bash
curl -X POST 'https://bvjmtgaxijpyasjtaqiv.supabase.co/functions/v1/api-gateway' \
  -H 'Content-Type: application/json' \
  -H 'x-amz-security-token: YOUR-API-KEY' \
  -d '{
  "path": "/users/{userId}",
  "method": "GET"
}'
```

### GET /users/available — Check Availability

Check if an email address is available for registration.

**Query Parameters:**

- `email`: Email to check

**cURL Example:**

```bash
curl -X POST 'https://bvjmtgaxijpyasjtaqiv.supabase.co/functions/v1/api-gateway' \
  -H 'Content-Type: application/json' \
  -H 'x-amz-security-token: YOUR-API-KEY' \
  -d '{
  "path": "/users/available",
  "method": "GET"
}'
```

### POST /users — Create User

Create a new user in the account.

**Example Request Body:**

```json
{
  "email": "johndoe@yopmail.com",
  "phone": "9876543210",
  "country": "US",
  "name": "John Doe",
  "givenName": "John",
  "familyName": "Doe",
  "company": "ACME LLC.",
  "role": "Viewer"
}
```

**cURL Example:**

```bash
curl -X POST 'https://bvjmtgaxijpyasjtaqiv.supabase.co/functions/v1/api-gateway' \
  -H 'Content-Type: application/json' \
  -H 'x-amz-security-token: YOUR-API-KEY' \
  -d '{
  "path": "/users",
  "method": "POST",
  "body": {
    "email": "johndoe@yopmail.com",
    "phone": "9876543210",
    "country": "US",
    "name": "John Doe",
    "givenName": "John",
    "familyName": "Doe",
    "company": "ACME LLC.",
    "role": "Viewer"
  }
}'
```

### PUT /users/{userId}/enable — Enable User

Re-enable a previously disabled user.

**cURL Example:**

```bash
curl -X POST 'https://bvjmtgaxijpyasjtaqiv.supabase.co/functions/v1/api-gateway' \
  -H 'Content-Type: application/json' \
  -H 'x-amz-security-token: YOUR-API-KEY' \
  -d '{
  "path": "/users/{userId}/enable",
  "method": "PUT"
}'
```

### PUT /users/{userId}/disable — Disable User

Disable a user's access to the account.

**cURL Example:**

```bash
curl -X POST 'https://bvjmtgaxijpyasjtaqiv.supabase.co/functions/v1/api-gateway' \
  -H 'Content-Type: application/json' \
  -H 'x-amz-security-token: YOUR-API-KEY' \
  -d '{
  "path": "/users/{userId}/disable",
  "method": "PUT"
}'
```

### PUT /users/{userId} — Update User

Update an existing user's information.

**Example Request Body:**

```json
{
  "email": "johndoe2@yopmail.com",
  "phone": "9876543210",
  "country": "US",
  "name": "John Doe",
  "givenName": "John",
  "familyName": "Doe",
  "company": "ACME LLC.",
  "role": "Admin"
}
```

**cURL Example:**

```bash
curl -X POST 'https://bvjmtgaxijpyasjtaqiv.supabase.co/functions/v1/api-gateway' \
  -H 'Content-Type: application/json' \
  -H 'x-amz-security-token: YOUR-API-KEY' \
  -d '{
  "path": "/users/{userId}",
  "method": "PUT",
  "body": {
    "email": "johndoe2@yopmail.com",
    "phone": "9876543210",
    "country": "US",
    "name": "John Doe",
    "givenName": "John",
    "familyName": "Doe",
    "company": "ACME LLC.",
    "role": "Admin"
  }
}'
```

### DELETE /users/{userId} — Delete User

Permanently delete a user from the account.

**cURL Example:**

```bash
curl -X POST 'https://bvjmtgaxijpyasjtaqiv.supabase.co/functions/v1/api-gateway' \
  -H 'Content-Type: application/json' \
  -H 'x-amz-security-token: YOUR-API-KEY' \
  -d '{
  "path": "/users/{userId}",
  "method": "DELETE"
}'
```

