# MQUAD Platform - Unified API Documentation

Complete API reference for all MQUAD microservices, consolidated from each service's live OpenAPI specification.

Every endpoint is tagged `<Service> / <Topic>` so the sidebar is grouped by service and then by functional area. Use the server selector on each endpoint to target the correct local service (all services run on localhost; see the Servers list). Microservice-to-microservice calls additionally require the `X-Tenant-ID` header.

Regenerate with: `python3 scripts/merge_openapi_specs.py`

Version: 2.0.0

Authentication:
- OAuth2PasswordBearer: oauth2
- JWT: http (bearer). JWT Token Authentication
- HTTPBearer: http (bearer)

## Health Check

`GET /api/v1/health`

Also served by Survey Service at http://localhost:8001.

Also served by Data Service at http://localhost:8002.

Also served by Sync Service at http://localhost:8003.

Also served by Analytics Service at http://localhost:8004.

Also served by Workspace Service at http://localhost:8006.

Also served by Webhook Service at http://localhost:8007.

Also served by Form Service at http://localhost:8010.

Also served by Media Service at http://localhost:8011.

Also served by Notification Service at http://localhost:8012.

Also served by Audit Service at http://localhost:8013.

Also served by Feature Flags Service at http://localhost:8014.

Authentication: no security requirement declared for this operation.

Responses:

- 200: Successful Response

Content type: application/json

Type: object

Schema: [Backend_HealthCheckResponseDto](/api-reference/schemas/backend-healthcheckresponsedto-7e1accbe82.md)

- `status` (required)
  Type: string
  
  Example:
  
  ```json
  "Ok"
  ```

- `postgres_status` (optional)
  Type: unknown
  
  Example:
  
  ```json
  "Ok"
  ```
  
  anyOf:
    Type: string
  
    Type: null

- `redis_status` (optional)
  Type: unknown
  
  Example:
  
  ```json
  "Ok"
  ```
  
  anyOf:
    Type: string
  
    Type: null

## Examples

### cURL

```bash
curl -X GET 'http://localhost:8000/api/v1/health'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8000/api/v1/health', {
  method: 'GET',
});

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

### Python

```python
import requests

response = requests.get('http://localhost:8000/api/v1/health')
print(response.text)
```


## Get System Metrics

`GET /api/v1/system-metrics`

Authentication (security requirement alternatives):

```json
[
  {
    "OAuth2PasswordBearer": []
  }
]
```

- OAuth2PasswordBearer: oauth2

Responses:

- 200: Successful Response

Content type: application/json

Type: object

Schema: [Backend_SystemMetricsResponseDto](/api-reference/schemas/backend-systemmetricsresponsedto-d200f89821.md)

- `os_metrics` (required)
  Reference: [Backend_OSMetricsDto](/api-reference/schemas/backend-osmetricsdto-21f13fe5f1.md); Type: object

- `celery_metrics` (optional)
  Type: unknown
  
  anyOf:
    Reference: [Backend_CeleryMetricsDto](/api-reference/schemas/backend-celerymetricsdto-49e2d9128d.md); Type: object
  
    Type: null

## Examples

### cURL

```bash
curl -X GET 'http://localhost:8000/api/v1/system-metrics' \
  -H 'Authorization: Bearer YOUR_TOKEN'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8000/api/v1/system-metrics', {
  method: 'GET',
  headers: {
    'Authorization': 'Bearer YOUR_TOKEN',
  },
});

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

### Python

```python
import requests

response = requests.get(
    'http://localhost:8000/api/v1/system-metrics',
    headers={
        'Authorization': 'Bearer YOUR_TOKEN',
    },
)
print(response.text)
```


## List Tenants

`GET /api/v1/tenants`

Authentication (security requirement alternatives):

```json
[
  {
    "OAuth2PasswordBearer": []
  }
]
```

- OAuth2PasswordBearer: oauth2

Parameters:

- `skip` (query, integer, optional)
  Type: integer
  
  default: 0

- `limit` (query, integer, optional)
  Type: integer
  
  default: 10

- `search` (query, unknown, optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

Responses:

- 200: Successful Response

Content type: application/json

Type: object

Schema: [Backend_TenantListDto](/api-reference/schemas/backend-tenantlistdto-bb0dd28b63.md)

- `items` (required)
  Type: array
  
  Items:
    Reference: [Backend_TenantDto](/api-reference/schemas/backend-tenantdto-b9c2bf7a81.md); Type: object

- `skip` (required)
  Type: integer

- `limit` (required)
  Type: integer

- `total` (required)
  Type: integer

- `has_previous` (required)
  Type: boolean

- `has_next` (required)
  Type: boolean

- 422: Validation Error

Content type: application/json

Type: object

Schema: [Backend_HTTPValidationError](/api-reference/schemas/backend-httpvalidationerror-b82f7839b1.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [Backend_ValidationError](/api-reference/schemas/backend-validationerror-b5b4376c23.md); Type: object

## Examples

### cURL

```bash
curl -X GET 'http://localhost:8000/api/v1/tenants?skip=0&limit=10' \
  -H 'Authorization: Bearer YOUR_TOKEN'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8000/api/v1/tenants?skip=0&limit=10', {
  method: 'GET',
  headers: {
    'Authorization': 'Bearer YOUR_TOKEN',
  },
});

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

### Python

```python
import requests

response = requests.get(
    'http://localhost:8000/api/v1/tenants?skip=0&limit=10',
    headers={
        'Authorization': 'Bearer YOUR_TOKEN',
    },
)
print(response.text)
```


## Create Tenant

`POST /api/v1/tenants`

Authentication (security requirement alternatives):

```json
[
  {
    "OAuth2PasswordBearer": []
  }
]
```

- OAuth2PasswordBearer: oauth2

Request body: application/json (required)

Type: object

Schema: [Backend_CreateTenantDto](/api-reference/schemas/backend-createtenantdto-cd200d76a4.md)

- `name` (required)
  Type: string

- `subdomain` (required)
  Type: string

- `admin_email` (required)
  Type: string, email

- `admin_password` (required)
  Type: string

- `first_name` (required)
  Type: string

- `last_name` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `gender` (required)
  Reference: [Backend_Gender](/api-reference/schemas/backend-gender-58aaeec09d.md); Type: string
  
  enum: ["male","female","other","prefer_not_to_say"]

Responses:

- 201: Successful Response

Content type: application/json

Type: object

Schema: [Backend_CreateTenantResponseDto](/api-reference/schemas/backend-createtenantresponsedto-24778c2f0b.md)

- `id` (required)
  Type: string

- 422: Validation Error

Content type: application/json

Type: object

Schema: [Backend_HTTPValidationError](/api-reference/schemas/backend-httpvalidationerror-b82f7839b1.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [Backend_ValidationError](/api-reference/schemas/backend-validationerror-b5b4376c23.md); Type: object

## Examples

### cURL

```bash
curl -X POST 'http://localhost:8000/api/v1/tenants' \
  -H 'Authorization: Bearer YOUR_TOKEN' \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "name": "string",
  "subdomain": "string",
  "admin_email": "user@example.com",
  "admin_password": "string",
  "first_name": "string",
  "last_name": "string",
  "gender": "male"
}'
```

### JavaScript

```javascript
const body = `{
  "name": "string",
  "subdomain": "string",
  "admin_email": "user@example.com",
  "admin_password": "string",
  "first_name": "string",
  "last_name": "string",
  "gender": "male"
}`;

const response = await fetch('http://localhost:8000/api/v1/tenants', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer YOUR_TOKEN',
    'Content-Type': 'application/json',
  },
  body,
});

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

### Python

```python
import requests

body = '''{
  "name": "string",
  "subdomain": "string",
  "admin_email": "user@example.com",
  "admin_password": "string",
  "first_name": "string",
  "last_name": "string",
  "gender": "male"
}'''

response = requests.post(
    'http://localhost:8000/api/v1/tenants',
    data=body.encode('utf-8'),
    headers={
        'Authorization': 'Bearer YOUR_TOKEN',
        'Content-Type': 'application/json',
    },
)
print(response.text)
```


## Delete Tenant

`DELETE /api/v1/tenants/{id}`

Authentication (security requirement alternatives):

```json
[
  {
    "OAuth2PasswordBearer": []
  }
]
```

- OAuth2PasswordBearer: oauth2

Parameters:

- `id` (path, string, required)
  Type: string

Responses:

- 202: Successful Response

Content type: application/json

Type: unknown

- 422: Validation Error

Content type: application/json

Type: object

Schema: [Backend_HTTPValidationError](/api-reference/schemas/backend-httpvalidationerror-b82f7839b1.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [Backend_ValidationError](/api-reference/schemas/backend-validationerror-b5b4376c23.md); Type: object

## Examples

### cURL

```bash
curl -X DELETE 'http://localhost:8000/api/v1/tenants/string' \
  -H 'Authorization: Bearer YOUR_TOKEN'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8000/api/v1/tenants/string', {
  method: 'DELETE',
  headers: {
    'Authorization': 'Bearer YOUR_TOKEN',
  },
});

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

### Python

```python
import requests

response = requests.delete(
    'http://localhost:8000/api/v1/tenants/string',
    headers={
        'Authorization': 'Bearer YOUR_TOKEN',
    },
)
print(response.text)
```


## Search By Name

`GET /api/v1/tenants/search_by_name/{name}`

Authentication (security requirement alternatives):

```json
[
  {
    "OAuth2PasswordBearer": []
  }
]
```

- OAuth2PasswordBearer: oauth2

Parameters:

- `name` (path, string, required)
  Type: string

Responses:

- 200: Successful Response

Content type: application/json

Type: object

Schema: [Backend_TenantDto](/api-reference/schemas/backend-tenantdto-b9c2bf7a81.md)

- `id` (required)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `name` (required)
  Type: string

- `subdomain` (required)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `is_active` (required)
  Type: boolean

- `custom_domain` (required)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `custom_domain_status` (optional)
  Type: string
  
  default: "failed"
  
  enum: ["active","failed","activation-progress"]

- `features` (optional)
  Type: array
  
  default: []
  
  Items:
    Reference: [Backend_FeatureDto](/api-reference/schemas/backend-featuredto-af3e00c271.md); Type: object

- `subscription_id` (required)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `plan_tier` (optional)
  Type: string
  
  default: "free"

- `is_trial` (optional)
  Type: boolean
  
  default: false

- `trial_end_at` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `has_had_trial` (optional)
  Type: boolean
  
  default: false

- `is_dormant` (optional)
  Type: boolean
  
  default: false

- `billing_individual_name` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `billing_business_name` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `billing_address_line1` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `billing_address_line2` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `billing_address_city` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `billing_address_state` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `billing_address_postal_code` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `billing_address_country` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `tax_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- 422: Validation Error

Content type: application/json

Type: object

Schema: [Backend_HTTPValidationError](/api-reference/schemas/backend-httpvalidationerror-b82f7839b1.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [Backend_ValidationError](/api-reference/schemas/backend-validationerror-b5b4376c23.md); Type: object

## Examples

### cURL

```bash
curl -X GET 'http://localhost:8000/api/v1/tenants/search_by_name/string' \
  -H 'Authorization: Bearer YOUR_TOKEN'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8000/api/v1/tenants/search_by_name/string', {
  method: 'GET',
  headers: {
    'Authorization': 'Bearer YOUR_TOKEN',
  },
});

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

### Python

```python
import requests

response = requests.get(
    'http://localhost:8000/api/v1/tenants/search_by_name/string',
    headers={
        'Authorization': 'Bearer YOUR_TOKEN',
    },
)
print(response.text)
```


## Search By Subdomain

`GET /api/v1/tenants/search_by_subdomain/{subdomain}`

Authentication (security requirement alternatives):

```json
[
  {
    "OAuth2PasswordBearer": []
  }
]
```

- OAuth2PasswordBearer: oauth2

Parameters:

- `subdomain` (path, string, required)
  Type: string

Responses:

- 200: Successful Response

Content type: application/json

Type: object

Schema: [Backend_TenantDto](/api-reference/schemas/backend-tenantdto-b9c2bf7a81.md)

- `id` (required)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `name` (required)
  Type: string

- `subdomain` (required)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `is_active` (required)
  Type: boolean

- `custom_domain` (required)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `custom_domain_status` (optional)
  Type: string
  
  default: "failed"
  
  enum: ["active","failed","activation-progress"]

- `features` (optional)
  Type: array
  
  default: []
  
  Items:
    Reference: [Backend_FeatureDto](/api-reference/schemas/backend-featuredto-af3e00c271.md); Type: object

- `subscription_id` (required)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `plan_tier` (optional)
  Type: string
  
  default: "free"

- `is_trial` (optional)
  Type: boolean
  
  default: false

- `trial_end_at` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `has_had_trial` (optional)
  Type: boolean
  
  default: false

- `is_dormant` (optional)
  Type: boolean
  
  default: false

- `billing_individual_name` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `billing_business_name` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `billing_address_line1` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `billing_address_line2` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `billing_address_city` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `billing_address_state` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `billing_address_postal_code` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `billing_address_country` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `tax_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- 422: Validation Error

Content type: application/json

Type: object

Schema: [Backend_HTTPValidationError](/api-reference/schemas/backend-httpvalidationerror-b82f7839b1.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [Backend_ValidationError](/api-reference/schemas/backend-validationerror-b5b4376c23.md); Type: object

## Examples

### cURL

```bash
curl -X GET 'http://localhost:8000/api/v1/tenants/search_by_subdomain/string' \
  -H 'Authorization: Bearer YOUR_TOKEN'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8000/api/v1/tenants/search_by_subdomain/string', {
  method: 'GET',
  headers: {
    'Authorization': 'Bearer YOUR_TOKEN',
  },
});

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

### Python

```python
import requests

response = requests.get(
    'http://localhost:8000/api/v1/tenants/search_by_subdomain/string',
    headers={
        'Authorization': 'Bearer YOUR_TOKEN',
    },
)
print(response.text)
```


## Check Subdomain Availability

`GET /api/v1/tenants/check_subdomain/{subdomain}`

Authentication: no security requirement declared for this operation.

Parameters:

- `subdomain` (path, string, required)
  Type: string

Responses:

- 200: Successful Response

Content type: application/json

Type: object

Schema: [Backend_SubdomainAvailabilityDto](/api-reference/schemas/backend-subdomainavailabilitydto-1443b51036.md)

- `is_available` (required)
  Type: boolean

- `reason` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- 422: Validation Error

Content type: application/json

Type: object

Schema: [Backend_HTTPValidationError](/api-reference/schemas/backend-httpvalidationerror-b82f7839b1.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [Backend_ValidationError](/api-reference/schemas/backend-validationerror-b5b4376c23.md); Type: object

## Examples

### cURL

```bash
curl -X GET 'http://localhost:8000/api/v1/tenants/check_subdomain/string'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8000/api/v1/tenants/check_subdomain/string', {
  method: 'GET',
});

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

### Python

```python
import requests

response = requests.get('http://localhost:8000/api/v1/tenants/check_subdomain/string')
print(response.text)
```


## Get Reserved Subdomains

`GET /api/v1/tenants/reserved-subdomains`

Get list of reserved subdomains that cannot be used for tenant creation.

Authentication: no security requirement declared for this operation.

Responses:

- 200: Successful Response

Content type: application/json

Type: object

Schema: [Backend_ReservedSubdomainsDto](/api-reference/schemas/backend-reservedsubdomainsdto-0b3de77ddf.md)

- `subdomains` (required)
  Type: array
  
  Items:
    Type: string

## Examples

### cURL

```bash
curl -X GET 'http://localhost:8000/api/v1/tenants/reserved-subdomains'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8000/api/v1/tenants/reserved-subdomains', {
  method: 'GET',
});

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

### Python

```python
import requests

response = requests.get('http://localhost:8000/api/v1/tenants/reserved-subdomains')
print(response.text)
```


## Update Tenant Dns Record

`POST /api/v1/tenants/{tenant_id}/update_dns`

When bringing your own domain you must map the DNS records for your custom domain to point to our main domain.
                You can do this by adding a CNAME record in your domain's DNS settings.
                Here is an example of how to set it up:
                Type: CNAME
                Name: app
                Value: mquad.local

Authentication (security requirement alternatives):

```json
[
  {
    "OAuth2PasswordBearer": []
  }
]
```

- OAuth2PasswordBearer: oauth2

Parameters:

- `tenant_id` (path, string, required)
  Type: string

Request body: application/json (required)

Type: object

Schema: [Backend_UpdateTenantDto](/api-reference/schemas/backend-updatetenantdto-dc31cf016f.md)

- `is_active` (optional)
  Type: unknown
  
  anyOf:
    Type: boolean
  
    Type: null

- `is_dormant` (optional)
  Type: unknown
  
  anyOf:
    Type: boolean
  
    Type: null

- `custom_domain` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `subscription_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `plan_tier` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `custom_domain_status` (optional)
  Type: unknown
  
  anyOf:
    Type: string
    
    enum: ["active","failed","activation-progress"]
  
    Type: null

- `billing_individual_name` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `billing_business_name` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `billing_address_line1` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `billing_address_line2` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `billing_address_city` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `billing_address_state` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `billing_address_postal_code` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `billing_address_country` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `tax_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

Responses:

- 202: Successful Response

Content type: application/json

Type: object

Schema: [Backend_UpdateTenantResponseDto](/api-reference/schemas/backend-updatetenantresponsedto-f75aa0d8da.md)

- `message` (required)
  Type: string

- 422: Validation Error

Content type: application/json

Type: object

Schema: [Backend_HTTPValidationError](/api-reference/schemas/backend-httpvalidationerror-b82f7839b1.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [Backend_ValidationError](/api-reference/schemas/backend-validationerror-b5b4376c23.md); Type: object

## Examples

### cURL

```bash
curl -X POST 'http://localhost:8000/api/v1/tenants/string/update_dns' \
  -H 'Authorization: Bearer YOUR_TOKEN' \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "is_active": true,
  "is_dormant": true,
  "custom_domain": "string",
  "subscription_id": "string",
  "plan_tier": "string",
  "custom_domain_status": "active",
  "billing_individual_name": "string",
  "billing_business_name": "string",
  "billing_address_line1": "string",
  "billing_address_line2": "string",
  "billing_address_city": "string",
  "billing_address_state": "string",
  "billing_address_postal_code": "string",
  "billing_address_country": "string",
  "tax_id": "string"
}'
```

### JavaScript

```javascript
const body = `{
  "is_active": true,
  "is_dormant": true,
  "custom_domain": "string",
  "subscription_id": "string",
  "plan_tier": "string",
  "custom_domain_status": "active",
  "billing_individual_name": "string",
  "billing_business_name": "string",
  "billing_address_line1": "string",
  "billing_address_line2": "string",
  "billing_address_city": "string",
  "billing_address_state": "string",
  "billing_address_postal_code": "string",
  "billing_address_country": "string",
  "tax_id": "string"
}`;

const response = await fetch('http://localhost:8000/api/v1/tenants/string/update_dns', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer YOUR_TOKEN',
    'Content-Type': 'application/json',
  },
  body,
});

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

### Python

```python
import requests

body = '''{
  "is_active": true,
  "is_dormant": true,
  "custom_domain": "string",
  "subscription_id": "string",
  "plan_tier": "string",
  "custom_domain_status": "active",
  "billing_individual_name": "string",
  "billing_business_name": "string",
  "billing_address_line1": "string",
  "billing_address_line2": "string",
  "billing_address_city": "string",
  "billing_address_state": "string",
  "billing_address_postal_code": "string",
  "billing_address_country": "string",
  "tax_id": "string"
}'''

response = requests.post(
    'http://localhost:8000/api/v1/tenants/string/update_dns',
    data=body.encode('utf-8'),
    headers={
        'Authorization': 'Bearer YOUR_TOKEN',
        'Content-Type': 'application/json',
    },
)
print(response.text)
```


## Check Dns Status

`GET /api/v1/tenants/{tenant_id}/check_dns`

Authentication (security requirement alternatives):

```json
[
  {
    "OAuth2PasswordBearer": []
  }
]
```

- OAuth2PasswordBearer: oauth2

Parameters:

- `tenant_id` (path, string, required)
  Type: string

Responses:

- 200: Successful Response

Content type: application/json

Type: object

Schema: [Backend_UpdateTenantResponseDto](/api-reference/schemas/backend-updatetenantresponsedto-f75aa0d8da.md)

- `message` (required)
  Type: string

- 422: Validation Error

Content type: application/json

Type: object

Schema: [Backend_HTTPValidationError](/api-reference/schemas/backend-httpvalidationerror-b82f7839b1.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [Backend_ValidationError](/api-reference/schemas/backend-validationerror-b5b4376c23.md); Type: object

## Examples

### cURL

```bash
curl -X GET 'http://localhost:8000/api/v1/tenants/string/check_dns' \
  -H 'Authorization: Bearer YOUR_TOKEN'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8000/api/v1/tenants/string/check_dns', {
  method: 'GET',
  headers: {
    'Authorization': 'Bearer YOUR_TOKEN',
  },
});

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

### Python

```python
import requests

response = requests.get(
    'http://localhost:8000/api/v1/tenants/string/check_dns',
    headers={
        'Authorization': 'Bearer YOUR_TOKEN',
    },
)
print(response.text)
```


## Get Dns Details

`GET /api/v1/tenants/{tenant_id}/dns-details`

Get detailed DNS information for a tenant.

Authentication (security requirement alternatives):

```json
[
  {
    "OAuth2PasswordBearer": []
  }
]
```

- OAuth2PasswordBearer: oauth2

Parameters:

- `tenant_id` (path, string, required)
  Type: string

Responses:

- 200: Successful Response

Content type: application/json

Type: object

Schema: [Backend_TenantDto](/api-reference/schemas/backend-tenantdto-b9c2bf7a81.md)

- `id` (required)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `name` (required)
  Type: string

- `subdomain` (required)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `is_active` (required)
  Type: boolean

- `custom_domain` (required)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `custom_domain_status` (optional)
  Type: string
  
  default: "failed"
  
  enum: ["active","failed","activation-progress"]

- `features` (optional)
  Type: array
  
  default: []
  
  Items:
    Reference: [Backend_FeatureDto](/api-reference/schemas/backend-featuredto-af3e00c271.md); Type: object

- `subscription_id` (required)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `plan_tier` (optional)
  Type: string
  
  default: "free"

- `is_trial` (optional)
  Type: boolean
  
  default: false

- `trial_end_at` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `has_had_trial` (optional)
  Type: boolean
  
  default: false

- `is_dormant` (optional)
  Type: boolean
  
  default: false

- `billing_individual_name` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `billing_business_name` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `billing_address_line1` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `billing_address_line2` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `billing_address_city` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `billing_address_state` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `billing_address_postal_code` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `billing_address_country` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `tax_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- 422: Validation Error

Content type: application/json

Type: object

Schema: [Backend_HTTPValidationError](/api-reference/schemas/backend-httpvalidationerror-b82f7839b1.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [Backend_ValidationError](/api-reference/schemas/backend-validationerror-b5b4376c23.md); Type: object

## Examples

### cURL

```bash
curl -X GET 'http://localhost:8000/api/v1/tenants/string/dns-details' \
  -H 'Authorization: Bearer YOUR_TOKEN'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8000/api/v1/tenants/string/dns-details', {
  method: 'GET',
  headers: {
    'Authorization': 'Bearer YOUR_TOKEN',
  },
});

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

### Python

```python
import requests

response = requests.get(
    'http://localhost:8000/api/v1/tenants/string/dns-details',
    headers={
        'Authorization': 'Bearer YOUR_TOKEN',
    },
)
print(response.text)
```


## Update Tenant

`PUT /api/v1/tenants/{tenant_id}`

Authentication (security requirement alternatives):

```json
[
  {
    "OAuth2PasswordBearer": []
  }
]
```

- OAuth2PasswordBearer: oauth2

Parameters:

- `tenant_id` (path, string, required)
  Type: string

Request body: application/json (required)

Type: object

Schema: [Backend_UpdateTenantDto](/api-reference/schemas/backend-updatetenantdto-dc31cf016f.md)

- `is_active` (optional)
  Type: unknown
  
  anyOf:
    Type: boolean
  
    Type: null

- `is_dormant` (optional)
  Type: unknown
  
  anyOf:
    Type: boolean
  
    Type: null

- `custom_domain` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `subscription_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `plan_tier` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `custom_domain_status` (optional)
  Type: unknown
  
  anyOf:
    Type: string
    
    enum: ["active","failed","activation-progress"]
  
    Type: null

- `billing_individual_name` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `billing_business_name` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `billing_address_line1` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `billing_address_line2` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `billing_address_city` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `billing_address_state` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `billing_address_postal_code` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `billing_address_country` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `tax_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

Responses:

- 204: Successful Response

- 422: Validation Error

Content type: application/json

Type: object

Schema: [Backend_HTTPValidationError](/api-reference/schemas/backend-httpvalidationerror-b82f7839b1.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [Backend_ValidationError](/api-reference/schemas/backend-validationerror-b5b4376c23.md); Type: object

## Examples

### cURL

```bash
curl -X PUT 'http://localhost:8000/api/v1/tenants/string' \
  -H 'Authorization: Bearer YOUR_TOKEN' \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "is_active": true,
  "is_dormant": true,
  "custom_domain": "string",
  "subscription_id": "string",
  "plan_tier": "string",
  "custom_domain_status": "active",
  "billing_individual_name": "string",
  "billing_business_name": "string",
  "billing_address_line1": "string",
  "billing_address_line2": "string",
  "billing_address_city": "string",
  "billing_address_state": "string",
  "billing_address_postal_code": "string",
  "billing_address_country": "string",
  "tax_id": "string"
}'
```

### JavaScript

```javascript
const body = `{
  "is_active": true,
  "is_dormant": true,
  "custom_domain": "string",
  "subscription_id": "string",
  "plan_tier": "string",
  "custom_domain_status": "active",
  "billing_individual_name": "string",
  "billing_business_name": "string",
  "billing_address_line1": "string",
  "billing_address_line2": "string",
  "billing_address_city": "string",
  "billing_address_state": "string",
  "billing_address_postal_code": "string",
  "billing_address_country": "string",
  "tax_id": "string"
}`;

const response = await fetch('http://localhost:8000/api/v1/tenants/string', {
  method: 'PUT',
  headers: {
    'Authorization': 'Bearer YOUR_TOKEN',
    'Content-Type': 'application/json',
  },
  body,
});

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

### Python

```python
import requests

body = '''{
  "is_active": true,
  "is_dormant": true,
  "custom_domain": "string",
  "subscription_id": "string",
  "plan_tier": "string",
  "custom_domain_status": "active",
  "billing_individual_name": "string",
  "billing_business_name": "string",
  "billing_address_line1": "string",
  "billing_address_line2": "string",
  "billing_address_city": "string",
  "billing_address_state": "string",
  "billing_address_postal_code": "string",
  "billing_address_country": "string",
  "tax_id": "string"
}'''

response = requests.put(
    'http://localhost:8000/api/v1/tenants/string',
    data=body.encode('utf-8'),
    headers={
        'Authorization': 'Bearer YOUR_TOKEN',
        'Content-Type': 'application/json',
    },
)
print(response.text)
```


## Get Tenant Features

`GET /api/v1/tenants/{tenant_id}/features`

Authentication (security requirement alternatives):

```json
[
  {
    "OAuth2PasswordBearer": []
  }
]
```

- OAuth2PasswordBearer: oauth2

Parameters:

- `tenant_id` (path, string, required)
  Type: string

Responses:

- 200: Successful Response

Content type: application/json

Type: array

Items:
  Reference: [Backend_FeatureDto](/api-reference/schemas/backend-featuredto-af3e00c271.md); Type: object

- 422: Validation Error

Content type: application/json

Type: object

Schema: [Backend_HTTPValidationError](/api-reference/schemas/backend-httpvalidationerror-b82f7839b1.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [Backend_ValidationError](/api-reference/schemas/backend-validationerror-b5b4376c23.md); Type: object

## Examples

### cURL

```bash
curl -X GET 'http://localhost:8000/api/v1/tenants/string/features' \
  -H 'Authorization: Bearer YOUR_TOKEN'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8000/api/v1/tenants/string/features', {
  method: 'GET',
  headers: {
    'Authorization': 'Bearer YOUR_TOKEN',
  },
});

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

### Python

```python
import requests

response = requests.get(
    'http://localhost:8000/api/v1/tenants/string/features',
    headers={
        'Authorization': 'Bearer YOUR_TOKEN',
    },
)
print(response.text)
```


## Update Tenant Feature

`PATCH /api/v1/tenants/{tenant_id}/update_feature`

Authentication (security requirement alternatives):

```json
[
  {
    "OAuth2PasswordBearer": []
  }
]
```

- OAuth2PasswordBearer: oauth2

Parameters:

- `tenant_id` (path, string, required)
  Type: string

Request body: application/json (required)

Type: object

Schema: [Backend_FeatureDto](/api-reference/schemas/backend-featuredto-af3e00c271.md)

- `name` (required)
  Reference: [Backend_Feature](/api-reference/schemas/backend-feature-2027695221.md); Type: string
  
  enum: ["chat","report","analytics","organization","teams","stripe"]

- `enabled` (required)
  Type: boolean

Responses:

- 200: Successful Response

Content type: application/json

Type: object

Schema: [Backend_UpdateTenantResponseDto](/api-reference/schemas/backend-updatetenantresponsedto-f75aa0d8da.md)

- `message` (required)
  Type: string

- 422: Validation Error

Content type: application/json

Type: object

Schema: [Backend_HTTPValidationError](/api-reference/schemas/backend-httpvalidationerror-b82f7839b1.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [Backend_ValidationError](/api-reference/schemas/backend-validationerror-b5b4376c23.md); Type: object

## Examples

### cURL

```bash
curl -X PATCH 'http://localhost:8000/api/v1/tenants/string/update_feature' \
  -H 'Authorization: Bearer YOUR_TOKEN' \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "name": "chat",
  "enabled": true
}'
```

### JavaScript

```javascript
const body = `{
  "name": "chat",
  "enabled": true
}`;

const response = await fetch('http://localhost:8000/api/v1/tenants/string/update_feature', {
  method: 'PATCH',
  headers: {
    'Authorization': 'Bearer YOUR_TOKEN',
    'Content-Type': 'application/json',
  },
  body,
});

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

### Python

```python
import requests

body = '''{
  "name": "chat",
  "enabled": true
}'''

response = requests.patch(
    'http://localhost:8000/api/v1/tenants/string/update_feature',
    data=body.encode('utf-8'),
    headers={
        'Authorization': 'Bearer YOUR_TOKEN',
        'Content-Type': 'application/json',
    },
)
print(response.text)
```


## Activate Trial Plan

`PATCH /api/v1/tenants/{tenant_id}/activate_trial_plan`

Activate a trial subscription by creating a real Stripe subscription.

Authentication (security requirement alternatives):

```json
[
  {
    "OAuth2PasswordBearer": []
  }
]
```

- OAuth2PasswordBearer: oauth2

Parameters:

- `tenant_id` (path, string, required)
  Type: string

Request body: application/json

Type: unknown

anyOf:
  Reference: [Backend_ActivateTrialDto](/api-reference/schemas/backend-activatetrialdto-ec86f2e80e.md); Type: object

  Type: null

Responses:

- 200: Successful Response

Content type: application/json

Type: object

Schema: [Backend_UpdateTenantResponseDto](/api-reference/schemas/backend-updatetenantresponsedto-f75aa0d8da.md)

- `message` (required)
  Type: string

- 422: Validation Error

Content type: application/json

Type: object

Schema: [Backend_HTTPValidationError](/api-reference/schemas/backend-httpvalidationerror-b82f7839b1.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [Backend_ValidationError](/api-reference/schemas/backend-validationerror-b5b4376c23.md); Type: object

## Examples

### cURL

```bash
curl -X PATCH 'http://localhost:8000/api/v1/tenants/string/activate_trial_plan' \
  -H 'Authorization: Bearer YOUR_TOKEN' \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "address": {
    "individual_name": "string",
    "business_name": "string",
    "line1": "string",
    "line2": "string",
    "city": "string",
    "state": "string",
    "postal_code": "string",
    "country": "string"
  },
  "tax_id": "string"
}'
```

### JavaScript

```javascript
const body = `{
  "address": {
    "individual_name": "string",
    "business_name": "string",
    "line1": "string",
    "line2": "string",
    "city": "string",
    "state": "string",
    "postal_code": "string",
    "country": "string"
  },
  "tax_id": "string"
}`;

const response = await fetch('http://localhost:8000/api/v1/tenants/string/activate_trial_plan', {
  method: 'PATCH',
  headers: {
    'Authorization': 'Bearer YOUR_TOKEN',
    'Content-Type': 'application/json',
  },
  body,
});

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

### Python

```python
import requests

body = '''{
  "address": {
    "individual_name": "string",
    "business_name": "string",
    "line1": "string",
    "line2": "string",
    "city": "string",
    "state": "string",
    "postal_code": "string",
    "country": "string"
  },
  "tax_id": "string"
}'''

response = requests.patch(
    'http://localhost:8000/api/v1/tenants/string/activate_trial_plan',
    data=body.encode('utf-8'),
    headers={
        'Authorization': 'Bearer YOUR_TOKEN',
        'Content-Type': 'application/json',
    },
)
print(response.text)
```


## Update Tenant Billing Address

`PUT /api/v1/tenants/{tenant_id}/billing-address`

Update tenant billing address and optionally tax ID.

Authentication (security requirement alternatives):

```json
[
  {
    "OAuth2PasswordBearer": []
  }
]
```

- OAuth2PasswordBearer: oauth2

Parameters:

- `tenant_id` (path, string, required)
  Type: string

Request body: application/json (required)

Type: object

Schema: [Backend_UpdateBillingAddressDto](/api-reference/schemas/backend-updatebillingaddressdto-a96c248e7a.md)

- `address` (required)
  Reference: [Backend_BillingAddressDto](/api-reference/schemas/backend-billingaddressdto-4cf9dcd9fa.md); Type: object

- `tax_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

Responses:

- 200: Successful Response

Content type: application/json

Type: object

Schema: [Backend_UpdateTenantResponseDto](/api-reference/schemas/backend-updatetenantresponsedto-f75aa0d8da.md)

- `message` (required)
  Type: string

- 422: Validation Error

Content type: application/json

Type: object

Schema: [Backend_HTTPValidationError](/api-reference/schemas/backend-httpvalidationerror-b82f7839b1.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [Backend_ValidationError](/api-reference/schemas/backend-validationerror-b5b4376c23.md); Type: object

## Examples

### cURL

```bash
curl -X PUT 'http://localhost:8000/api/v1/tenants/string/billing-address' \
  -H 'Authorization: Bearer YOUR_TOKEN' \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "address": {
    "individual_name": "string",
    "business_name": "string",
    "line1": "string",
    "line2": "string",
    "city": "string",
    "state": "string",
    "postal_code": "string",
    "country": "string"
  },
  "tax_id": "string"
}'
```

### JavaScript

```javascript
const body = `{
  "address": {
    "individual_name": "string",
    "business_name": "string",
    "line1": "string",
    "line2": "string",
    "city": "string",
    "state": "string",
    "postal_code": "string",
    "country": "string"
  },
  "tax_id": "string"
}`;

const response = await fetch('http://localhost:8000/api/v1/tenants/string/billing-address', {
  method: 'PUT',
  headers: {
    'Authorization': 'Bearer YOUR_TOKEN',
    'Content-Type': 'application/json',
  },
  body,
});

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

### Python

```python
import requests

body = '''{
  "address": {
    "individual_name": "string",
    "business_name": "string",
    "line1": "string",
    "line2": "string",
    "city": "string",
    "state": "string",
    "postal_code": "string",
    "country": "string"
  },
  "tax_id": "string"
}'''

response = requests.put(
    'http://localhost:8000/api/v1/tenants/string/billing-address',
    data=body.encode('utf-8'),
    headers={
        'Authorization': 'Bearer YOUR_TOKEN',
        'Content-Type': 'application/json',
    },
)
print(response.text)
```


## Get Tenant Plan Tier

`GET /api/v1/tenants/{tenant_id}/plan-tier`

Get the plan tier for a tenant.

Authentication: no security requirement declared for this operation.

Parameters:

- `tenant_id` (path, string, required)
  Type: string

Responses:

- 200: Successful Response

Content type: application/json

Type: object

Schema: [Backend_PlanTierResponseDto](/api-reference/schemas/backend-plantierresponsedto-d96e30612f.md)

- `tier` (required)
  Type: string

- `name` (required)
  Type: string

- 422: Validation Error

Content type: application/json

Type: object

Schema: [Backend_HTTPValidationError](/api-reference/schemas/backend-httpvalidationerror-b82f7839b1.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [Backend_ValidationError](/api-reference/schemas/backend-validationerror-b5b4376c23.md); Type: object

## Examples

### cURL

```bash
curl -X GET 'http://localhost:8000/api/v1/tenants/string/plan-tier'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8000/api/v1/tenants/string/plan-tier', {
  method: 'GET',
});

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

### Python

```python
import requests

response = requests.get('http://localhost:8000/api/v1/tenants/string/plan-tier')
print(response.text)
```


## Get Tenant Plan Context

`GET /api/v1/tenants/{tenant_id}/plan-context`

Return tenant billing state used by feature-flags-service plan resolution.

Authentication: no security requirement declared for this operation.

Parameters:

- `tenant_id` (path, string, required)
  Type: string

Responses:

- 200: Successful Response

Content type: application/json

Type: object

Schema: [Backend_TenantPlanContextResponseDto](/api-reference/schemas/backend-tenantplancontextresponsedto-cfe702fa66.md)

- `tenant_id` (required)
  Type: string

- `tier` (required)
  Type: string

- `name` (required)
  Type: string

- `subscription_status` (optional)
  Type: string
  
  default: "inactive"

- `is_active` (optional)
  Type: boolean
  
  default: false

- `is_trial` (optional)
  Type: boolean
  
  default: false

- `trial_end_at` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `is_dormant` (optional)
  Type: boolean
  
  default: false

- `features` (optional)
  Type: array
  
  Items:
    Type: object
    
    Additional properties: true

- 422: Validation Error

Content type: application/json

Type: object

Schema: [Backend_HTTPValidationError](/api-reference/schemas/backend-httpvalidationerror-b82f7839b1.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [Backend_ValidationError](/api-reference/schemas/backend-validationerror-b5b4376c23.md); Type: object

## Examples

### cURL

```bash
curl -X GET 'http://localhost:8000/api/v1/tenants/string/plan-context'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8000/api/v1/tenants/string/plan-context', {
  method: 'GET',
});

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

### Python

```python
import requests

response = requests.get('http://localhost:8000/api/v1/tenants/string/plan-context')
print(response.text)
```


## Enterprise Signup

`POST /api/v1/tenants/{tenant_id}/enterprise-signup`

Submit an enterprise plan inquiry.
Sends the inquiry to the sales team via notification-service using the enterprise_signup template.
Uses tenant admin's name and tenant name as defaults.

Authentication (security requirement alternatives):

```json
[
  {
    "OAuth2PasswordBearer": []
  }
]
```

- OAuth2PasswordBearer: oauth2

Parameters:

- `tenant_id` (path, string, required)
  Type: string

Request body: application/json (required)

Type: object

Schema: [Backend_EnterpriseSignupDto](/api-reference/schemas/backend-enterprisesignupdto-a0b8b97769.md)

- `name` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `email` (required)
  Type: string, email

- `company` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `phone` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `message` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `tenant_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

Responses:

- 200: Successful Response

Content type: application/json

Type: object

Schema: [Backend_UpdateTenantResponseDto](/api-reference/schemas/backend-updatetenantresponsedto-f75aa0d8da.md)

- `message` (required)
  Type: string

- 422: Validation Error

Content type: application/json

Type: object

Schema: [Backend_HTTPValidationError](/api-reference/schemas/backend-httpvalidationerror-b82f7839b1.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [Backend_ValidationError](/api-reference/schemas/backend-validationerror-b5b4376c23.md); Type: object

## Examples

### cURL

```bash
curl -X POST 'http://localhost:8000/api/v1/tenants/string/enterprise-signup' \
  -H 'Authorization: Bearer YOUR_TOKEN' \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "name": "string",
  "email": "user@example.com",
  "company": "string",
  "phone": "string",
  "message": "string",
  "tenant_id": "string"
}'
```

### JavaScript

```javascript
const body = `{
  "name": "string",
  "email": "user@example.com",
  "company": "string",
  "phone": "string",
  "message": "string",
  "tenant_id": "string"
}`;

const response = await fetch('http://localhost:8000/api/v1/tenants/string/enterprise-signup', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer YOUR_TOKEN',
    'Content-Type': 'application/json',
  },
  body,
});

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

### Python

```python
import requests

body = '''{
  "name": "string",
  "email": "user@example.com",
  "company": "string",
  "phone": "string",
  "message": "string",
  "tenant_id": "string"
}'''

response = requests.post(
    'http://localhost:8000/api/v1/tenants/string/enterprise-signup',
    data=body.encode('utf-8'),
    headers={
        'Authorization': 'Bearer YOUR_TOKEN',
        'Content-Type': 'application/json',
    },
)
print(response.text)
```


## Cancel Tenant Subscription

`POST /api/v1/tenants/{tenant_id}/cancel-subscription`

Host admin endpoint to cancel a tenant's Stripe subscription.
Downgrades the tenant to Free plan and clears dormant state.

Authentication (security requirement alternatives):

```json
[
  {
    "OAuth2PasswordBearer": []
  }
]
```

- OAuth2PasswordBearer: oauth2

Parameters:

- `tenant_id` (path, string, required)
  Type: string

Responses:

- 200: Successful Response

Content type: application/json

Type: object

Schema: [Backend_UpdateTenantResponseDto](/api-reference/schemas/backend-updatetenantresponsedto-f75aa0d8da.md)

- `message` (required)
  Type: string

- 422: Validation Error

Content type: application/json

Type: object

Schema: [Backend_HTTPValidationError](/api-reference/schemas/backend-httpvalidationerror-b82f7839b1.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [Backend_ValidationError](/api-reference/schemas/backend-validationerror-b5b4376c23.md); Type: object

## Examples

### cURL

```bash
curl -X POST 'http://localhost:8000/api/v1/tenants/string/cancel-subscription' \
  -H 'Authorization: Bearer YOUR_TOKEN'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8000/api/v1/tenants/string/cancel-subscription', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer YOUR_TOKEN',
  },
});

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

### Python

```python
import requests

response = requests.post(
    'http://localhost:8000/api/v1/tenants/string/cancel-subscription',
    headers={
        'Authorization': 'Bearer YOUR_TOKEN',
    },
)
print(response.text)
```


## List Features

`GET /api/v1/features`

List all available features. Requires HOST_MANAGE_TENANTS permission.

Authentication (security requirement alternatives):

```json
[
  {
    "OAuth2PasswordBearer": []
  }
]
```

- OAuth2PasswordBearer: oauth2

Responses:

- 200: Successful Response

Content type: application/json

Type: array

Items:
  Reference: [Backend_Feature](/api-reference/schemas/backend-feature-2027695221.md); Type: string
  
  enum: ["chat","report","analytics","organization","teams","stripe"]

## Examples

### cURL

```bash
curl -X GET 'http://localhost:8000/api/v1/features' \
  -H 'Authorization: Bearer YOUR_TOKEN'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8000/api/v1/features', {
  method: 'GET',
  headers: {
    'Authorization': 'Bearer YOUR_TOKEN',
  },
});

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

### Python

```python
import requests

response = requests.get(
    'http://localhost:8000/api/v1/features',
    headers={
        'Authorization': 'Bearer YOUR_TOKEN',
    },
)
print(response.text)
```


## Get App Configuration

`GET /api/v1/app_configuration`

Authentication (security requirement alternatives):

```json
[
  {
    "OAuth2PasswordBearer": []
  }
]
```

- OAuth2PasswordBearer: oauth2

Responses:

- 200: Successful Response

Content type: application/json

Type: object

Schema: [Backend_AppConfigurationDto](/api-reference/schemas/backend-appconfigurationdto-b43b803f65.md)

- `is_multi_tenant_enabled` (required)
  Type: boolean

- `multi_tenancy_strategy` (required)
  Type: string

- `host_main_domain` (required)
  Type: string

- `is_user_logged_in` (optional)
  Type: unknown
  
  default: false
  
  anyOf:
    Type: boolean
  
    Type: null

- `user_preferences` (optional)
  Type: unknown
  
  anyOf:
    Reference: [Backend_UserPreferenceDto](/api-reference/schemas/backend-userpreferencedto-82d1d1bb6a.md); Type: object
  
    Type: null

- `current_tenant` (optional)
  Type: unknown
  
  anyOf:
    Reference: [Backend_TenantDto](/api-reference/schemas/backend-tenantdto-b9c2bf7a81.md); Type: object
  
    Type: null

- `environment` (required)
  Type: string

- `runtime_security_config` (optional)
  Type: unknown
  
  anyOf:
    Reference: [Backend_RuntimeSecurityConfigConfigDto](/api-reference/schemas/backend-runtimesecurityconfigconfigdto-eb429fabf3.md); Type: object
  
    Type: null

- `tenant_data_governances` (optional)
  Type: unknown
  
  anyOf:
    Type: array
    
    Items:
      Reference: [Backend_TenantDataGovernanceConfigDto](/api-reference/schemas/backend-tenantdatagovernanceconfigdto-014c260309.md); Type: object
  
    Type: null

- `mobile_security_policy` (optional)
  Type: unknown
  
  anyOf:
    Reference: [Backend_DeprecatedMobileSecurityPolicyConfigDto](/api-reference/schemas/backend-deprecatedmobilesecuritypolicyconfigdto-9e2199afb4.md); Type: object
    
    DEPRECATED: For old mobile clients. Remove after migration window.
  
    Type: null

## Examples

### cURL

```bash
curl -X GET 'http://localhost:8000/api/v1/app_configuration' \
  -H 'Authorization: Bearer YOUR_TOKEN'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8000/api/v1/app_configuration', {
  method: 'GET',
  headers: {
    'Authorization': 'Bearer YOUR_TOKEN',
  },
});

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

### Python

```python
import requests

response = requests.get(
    'http://localhost:8000/api/v1/app_configuration',
    headers={
        'Authorization': 'Bearer YOUR_TOKEN',
    },
)
print(response.text)
```


## Login New

`POST /api/v1/account/login/new`

New login endpoint - authenticate and return user info with tenant list.
Does not require tenant selection. User selects tenant in separate step.

Authentication: no security requirement declared for this operation.

Request body: application/x-www-form-urlencoded (required)

Type: object

Schema: [Backend_Body_login_new_api_v1_account_login_new_post](/api-reference/schemas/backend-body-login-new-api-v1-account-login-new-post-7a5f901167.md)

- `grant_type` (optional)
  Type: unknown
  
  anyOf:
    Type: string
    
    pattern: "^password$"
  
    Type: null

- `username` (required)
  Type: string

- `password` (required)
  Type: string, password

- `scope` (optional)
  Type: string
  
  default: ""

- `client_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `client_secret` (optional)
  Type: unknown, password
  
  anyOf:
    Type: string
  
    Type: null

Responses:

- 200: Successful Response

Content type: application/json

Type: object

Response after successful login with tenant selection info

Schema: [Backend_LoginResponseDto](/api-reference/schemas/backend-loginresponsedto-5578e3d759.md)

- `user` (required)
  Reference: [Backend_UserInfoDto](/api-reference/schemas/backend-userinfodto-ff6ae5e858.md); Type: object
  
  User information returned after login

- `tenants` (required)
  Type: array
  
  Items:
    Reference: [Backend_TenantInfoDto](/api-reference/schemas/backend-tenantinfodto-3aa396b19f.md); Type: object
    
    Tenant information for selection

- `requires_tenant_selection` (required)
  Type: boolean

- `is_super_admin` (required)
  Type: boolean

- `message` (optional)
  Type: string
  
  default: "Login successful"

- `token` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `refresh_token` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- 422: Validation Error

Content type: application/json

Type: object

Schema: [Backend_HTTPValidationError](/api-reference/schemas/backend-httpvalidationerror-b82f7839b1.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [Backend_ValidationError](/api-reference/schemas/backend-validationerror-b5b4376c23.md); Type: object

## Examples

### cURL

```bash
curl -X POST 'http://localhost:8000/api/v1/account/login/new' \
  -H 'Content-Type: application/x-www-form-urlencoded' \
  --data-raw 'grant_type=string&username=string&password=%2A%2A%2A%2A%2A%2A%2A%2A&scope=&client_id=string&client_secret=string'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8000/api/v1/account/login/new', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/x-www-form-urlencoded',
  },
  body: 'grant_type=string&username=string&password=%2A%2A%2A%2A%2A%2A%2A%2A&scope=&client_id=string&client_secret=string',
});

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

### Python

```python
import requests

response = requests.post(
    'http://localhost:8000/api/v1/account/login/new',
    data='grant_type=string&username=string&password=%2A%2A%2A%2A%2A%2A%2A%2A&scope=&client_id=string&client_secret=string'.encode('utf-8'),
    headers={
        'Content-Type': 'application/x-www-form-urlencoded',
    },
)
print(response.text)
```


## Login Super Admin

`POST /api/v1/account/login/super-admin`

Super admin login endpoint - authenticate and return tokens directly.
Super admins have system-wide access without tenant selection.

Authentication: no security requirement declared for this operation.

Request body: application/x-www-form-urlencoded (required)

Type: object

Schema: [Backend_Body_login_super_admin_api_v1_account_login_super_admin_post](/api-reference/schemas/backend-body-login-super-admin-api-v1-account-login-super-admin-post-e9417ea90b.md)

- `grant_type` (optional)
  Type: unknown
  
  anyOf:
    Type: string
    
    pattern: "^password$"
  
    Type: null

- `username` (required)
  Type: string

- `password` (required)
  Type: string, password

- `scope` (optional)
  Type: string
  
  default: ""

- `client_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `client_secret` (optional)
  Type: unknown, password
  
  anyOf:
    Type: string
  
    Type: null

Responses:

- 200: Successful Response

Content type: application/json

Type: object

Response after tenant selection with tokens

Schema: [Backend_TenantSelectionResponseDto](/api-reference/schemas/backend-tenantselectionresponsedto-e9c438b891.md)

- `access_token` (required)
  Type: string

- `token_type` (optional)
  Type: string
  
  default: "bearer"

- `expires_in` (required)
  Type: integer

- `refresh_token` (required)
  Type: string

- `refresh_token_expires_in` (required)
  Type: integer

- `user` (required)
  Reference: [Backend_UserInfoDto](/api-reference/schemas/backend-userinfodto-ff6ae5e858.md); Type: object
  
  User information returned after login

- `tenant` (optional)
  Type: unknown
  
  anyOf:
    Reference: [Backend_TenantInfoDto](/api-reference/schemas/backend-tenantinfodto-3aa396b19f.md); Type: object
    
    Tenant information for selection
  
    Type: null

- 422: Validation Error

Content type: application/json

Type: object

Schema: [Backend_HTTPValidationError](/api-reference/schemas/backend-httpvalidationerror-b82f7839b1.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [Backend_ValidationError](/api-reference/schemas/backend-validationerror-b5b4376c23.md); Type: object

## Examples

### cURL

```bash
curl -X POST 'http://localhost:8000/api/v1/account/login/super-admin' \
  -H 'Content-Type: application/x-www-form-urlencoded' \
  --data-raw 'grant_type=string&username=string&password=%2A%2A%2A%2A%2A%2A%2A%2A&scope=&client_id=string&client_secret=string'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8000/api/v1/account/login/super-admin', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/x-www-form-urlencoded',
  },
  body: 'grant_type=string&username=string&password=%2A%2A%2A%2A%2A%2A%2A%2A&scope=&client_id=string&client_secret=string',
});

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

### Python

```python
import requests

response = requests.post(
    'http://localhost:8000/api/v1/account/login/super-admin',
    data='grant_type=string&username=string&password=%2A%2A%2A%2A%2A%2A%2A%2A&scope=&client_id=string&client_secret=string'.encode('utf-8'),
    headers={
        'Content-Type': 'application/x-www-form-urlencoded',
    },
)
print(response.text)
```


## Login Host Admin

`POST /api/v1/account/login/host-admin`

Host admin login endpoint - for users without a specific tenant (host-level access).
Returns tokens for users who have access to the host system but no tenant.

Authentication: no security requirement declared for this operation.

Request body: application/x-www-form-urlencoded (required)

Type: object

Schema: [Backend_Body_login_host_admin_api_v1_account_login_host_admin_post](/api-reference/schemas/backend-body-login-host-admin-api-v1-account-login-host-admin-post-63044dcdec.md)

- `grant_type` (optional)
  Type: unknown
  
  anyOf:
    Type: string
    
    pattern: "^password$"
  
    Type: null

- `username` (required)
  Type: string

- `password` (required)
  Type: string, password

- `scope` (optional)
  Type: string
  
  default: ""

- `client_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `client_secret` (optional)
  Type: unknown, password
  
  anyOf:
    Type: string
  
    Type: null

Responses:

- 200: Successful Response

Content type: application/json

Type: object

Response after tenant selection with tokens

Schema: [Backend_TenantSelectionResponseDto](/api-reference/schemas/backend-tenantselectionresponsedto-e9c438b891.md)

- `access_token` (required)
  Type: string

- `token_type` (optional)
  Type: string
  
  default: "bearer"

- `expires_in` (required)
  Type: integer

- `refresh_token` (required)
  Type: string

- `refresh_token_expires_in` (required)
  Type: integer

- `user` (required)
  Reference: [Backend_UserInfoDto](/api-reference/schemas/backend-userinfodto-ff6ae5e858.md); Type: object
  
  User information returned after login

- `tenant` (optional)
  Type: unknown
  
  anyOf:
    Reference: [Backend_TenantInfoDto](/api-reference/schemas/backend-tenantinfodto-3aa396b19f.md); Type: object
    
    Tenant information for selection
  
    Type: null

- 422: Validation Error

Content type: application/json

Type: object

Schema: [Backend_HTTPValidationError](/api-reference/schemas/backend-httpvalidationerror-b82f7839b1.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [Backend_ValidationError](/api-reference/schemas/backend-validationerror-b5b4376c23.md); Type: object

## Examples

### cURL

```bash
curl -X POST 'http://localhost:8000/api/v1/account/login/host-admin' \
  -H 'Content-Type: application/x-www-form-urlencoded' \
  --data-raw 'grant_type=string&username=string&password=%2A%2A%2A%2A%2A%2A%2A%2A&scope=&client_id=string&client_secret=string'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8000/api/v1/account/login/host-admin', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/x-www-form-urlencoded',
  },
  body: 'grant_type=string&username=string&password=%2A%2A%2A%2A%2A%2A%2A%2A&scope=&client_id=string&client_secret=string',
});

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

### Python

```python
import requests

response = requests.post(
    'http://localhost:8000/api/v1/account/login/host-admin',
    data='grant_type=string&username=string&password=%2A%2A%2A%2A%2A%2A%2A%2A&scope=&client_id=string&client_secret=string'.encode('utf-8'),
    headers={
        'Content-Type': 'application/x-www-form-urlencoded',
    },
)
print(response.text)
```


## Select Tenant

`POST /api/v1/account/select-tenant`

After login, select a tenant and get access tokens.
Super admins skip tenant selection.

Authentication (security requirement alternatives):

```json
[
  {
    "OAuth2PasswordBearer": []
  }
]
```

- OAuth2PasswordBearer: oauth2

Request body: application/json (required)

Type: object

Request to select a tenant and get tokens

Schema: [Backend_TenantSelectionRequestDto](/api-reference/schemas/backend-tenantselectionrequestdto-36226bd840.md)

- `tenant_id` (required)
  Type: string

Responses:

- 200: Successful Response

Content type: application/json

Type: object

Response after tenant selection with tokens

Schema: [Backend_TenantSelectionResponseDto](/api-reference/schemas/backend-tenantselectionresponsedto-e9c438b891.md)

- `access_token` (required)
  Type: string

- `token_type` (optional)
  Type: string
  
  default: "bearer"

- `expires_in` (required)
  Type: integer

- `refresh_token` (required)
  Type: string

- `refresh_token_expires_in` (required)
  Type: integer

- `user` (required)
  Reference: [Backend_UserInfoDto](/api-reference/schemas/backend-userinfodto-ff6ae5e858.md); Type: object
  
  User information returned after login

- `tenant` (optional)
  Type: unknown
  
  anyOf:
    Reference: [Backend_TenantInfoDto](/api-reference/schemas/backend-tenantinfodto-3aa396b19f.md); Type: object
    
    Tenant information for selection
  
    Type: null

- 422: Validation Error

Content type: application/json

Type: object

Schema: [Backend_HTTPValidationError](/api-reference/schemas/backend-httpvalidationerror-b82f7839b1.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [Backend_ValidationError](/api-reference/schemas/backend-validationerror-b5b4376c23.md); Type: object

## Examples

### cURL

```bash
curl -X POST 'http://localhost:8000/api/v1/account/select-tenant' \
  -H 'Authorization: Bearer YOUR_TOKEN' \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "tenant_id": "string"
}'
```

### JavaScript

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

const response = await fetch('http://localhost:8000/api/v1/account/select-tenant', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer YOUR_TOKEN',
    'Content-Type': 'application/json',
  },
  body,
});

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

### Python

```python
import requests

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

response = requests.post(
    'http://localhost:8000/api/v1/account/select-tenant',
    data=body.encode('utf-8'),
    headers={
        'Authorization': 'Bearer YOUR_TOKEN',
        'Content-Type': 'application/json',
    },
)
print(response.text)
```


## Switch Tenant

`POST /api/v1/account/switch-tenant`

Switch the user's active tenant mid-session.
Requires a valid session token (not a pre-auth token).
Issues entirely new access + refresh tokens scoped to the target tenant.
The previous tenant_id comes from the current JWT's tenant_id claim.

Authentication (security requirement alternatives):

```json
[
  {
    "OAuth2PasswordBearer": []
  }
]
```

- OAuth2PasswordBearer: oauth2

Request body: application/json (required)

Type: object

Request to switch active tenant

Schema: [Backend_SwitchTenantRequestDto](/api-reference/schemas/backend-switchtenantrequestdto-109a073cee.md)

- `tenant_id` (required)
  Type: string

Responses:

- 200: Successful Response

Content type: application/json

Type: object

Response after switching tenant with new tokens and context

Schema: [Backend_SwitchTenantResponseDto](/api-reference/schemas/backend-switchtenantresponsedto-557e91b7a6.md)

- `access_token` (required)
  Type: string

- `token_type` (optional)
  Type: string
  
  default: "bearer"

- `expires_in` (required)
  Type: integer

- `refresh_token` (required)
  Type: string

- `refresh_token_expires_in` (required)
  Type: integer

- `user` (required)
  Reference: [Backend_UserInfoDto](/api-reference/schemas/backend-userinfodto-ff6ae5e858.md); Type: object
  
  User information returned after login

- `tenant` (required)
  Reference: [Backend_TenantInfoDto](/api-reference/schemas/backend-tenantinfodto-3aa396b19f.md); Type: object
  
  Tenant information for selection

- `previous_tenant_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `message` (optional)
  Type: string
  
  default: "Tenant switched successfully"

- 422: Validation Error

Content type: application/json

Type: object

Schema: [Backend_HTTPValidationError](/api-reference/schemas/backend-httpvalidationerror-b82f7839b1.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [Backend_ValidationError](/api-reference/schemas/backend-validationerror-b5b4376c23.md); Type: object

## Examples

### cURL

```bash
curl -X POST 'http://localhost:8000/api/v1/account/switch-tenant' \
  -H 'Authorization: Bearer YOUR_TOKEN' \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "tenant_id": "string"
}'
```

### JavaScript

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

const response = await fetch('http://localhost:8000/api/v1/account/switch-tenant', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer YOUR_TOKEN',
    'Content-Type': 'application/json',
  },
  body,
});

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

### Python

```python
import requests

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

response = requests.post(
    'http://localhost:8000/api/v1/account/switch-tenant',
    data=body.encode('utf-8'),
    headers={
        'Authorization': 'Bearer YOUR_TOKEN',
        'Content-Type': 'application/json',
    },
)
print(response.text)
```


## Login

`POST /api/v1/account/login`

Authentication: no security requirement declared for this operation.

Request body: application/x-www-form-urlencoded (required)

Type: object

Schema: [Backend_Body_login_api_v1_account_login_post](/api-reference/schemas/backend-body-login-api-v1-account-login-post-418fb31a87.md)

- `grant_type` (optional)
  Type: unknown
  
  anyOf:
    Type: string
    
    pattern: "^password$"
  
    Type: null

- `username` (required)
  Type: string

- `password` (required)
  Type: string, password

- `scope` (optional)
  Type: string
  
  default: ""

- `client_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `client_secret` (optional)
  Type: unknown, password
  
  anyOf:
    Type: string
  
    Type: null

Responses:

- 200: Successful Response

Content type: application/json

Type: object

Schema: [Backend_TokenSetDto](/api-reference/schemas/backend-tokensetdto-c03c3c3d30.md)

- `refresh_token` (required)
  Type: string

- `refresh_token_expires_in` (required)
  Type: integer

- `access_token` (required)
  Type: string

- `token_type` (required)
  Type: string

- `expires_in` (required)
  Type: integer

- 422: Validation Error

Content type: application/json

Type: object

Schema: [Backend_HTTPValidationError](/api-reference/schemas/backend-httpvalidationerror-b82f7839b1.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [Backend_ValidationError](/api-reference/schemas/backend-validationerror-b5b4376c23.md); Type: object

## Examples

### cURL

```bash
curl -X POST 'http://localhost:8000/api/v1/account/login' \
  -H 'Content-Type: application/x-www-form-urlencoded' \
  --data-raw 'grant_type=string&username=string&password=%2A%2A%2A%2A%2A%2A%2A%2A&scope=&client_id=string&client_secret=string'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8000/api/v1/account/login', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/x-www-form-urlencoded',
  },
  body: 'grant_type=string&username=string&password=%2A%2A%2A%2A%2A%2A%2A%2A&scope=&client_id=string&client_secret=string',
});

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

### Python

```python
import requests

response = requests.post(
    'http://localhost:8000/api/v1/account/login',
    data='grant_type=string&username=string&password=%2A%2A%2A%2A%2A%2A%2A%2A&scope=&client_id=string&client_secret=string'.encode('utf-8'),
    headers={
        'Content-Type': 'application/x-www-form-urlencoded',
    },
)
print(response.text)
```


## Refresh Token

`POST /api/v1/account/refresh`

Authentication: no security requirement declared for this operation.

Parameters:

- `refresh_token` (cookie, unknown, optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

Responses:

- 200: Successful Response

Content type: application/json

Type: object

Schema: [Backend_TokenSetDto](/api-reference/schemas/backend-tokensetdto-c03c3c3d30.md)

- `refresh_token` (required)
  Type: string

- `refresh_token_expires_in` (required)
  Type: integer

- `access_token` (required)
  Type: string

- `token_type` (required)
  Type: string

- `expires_in` (required)
  Type: integer

- 422: Validation Error

Content type: application/json

Type: object

Schema: [Backend_HTTPValidationError](/api-reference/schemas/backend-httpvalidationerror-b82f7839b1.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [Backend_ValidationError](/api-reference/schemas/backend-validationerror-b5b4376c23.md); Type: object

## Examples

### cURL

```bash
curl -X POST 'http://localhost:8000/api/v1/account/refresh'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8000/api/v1/account/refresh', {
  method: 'POST',
});

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

### Python

```python
import requests

response = requests.post('http://localhost:8000/api/v1/account/refresh')
print(response.text)
```


## Logout

`GET /api/v1/account/logout`

Authentication (security requirement alternatives):

```json
[
  {
    "OAuth2PasswordBearer": []
  }
]
```

- OAuth2PasswordBearer: oauth2

Responses:

- 200: Successful Response

Content type: application/json

Type: unknown

## Examples

### cURL

```bash
curl -X GET 'http://localhost:8000/api/v1/account/logout' \
  -H 'Authorization: Bearer YOUR_TOKEN'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8000/api/v1/account/logout', {
  method: 'GET',
  headers: {
    'Authorization': 'Bearer YOUR_TOKEN',
  },
});

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

### Python

```python
import requests

response = requests.get(
    'http://localhost:8000/api/v1/account/logout',
    headers={
        'Authorization': 'Bearer YOUR_TOKEN',
    },
)
print(response.text)
```


## Logout

`POST /api/v1/account/logout`

Authentication (security requirement alternatives):

```json
[
  {
    "OAuth2PasswordBearer": []
  }
]
```

- OAuth2PasswordBearer: oauth2

Responses:

- 200: Successful Response

Content type: application/json

Type: unknown

## Examples

### cURL

```bash
curl -X POST 'http://localhost:8000/api/v1/account/logout' \
  -H 'Authorization: Bearer YOUR_TOKEN'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8000/api/v1/account/logout', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer YOUR_TOKEN',
  },
});

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

### Python

```python
import requests

response = requests.post(
    'http://localhost:8000/api/v1/account/logout',
    headers={
        'Authorization': 'Bearer YOUR_TOKEN',
    },
)
print(response.text)
```


## Register

`POST /api/v1/account/register`

Authentication: no security requirement declared for this operation.

Request body: application/json (required)

Type: object

Schema: [Backend_CreateUserDto](/api-reference/schemas/backend-createuserdto-b424e7defc.md)

- `first_name` (required)
  Type: string

- `last_name` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `email` (required)
  Type: string, email

- `gender` (optional)
  Type: unknown
  
  default: "prefer_not_to_say"
  
  anyOf:
    Reference: [Backend_Gender](/api-reference/schemas/backend-gender-58aaeec09d.md); Type: string
    
    enum: ["male","female","other","prefer_not_to_say"]
  
    Type: null

- `tenant_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `role_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `password` (required)
  Type: string

- `sub_domain` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `agreed_to_terms` (optional)
  Type: boolean
  
  default: true

Responses:

- 201: Successful Response

Content type: application/json

Type: unknown

- 422: Validation Error

Content type: application/json

Type: object

Schema: [Backend_HTTPValidationError](/api-reference/schemas/backend-httpvalidationerror-b82f7839b1.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [Backend_ValidationError](/api-reference/schemas/backend-validationerror-b5b4376c23.md); Type: object

## Examples

### cURL

```bash
curl -X POST 'http://localhost:8000/api/v1/account/register' \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "first_name": "string",
  "last_name": "string",
  "email": "user@example.com",
  "gender": "prefer_not_to_say",
  "tenant_id": "string",
  "role_id": "string",
  "password": "string",
  "sub_domain": "string",
  "agreed_to_terms": true
}'
```

### JavaScript

```javascript
const body = `{
  "first_name": "string",
  "last_name": "string",
  "email": "user@example.com",
  "gender": "prefer_not_to_say",
  "tenant_id": "string",
  "role_id": "string",
  "password": "string",
  "sub_domain": "string",
  "agreed_to_terms": true
}`;

const response = await fetch('http://localhost:8000/api/v1/account/register', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
  },
  body,
});

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

### Python

```python
import requests

body = '''{
  "first_name": "string",
  "last_name": "string",
  "email": "user@example.com",
  "gender": "prefer_not_to_say",
  "tenant_id": "string",
  "role_id": "string",
  "password": "string",
  "sub_domain": "string",
  "agreed_to_terms": true
}'''

response = requests.post(
    'http://localhost:8000/api/v1/account/register',
    data=body.encode('utf-8'),
    headers={
        'Content-Type': 'application/json',
    },
)
print(response.text)
```


## Read Users Me

`GET /api/v1/account/me`

Authentication (security requirement alternatives):

```json
[
  {
    "OAuth2PasswordBearer": []
  }
]
```

- OAuth2PasswordBearer: oauth2

Responses:

- 200: Successful Response

Content type: application/json

Type: object

Schema: [Backend_MeResponseDto](/api-reference/schemas/backend-meresponsedto-007f2a14fa.md)

- `id` (required)
  Type: string

- `first_name` (required)
  Type: string

- `last_name` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `email` (required)
  Type: string, email

- `gender` (required)
  Reference: [Backend_Gender](/api-reference/schemas/backend-gender-58aaeec09d.md); Type: string
  
  enum: ["male","female","other","prefer_not_to_say"]

- `role_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `role_name` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `is_active` (required)
  Type: boolean

- `member_active` (optional)
  Type: boolean
  
  default: true

- `activated_at` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `image_url` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `user_code` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `created_at` (required)
  Type: string

- `updated_at` (required)
  Type: string

- `tenant_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `permissions` (optional)
  Type: unknown
  
  anyOf:
    Type: array
    
    Items:
      Type: string
  
    Type: null

- `agreed_to_terms` (optional)
  Type: boolean
  
  default: false

- `role` (required)
  Reference: [Backend_RoleDto](/api-reference/schemas/backend-roledto-67a8c19f32.md); Type: object

- `subscription` (required)
  Type: unknown
  
  anyOf:
    Reference: [Backend_SubscriptionPlanDto](/api-reference/schemas/backend-subscriptionplandto-3536ed2a97.md); Type: object
  
    Type: null

## Examples

### cURL

```bash
curl -X GET 'http://localhost:8000/api/v1/account/me' \
  -H 'Authorization: Bearer YOUR_TOKEN'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8000/api/v1/account/me', {
  method: 'GET',
  headers: {
    'Authorization': 'Bearer YOUR_TOKEN',
  },
});

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

### Python

```python
import requests

response = requests.get(
    'http://localhost:8000/api/v1/account/me',
    headers={
        'Authorization': 'Bearer YOUR_TOKEN',
    },
)
print(response.text)
```


## Password Reset Request

`POST /api/v1/account/password_reset_request`

Authentication: no security requirement declared for this operation.

Request body: application/json (required)

Type: object

Schema: [Backend_PasswordResetRequestDto](/api-reference/schemas/backend-passwordresetrequestdto-6feb304a01.md)

- `email` (required)
  Type: string, email

Responses:

- 200: Successful Response

Content type: application/json

Type: object

Schema: [Backend_PasswordResetResponseDto](/api-reference/schemas/backend-passwordresetresponsedto-6dd4522789.md)

- `message` (required)
  Type: string

- 422: Validation Error

Content type: application/json

Type: object

Schema: [Backend_HTTPValidationError](/api-reference/schemas/backend-httpvalidationerror-b82f7839b1.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [Backend_ValidationError](/api-reference/schemas/backend-validationerror-b5b4376c23.md); Type: object

## Examples

### cURL

```bash
curl -X POST 'http://localhost:8000/api/v1/account/password_reset_request' \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "email": "user@example.com"
}'
```

### JavaScript

```javascript
const body = `{
  "email": "user@example.com"
}`;

const response = await fetch('http://localhost:8000/api/v1/account/password_reset_request', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
  },
  body,
});

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

### Python

```python
import requests

body = '''{
  "email": "user@example.com"
}'''

response = requests.post(
    'http://localhost:8000/api/v1/account/password_reset_request',
    data=body.encode('utf-8'),
    headers={
        'Content-Type': 'application/json',
    },
)
print(response.text)
```


## Password Reset Confirm

`POST /api/v1/account/password_reset_confirmation`

Authentication: no security requirement declared for this operation.

Parameters:

- `token` (query, string, required) - The password reset token
  Type: string
  
  The password reset token

- `user_id` (query, string, required) - The user ID associated with the token
  Type: string
  
  The user ID associated with the token

- `tenant_id` (query, unknown, optional) - The tenant ID associated with the user, if applicable
  Type: unknown
  
  The tenant ID associated with the user, if applicable
  
  anyOf:
    Type: string
  
    Type: null

Request body: application/json (required)

Type: object

Schema: [Backend_PasswordResetConfirmRequestDto](/api-reference/schemas/backend-passwordresetconfirmrequestdto-be829b2357.md)

- `new_password` (required)
  Type: string

Responses:

- 200: Successful Response

Content type: application/json

Type: object

Schema: [Backend_PasswordResetResponseDto](/api-reference/schemas/backend-passwordresetresponsedto-6dd4522789.md)

- `message` (required)
  Type: string

- 422: Validation Error

Content type: application/json

Type: object

Schema: [Backend_HTTPValidationError](/api-reference/schemas/backend-httpvalidationerror-b82f7839b1.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [Backend_ValidationError](/api-reference/schemas/backend-validationerror-b5b4376c23.md); Type: object

## Examples

### cURL

```bash
curl -X POST 'http://localhost:8000/api/v1/account/password_reset_confirmation?token=string&user_id=string' \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "new_password": "string"
}'
```

### JavaScript

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

const response = await fetch('http://localhost:8000/api/v1/account/password_reset_confirmation?token=string&user_id=string', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
  },
  body,
});

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

### Python

```python
import requests

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

response = requests.post(
    'http://localhost:8000/api/v1/account/password_reset_confirmation?token=string&user_id=string',
    data=body.encode('utf-8'),
    headers={
        'Content-Type': 'application/json',
    },
)
print(response.text)
```


## Resend Activation Email

`POST /api/v1/account/resend_activation_email`

Authentication (security requirement alternatives):

```json
[
  {
    "OAuth2PasswordBearer": []
  }
]
```

- OAuth2PasswordBearer: oauth2

Request body: application/json (required)

Type: object

Schema: [Backend_UserResendActivationEmailRequestDto](/api-reference/schemas/backend-userresendactivationemailrequestdto-c1e2c2a500.md)

- `email` (required)
  Type: string, email

- `id` (required)
  Type: string

- `first_name` (required)
  Type: string

- `tenant_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

Responses:

- 202: Successful Response

Content type: application/json

Type: unknown

- 422: Validation Error

Content type: application/json

Type: object

Schema: [Backend_HTTPValidationError](/api-reference/schemas/backend-httpvalidationerror-b82f7839b1.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [Backend_ValidationError](/api-reference/schemas/backend-validationerror-b5b4376c23.md); Type: object

## Examples

### cURL

```bash
curl -X POST 'http://localhost:8000/api/v1/account/resend_activation_email' \
  -H 'Authorization: Bearer YOUR_TOKEN' \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "email": "user@example.com",
  "id": "string",
  "first_name": "string",
  "tenant_id": "string"
}'
```

### JavaScript

```javascript
const body = `{
  "email": "user@example.com",
  "id": "string",
  "first_name": "string",
  "tenant_id": "string"
}`;

const response = await fetch('http://localhost:8000/api/v1/account/resend_activation_email', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer YOUR_TOKEN',
    'Content-Type': 'application/json',
  },
  body,
});

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

### Python

```python
import requests

body = '''{
  "email": "user@example.com",
  "id": "string",
  "first_name": "string",
  "tenant_id": "string"
}'''

response = requests.post(
    'http://localhost:8000/api/v1/account/resend_activation_email',
    data=body.encode('utf-8'),
    headers={
        'Authorization': 'Bearer YOUR_TOKEN',
        'Content-Type': 'application/json',
    },
)
print(response.text)
```


## Resend Activation Email Public

`POST /api/v1/account/resend_activation`

Public resend of the account activation email, used by the account
activation gate page for users whose accounts are inactive.
Sending is refused for already-active accounts (InvalidOperationException).

Authentication: no security requirement declared for this operation.

Request body: application/json (required)

Type: object

Schema: [Backend_UserResendActivationEmailRequestDto](/api-reference/schemas/backend-userresendactivationemailrequestdto-c1e2c2a500.md)

- `email` (required)
  Type: string, email

- `id` (required)
  Type: string

- `first_name` (required)
  Type: string

- `tenant_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

Responses:

- 202: Successful Response

Content type: application/json

Type: unknown

- 422: Validation Error

Content type: application/json

Type: object

Schema: [Backend_HTTPValidationError](/api-reference/schemas/backend-httpvalidationerror-b82f7839b1.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [Backend_ValidationError](/api-reference/schemas/backend-validationerror-b5b4376c23.md); Type: object

## Examples

### cURL

```bash
curl -X POST 'http://localhost:8000/api/v1/account/resend_activation' \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "email": "user@example.com",
  "id": "string",
  "first_name": "string",
  "tenant_id": "string"
}'
```

### JavaScript

```javascript
const body = `{
  "email": "user@example.com",
  "id": "string",
  "first_name": "string",
  "tenant_id": "string"
}`;

const response = await fetch('http://localhost:8000/api/v1/account/resend_activation', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
  },
  body,
});

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

### Python

```python
import requests

body = '''{
  "email": "user@example.com",
  "id": "string",
  "first_name": "string",
  "tenant_id": "string"
}'''

response = requests.post(
    'http://localhost:8000/api/v1/account/resend_activation',
    data=body.encode('utf-8'),
    headers={
        'Content-Type': 'application/json',
    },
)
print(response.text)
```


## Activate Account

`POST /api/v1/account/activate`

Authentication: no security requirement declared for this operation.

Parameters:

- `tenant_id` (query, unknown, optional) - The tenant ID associated with the user, if applicable
  Type: unknown
  
  The tenant ID associated with the user, if applicable
  
  anyOf:
    Type: string
  
    Type: null

Request body: application/json (required)

Type: object

Schema: [Backend_UserActivationRequestDto](/api-reference/schemas/backend-useractivationrequestdto-4493d0eebd.md)

- `token` (required)
  Type: string

Responses:

- 200: Successful Response

Content type: application/json

Type: unknown

- 422: Validation Error

Content type: application/json

Type: object

Schema: [Backend_HTTPValidationError](/api-reference/schemas/backend-httpvalidationerror-b82f7839b1.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [Backend_ValidationError](/api-reference/schemas/backend-validationerror-b5b4376c23.md); Type: object

## Examples

### cURL

```bash
curl -X POST 'http://localhost:8000/api/v1/account/activate' \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "token": "string"
}'
```

### JavaScript

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

const response = await fetch('http://localhost:8000/api/v1/account/activate', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
  },
  body,
});

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

### Python

```python
import requests

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

response = requests.post(
    'http://localhost:8000/api/v1/account/activate',
    data=body.encode('utf-8'),
    headers={
        'Content-Type': 'application/json',
    },
)
print(response.text)
```


## Change Email

`PATCH /api/v1/account/change_email_request`

Authentication (security requirement alternatives):

```json
[
  {
    "OAuth2PasswordBearer": []
  }
]
```

- OAuth2PasswordBearer: oauth2

Request body: application/json (required)

Type: object

Schema: [Backend_ChangeEmailRequestDto](/api-reference/schemas/backend-changeemailrequestdto-6feb699532.md)

- `new_email` (required)
  Type: string, email

Responses:

- 202: Successful Response

Content type: application/json

Type: unknown

- 422: Validation Error

Content type: application/json

Type: object

Schema: [Backend_HTTPValidationError](/api-reference/schemas/backend-httpvalidationerror-b82f7839b1.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [Backend_ValidationError](/api-reference/schemas/backend-validationerror-b5b4376c23.md); Type: object

## Examples

### cURL

```bash
curl -X PATCH 'http://localhost:8000/api/v1/account/change_email_request' \
  -H 'Authorization: Bearer YOUR_TOKEN' \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "new_email": "user@example.com"
}'
```

### JavaScript

```javascript
const body = `{
  "new_email": "user@example.com"
}`;

const response = await fetch('http://localhost:8000/api/v1/account/change_email_request', {
  method: 'PATCH',
  headers: {
    'Authorization': 'Bearer YOUR_TOKEN',
    'Content-Type': 'application/json',
  },
  body,
});

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

### Python

```python
import requests

body = '''{
  "new_email": "user@example.com"
}'''

response = requests.patch(
    'http://localhost:8000/api/v1/account/change_email_request',
    data=body.encode('utf-8'),
    headers={
        'Authorization': 'Bearer YOUR_TOKEN',
        'Content-Type': 'application/json',
    },
)
print(response.text)
```


## Change Email Confirmation

`PATCH /api/v1/account/change_email_confirmation`

Authentication (security requirement alternatives):

```json
[
  {
    "OAuth2PasswordBearer": []
  }
]
```

- OAuth2PasswordBearer: oauth2

Request body: application/json (required)

Type: object

Schema: [Backend_ChangeEmailConfirmRequestDto](/api-reference/schemas/backend-changeemailconfirmrequestdto-2605c9b641.md)

- `token` (required)
  Type: string

Responses:

- 200: Successful Response

Content type: application/json

Type: object

Schema: [Backend_ChangeEmailResponseDto](/api-reference/schemas/backend-changeemailresponsedto-20e1488c62.md)

- `message` (required)
  Type: string

- 422: Validation Error

Content type: application/json

Type: object

Schema: [Backend_HTTPValidationError](/api-reference/schemas/backend-httpvalidationerror-b82f7839b1.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [Backend_ValidationError](/api-reference/schemas/backend-validationerror-b5b4376c23.md); Type: object

## Examples

### cURL

```bash
curl -X PATCH 'http://localhost:8000/api/v1/account/change_email_confirmation' \
  -H 'Authorization: Bearer YOUR_TOKEN' \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "token": "string"
}'
```

### JavaScript

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

const response = await fetch('http://localhost:8000/api/v1/account/change_email_confirmation', {
  method: 'PATCH',
  headers: {
    'Authorization': 'Bearer YOUR_TOKEN',
    'Content-Type': 'application/json',
  },
  body,
});

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

### Python

```python
import requests

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

response = requests.patch(
    'http://localhost:8000/api/v1/account/change_email_confirmation',
    data=body.encode('utf-8'),
    headers={
        'Authorization': 'Bearer YOUR_TOKEN',
        'Content-Type': 'application/json',
    },
)
print(response.text)
```


## Passkey Register Options

`POST /api/v1/account/passkey/register_options`

Authentication: no security requirement declared for this operation.

Request body: application/json (required)

Type: string, email

Responses:

- 200: Successful Response

Content type: application/json

Type: unknown

- 422: Validation Error

Content type: application/json

Type: object

Schema: [Backend_HTTPValidationError](/api-reference/schemas/backend-httpvalidationerror-b82f7839b1.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [Backend_ValidationError](/api-reference/schemas/backend-validationerror-b5b4376c23.md); Type: object

## Examples

### cURL

```bash
curl -X POST 'http://localhost:8000/api/v1/account/passkey/register_options' \
  -H 'Content-Type: application/json' \
  --data-raw '"user@example.com"'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8000/api/v1/account/passkey/register_options', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
  },
  body: '"user@example.com"',
});

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

### Python

```python
import requests

response = requests.post(
    'http://localhost:8000/api/v1/account/passkey/register_options',
    data='"user@example.com"'.encode('utf-8'),
    headers={
        'Content-Type': 'application/json',
    },
)
print(response.text)
```


## Passkey Register

`POST /api/v1/account/passkey/register`

Authentication: no security requirement declared for this operation.

Request body: application/json (required)

Type: object

Schema: [Backend_Body_passkey_register_api_v1_account_passkey_register_post](/api-reference/schemas/backend-body-passkey-register-api-v1-account-passkey-register-post-fac7a81cba.md)

- `email` (required)
  Type: string, email

- `credential` (required)
  Type: object
  
  Additional properties: true

Responses:

- 202: Successful Response

Content type: application/json

Type: unknown

- 422: Validation Error

Content type: application/json

Type: object

Schema: [Backend_HTTPValidationError](/api-reference/schemas/backend-httpvalidationerror-b82f7839b1.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [Backend_ValidationError](/api-reference/schemas/backend-validationerror-b5b4376c23.md); Type: object

## Examples

### cURL

```bash
curl -X POST 'http://localhost:8000/api/v1/account/passkey/register' \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "email": "user@example.com",
  "credential": {}
}'
```

### JavaScript

```javascript
const body = `{
  "email": "user@example.com",
  "credential": {}
}`;

const response = await fetch('http://localhost:8000/api/v1/account/passkey/register', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
  },
  body,
});

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

### Python

```python
import requests

body = '''{
  "email": "user@example.com",
  "credential": {}
}'''

response = requests.post(
    'http://localhost:8000/api/v1/account/passkey/register',
    data=body.encode('utf-8'),
    headers={
        'Content-Type': 'application/json',
    },
)
print(response.text)
```


## Passkey Login Options

`POST /api/v1/account/passkey/login_options`

Authentication: no security requirement declared for this operation.

Request body: application/json (required)

Type: string, email

Responses:

- 200: Successful Response

Content type: application/json

Type: unknown

- 422: Validation Error

Content type: application/json

Type: object

Schema: [Backend_HTTPValidationError](/api-reference/schemas/backend-httpvalidationerror-b82f7839b1.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [Backend_ValidationError](/api-reference/schemas/backend-validationerror-b5b4376c23.md); Type: object

## Examples

### cURL

```bash
curl -X POST 'http://localhost:8000/api/v1/account/passkey/login_options' \
  -H 'Content-Type: application/json' \
  --data-raw '"user@example.com"'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8000/api/v1/account/passkey/login_options', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
  },
  body: '"user@example.com"',
});

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

### Python

```python
import requests

response = requests.post(
    'http://localhost:8000/api/v1/account/passkey/login_options',
    data='"user@example.com"'.encode('utf-8'),
    headers={
        'Content-Type': 'application/json',
    },
)
print(response.text)
```


## Passkey Login

`POST /api/v1/account/passkey/login`

Authentication: no security requirement declared for this operation.

Request body: application/json (required)

Type: object

Schema: [Backend_Body_passkey_login_api_v1_account_passkey_login_post](/api-reference/schemas/backend-body-passkey-login-api-v1-account-passkey-login-post-130d3781b9.md)

- `email` (required)
  Type: string, email

- `credential` (required)
  Type: object
  
  Additional properties: true

Responses:

- 200: Successful Response

Content type: application/json

Type: object

Response after successful login with tenant selection info

Schema: [Backend_LoginResponseDto](/api-reference/schemas/backend-loginresponsedto-5578e3d759.md)

- `user` (required)
  Reference: [Backend_UserInfoDto](/api-reference/schemas/backend-userinfodto-ff6ae5e858.md); Type: object
  
  User information returned after login

- `tenants` (required)
  Type: array
  
  Items:
    Reference: [Backend_TenantInfoDto](/api-reference/schemas/backend-tenantinfodto-3aa396b19f.md); Type: object
    
    Tenant information for selection

- `requires_tenant_selection` (required)
  Type: boolean

- `is_super_admin` (required)
  Type: boolean

- `message` (optional)
  Type: string
  
  default: "Login successful"

- `token` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `refresh_token` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- 422: Validation Error

Content type: application/json

Type: object

Schema: [Backend_HTTPValidationError](/api-reference/schemas/backend-httpvalidationerror-b82f7839b1.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [Backend_ValidationError](/api-reference/schemas/backend-validationerror-b5b4376c23.md); Type: object

## Examples

### cURL

```bash
curl -X POST 'http://localhost:8000/api/v1/account/passkey/login' \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "email": "user@example.com",
  "credential": {}
}'
```

### JavaScript

```javascript
const body = `{
  "email": "user@example.com",
  "credential": {}
}`;

const response = await fetch('http://localhost:8000/api/v1/account/passkey/login', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
  },
  body,
});

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

### Python

```python
import requests

body = '''{
  "email": "user@example.com",
  "credential": {}
}'''

response = requests.post(
    'http://localhost:8000/api/v1/account/passkey/login',
    data=body.encode('utf-8'),
    headers={
        'Content-Type': 'application/json',
    },
)
print(response.text)
```


## Has Passkeys

`POST /api/v1/account/passkey/has_passkeys`

Authentication: no security requirement declared for this operation.

Request body: application/json (required)

Type: string, email

Responses:

- 200: Successful Response

Content type: application/json

Type: object

Schema: [Backend_HasPasskeysDto](/api-reference/schemas/backend-haspasskeysdto-9d9918b377.md)

- `has_passkeys` (required)
  Type: boolean

- 422: Validation Error

Content type: application/json

Type: object

Schema: [Backend_HTTPValidationError](/api-reference/schemas/backend-httpvalidationerror-b82f7839b1.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [Backend_ValidationError](/api-reference/schemas/backend-validationerror-b5b4376c23.md); Type: object

## Examples

### cURL

```bash
curl -X POST 'http://localhost:8000/api/v1/account/passkey/has_passkeys' \
  -H 'Content-Type: application/json' \
  --data-raw '"user@example.com"'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8000/api/v1/account/passkey/has_passkeys', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
  },
  body: '"user@example.com"',
});

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

### Python

```python
import requests

response = requests.post(
    'http://localhost:8000/api/v1/account/passkey/has_passkeys',
    data='"user@example.com"'.encode('utf-8'),
    headers={
        'Content-Type': 'application/json',
    },
)
print(response.text)
```


## Email Magic Link Login

`POST /api/v1/account/email_magic_link_login`

Authentication: no security requirement declared for this operation.

Request body: application/json (required)

Type: string, email

Responses:

- 200: Successful Response

Content type: application/json

Type: object

Schema: [Backend_MagicLinkResponseDto](/api-reference/schemas/backend-magiclinkresponsedto-31a68a6458.md)

- `message` (required)
  Type: string

- 422: Validation Error

Content type: application/json

Type: object

Schema: [Backend_HTTPValidationError](/api-reference/schemas/backend-httpvalidationerror-b82f7839b1.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [Backend_ValidationError](/api-reference/schemas/backend-validationerror-b5b4376c23.md); Type: object

## Examples

### cURL

```bash
curl -X POST 'http://localhost:8000/api/v1/account/email_magic_link_login' \
  -H 'Content-Type: application/json' \
  --data-raw '"user@example.com"'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8000/api/v1/account/email_magic_link_login', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
  },
  body: '"user@example.com"',
});

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

### Python

```python
import requests

response = requests.post(
    'http://localhost:8000/api/v1/account/email_magic_link_login',
    data='"user@example.com"'.encode('utf-8'),
    headers={
        'Content-Type': 'application/json',
    },
)
print(response.text)
```


## Email Magic Link Validate

`GET /api/v1/account/email_magic_link_validate`

Authentication: no security requirement declared for this operation.

Parameters:

- `token` (query, string, required) - The magic link token
  Type: string
  
  The magic link token

- `user_id` (query, string, required) - The user ID associated with the token
  Type: string
  
  The user ID associated with the token

- `tenant_id` (query, unknown, optional) - The tenant ID associated with the user, if applicable
  Type: unknown
  
  The tenant ID associated with the user, if applicable
  
  anyOf:
    Type: string
  
    Type: null

Responses:

- 200: Successful Response

Content type: application/json

Type: object

Response after successful login with tenant selection info

Schema: [Backend_LoginResponseDto](/api-reference/schemas/backend-loginresponsedto-5578e3d759.md)

- `user` (required)
  Reference: [Backend_UserInfoDto](/api-reference/schemas/backend-userinfodto-ff6ae5e858.md); Type: object
  
  User information returned after login

- `tenants` (required)
  Type: array
  
  Items:
    Reference: [Backend_TenantInfoDto](/api-reference/schemas/backend-tenantinfodto-3aa396b19f.md); Type: object
    
    Tenant information for selection

- `requires_tenant_selection` (required)
  Type: boolean

- `is_super_admin` (required)
  Type: boolean

- `message` (optional)
  Type: string
  
  default: "Login successful"

- `token` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `refresh_token` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- 422: Validation Error

Content type: application/json

Type: object

Schema: [Backend_HTTPValidationError](/api-reference/schemas/backend-httpvalidationerror-b82f7839b1.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [Backend_ValidationError](/api-reference/schemas/backend-validationerror-b5b4376c23.md); Type: object

## Examples

### cURL

```bash
curl -X GET 'http://localhost:8000/api/v1/account/email_magic_link_validate?token=string&user_id=string'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8000/api/v1/account/email_magic_link_validate?token=string&user_id=string', {
  method: 'GET',
});

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

### Python

```python
import requests

response = requests.get('http://localhost:8000/api/v1/account/email_magic_link_validate?token=string&user_id=string')
print(response.text)
```


## Get Registered Passkeys

`GET /api/v1/security/passkeys`

Endpoint to retrieve registered passkeys for the current user.

Authentication (security requirement alternatives):

```json
[
  {
    "OAuth2PasswordBearer": []
  }
]
```

- OAuth2PasswordBearer: oauth2

Responses:

- 200: Successful Response

Content type: application/json

Type: array

Items:
  Reference: [Backend_RegisteredPasskeyCredentialsDto](/api-reference/schemas/backend-registeredpasskeycredentialsdto-97afa0e470.md); Type: object

## Examples

### cURL

```bash
curl -X GET 'http://localhost:8000/api/v1/security/passkeys' \
  -H 'Authorization: Bearer YOUR_TOKEN'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8000/api/v1/security/passkeys', {
  method: 'GET',
  headers: {
    'Authorization': 'Bearer YOUR_TOKEN',
  },
});

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

### Python

```python
import requests

response = requests.get(
    'http://localhost:8000/api/v1/security/passkeys',
    headers={
        'Authorization': 'Bearer YOUR_TOKEN',
    },
)
print(response.text)
```


## Delete Registered Passkey

`DELETE /api/v1/security/passkeys/{credential_id}`

Endpoint to delete a registered passkey for the current user.

Authentication (security requirement alternatives):

```json
[
  {
    "OAuth2PasswordBearer": []
  }
]
```

- OAuth2PasswordBearer: oauth2

Parameters:

- `credential_id` (path, string, required)
  Type: string

Responses:

- 204: Successful Response

- 422: Validation Error

Content type: application/json

Type: object

Schema: [Backend_HTTPValidationError](/api-reference/schemas/backend-httpvalidationerror-b82f7839b1.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [Backend_ValidationError](/api-reference/schemas/backend-validationerror-b5b4376c23.md); Type: object

## Examples

### cURL

```bash
curl -X DELETE 'http://localhost:8000/api/v1/security/passkeys/string' \
  -H 'Authorization: Bearer YOUR_TOKEN'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8000/api/v1/security/passkeys/string', {
  method: 'DELETE',
  headers: {
    'Authorization': 'Bearer YOUR_TOKEN',
  },
});

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

### Python

```python
import requests

response = requests.delete(
    'http://localhost:8000/api/v1/security/passkeys/string',
    headers={
        'Authorization': 'Bearer YOUR_TOKEN',
    },
)
print(response.text)
```


## Get Dashboard Metrics

`GET /api/v1/dashboard`

Authentication (security requirement alternatives):

```json
[
  {
    "OAuth2PasswordBearer": []
  }
]
```

- OAuth2PasswordBearer: oauth2

Parameters:

- `filter` (query, string, optional)
  Type: string
  
  default: "all"
  
  enum: ["today","this_week","last_3_months","all"]

Responses:

- 200: Successful Response

Content type: application/json

Type: object

Schema: [Backend_DashboardMetricsDto](/api-reference/schemas/backend-dashboardmetricsdto-4d17501d37.md)

- `filter` (required)
  Type: string
  
  enum: ["today","this_week","last_3_months","all"]

- `joined_users` (required)
  Type: integer

- `total_users` (required)
  Type: integer

- `timeseries` (required)
  Type: array
  
  Items:
    Reference: [Backend_TimeSeriesDto](/api-reference/schemas/backend-timeseriesdto-59f782b33b.md); Type: object

- 422: Validation Error

Content type: application/json

Type: object

Schema: [Backend_HTTPValidationError](/api-reference/schemas/backend-httpvalidationerror-b82f7839b1.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [Backend_ValidationError](/api-reference/schemas/backend-validationerror-b5b4376c23.md); Type: object

## Examples

### cURL

```bash
curl -X GET 'http://localhost:8000/api/v1/dashboard?filter=all' \
  -H 'Authorization: Bearer YOUR_TOKEN'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8000/api/v1/dashboard?filter=all', {
  method: 'GET',
  headers: {
    'Authorization': 'Bearer YOUR_TOKEN',
  },
});

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

### Python

```python
import requests

response = requests.get(
    'http://localhost:8000/api/v1/dashboard?filter=all',
    headers={
        'Authorization': 'Bearer YOUR_TOKEN',
    },
)
print(response.text)
```


## Get Superadmin Dashboard

`GET /api/v1/superadmin/dashboard`

Get superadmin dashboard with platform-wide metrics.

Authentication (security requirement alternatives):

```json
[
  {
    "OAuth2PasswordBearer": []
  }
]
```

- OAuth2PasswordBearer: oauth2

Responses:

- 200: Successful Response

Content type: application/json

Type: object

Schema: [Backend_SuperadminDashboardDto](/api-reference/schemas/backend-superadmindashboarddto-2f95ba6abf.md)

- `tenants` (required)
  Reference: [Backend_TenantMetricsDto](/api-reference/schemas/backend-tenantmetricsdto-ad649af931.md); Type: object

- `submissions` (required)
  Reference: [Backend_SubmissionMetricsDto](/api-reference/schemas/backend-submissionmetricsdto-53063ef6d6.md); Type: object

- `users` (required)
  Reference: [Backend_UserMetricsDto](/api-reference/schemas/backend-usermetricsdto-a515a0d4e1.md); Type: object

- `subscriptions` (required)
  Reference: [Backend_SubscriptionMetricsDto](/api-reference/schemas/backend-subscriptionmetricsdto-b8ff6de0f8.md); Type: object

- `infrastructure` (required)
  Reference: [Backend_InfrastructureMetricsDto](/api-reference/schemas/backend-infrastructuremetricsdto-68d176034f.md); Type: object

- `incidents` (required)
  Type: array
  
  Items:
    Reference: [Backend_IncidentDto](/api-reference/schemas/backend-incidentdto-c1705fbacc.md); Type: object

- `platform_health` (required)
  Reference: [Backend_PlatformHealthDto](/api-reference/schemas/backend-platformhealthdto-d90af6144e.md); Type: object

- `submissions_trend` (required)
  Type: array
  
  Items:
    Reference: [Backend_TimeSeriesPointDto](/api-reference/schemas/backend-timeseriespointdto-f9a436c50d.md); Type: object

- `tenant_growth_trend` (required)
  Type: array
  
  Items:
    Reference: [Backend_TimeSeriesPointDto](/api-reference/schemas/backend-timeseriespointdto-f9a436c50d.md); Type: object

- `recent_tenant_activity` (required)
  Type: array
  
  Items:
    Reference: [Backend_TenantActivityDto](/api-reference/schemas/backend-tenantactivitydto-7dcc16ba06.md); Type: object

## Examples

### cURL

```bash
curl -X GET 'http://localhost:8000/api/v1/superadmin/dashboard' \
  -H 'Authorization: Bearer YOUR_TOKEN'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8000/api/v1/superadmin/dashboard', {
  method: 'GET',
  headers: {
    'Authorization': 'Bearer YOUR_TOKEN',
  },
});

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

### Python

```python
import requests

response = requests.get(
    'http://localhost:8000/api/v1/superadmin/dashboard',
    headers={
        'Authorization': 'Bearer YOUR_TOKEN',
    },
)
print(response.text)
```


## List Users

`GET /api/v1/users`

Authentication (security requirement alternatives):

```json
[
  {
    "OAuth2PasswordBearer": []
  }
]
```

- OAuth2PasswordBearer: oauth2

Parameters:

- `skip` (query, integer, optional)
  Type: integer
  
  default: 0

- `limit` (query, integer, optional)
  Type: integer
  
  default: 10

- `search` (query, unknown, optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

Responses:

- 200: Successful Response

Content type: application/json

Type: object

Schema: [Backend_UserListDto](/api-reference/schemas/backend-userlistdto-f264831fe0.md)

- `items` (required)
  Type: array
  
  Items:
    Reference: [Backend_UserDto](/api-reference/schemas/backend-userdto-dff074e6e0.md); Type: object

- `skip` (required)
  Type: integer

- `limit` (required)
  Type: integer

- `total` (required)
  Type: integer

- `has_previous` (required)
  Type: boolean

- `has_next` (required)
  Type: boolean

- 422: Validation Error

Content type: application/json

Type: object

Schema: [Backend_HTTPValidationError](/api-reference/schemas/backend-httpvalidationerror-b82f7839b1.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [Backend_ValidationError](/api-reference/schemas/backend-validationerror-b5b4376c23.md); Type: object

## Examples

### cURL

```bash
curl -X GET 'http://localhost:8000/api/v1/users?skip=0&limit=10' \
  -H 'Authorization: Bearer YOUR_TOKEN'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8000/api/v1/users?skip=0&limit=10', {
  method: 'GET',
  headers: {
    'Authorization': 'Bearer YOUR_TOKEN',
  },
});

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

### Python

```python
import requests

response = requests.get(
    'http://localhost:8000/api/v1/users?skip=0&limit=10',
    headers={
        'Authorization': 'Bearer YOUR_TOKEN',
    },
)
print(response.text)
```


## Create User

`POST /api/v1/users`

Authentication (security requirement alternatives):

```json
[
  {
    "OAuth2PasswordBearer": []
  }
]
```

- OAuth2PasswordBearer: oauth2

Request body: application/json (required)

Type: object

Schema: [Backend_CreateUserDto](/api-reference/schemas/backend-createuserdto-b424e7defc.md)

- `first_name` (required)
  Type: string

- `last_name` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `email` (required)
  Type: string, email

- `gender` (optional)
  Type: unknown
  
  default: "prefer_not_to_say"
  
  anyOf:
    Reference: [Backend_Gender](/api-reference/schemas/backend-gender-58aaeec09d.md); Type: string
    
    enum: ["male","female","other","prefer_not_to_say"]
  
    Type: null

- `tenant_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `role_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `password` (required)
  Type: string

- `sub_domain` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `agreed_to_terms` (optional)
  Type: boolean
  
  default: true

Responses:

- 201: Successful Response

Content type: application/json

Type: object

Schema: [Backend_CreateUserResponseDto](/api-reference/schemas/backend-createuserresponsedto-b14d646235.md)

- `id` (required)
  Type: string

- 422: Validation Error

Content type: application/json

Type: object

Schema: [Backend_HTTPValidationError](/api-reference/schemas/backend-httpvalidationerror-b82f7839b1.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [Backend_ValidationError](/api-reference/schemas/backend-validationerror-b5b4376c23.md); Type: object

## Examples

### cURL

```bash
curl -X POST 'http://localhost:8000/api/v1/users' \
  -H 'Authorization: Bearer YOUR_TOKEN' \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "first_name": "string",
  "last_name": "string",
  "email": "user@example.com",
  "gender": "prefer_not_to_say",
  "tenant_id": "string",
  "role_id": "string",
  "password": "string",
  "sub_domain": "string",
  "agreed_to_terms": true
}'
```

### JavaScript

```javascript
const body = `{
  "first_name": "string",
  "last_name": "string",
  "email": "user@example.com",
  "gender": "prefer_not_to_say",
  "tenant_id": "string",
  "role_id": "string",
  "password": "string",
  "sub_domain": "string",
  "agreed_to_terms": true
}`;

const response = await fetch('http://localhost:8000/api/v1/users', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer YOUR_TOKEN',
    'Content-Type': 'application/json',
  },
  body,
});

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

### Python

```python
import requests

body = '''{
  "first_name": "string",
  "last_name": "string",
  "email": "user@example.com",
  "gender": "prefer_not_to_say",
  "tenant_id": "string",
  "role_id": "string",
  "password": "string",
  "sub_domain": "string",
  "agreed_to_terms": true
}'''

response = requests.post(
    'http://localhost:8000/api/v1/users',
    data=body.encode('utf-8'),
    headers={
        'Authorization': 'Bearer YOUR_TOKEN',
        'Content-Type': 'application/json',
    },
)
print(response.text)
```


## Search User By Email

`GET /api/v1/users/search/by-email`

Search for a user by their email address within the current tenant context.
Returns user details if found, useful for workspace member invitations.

Authentication (security requirement alternatives):

```json
[
  {
    "OAuth2PasswordBearer": []
  }
]
```

- OAuth2PasswordBearer: oauth2

Parameters:

- `email` (query, string, required)
  Type: string

Responses:

- 200: Successful Response

Content type: application/json

Type: object

Schema: [Backend_UserDto](/api-reference/schemas/backend-userdto-dff074e6e0.md)

- `id` (required)
  Type: string

- `first_name` (required)
  Type: string

- `last_name` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `email` (required)
  Type: string, email

- `gender` (required)
  Reference: [Backend_Gender](/api-reference/schemas/backend-gender-58aaeec09d.md); Type: string
  
  enum: ["male","female","other","prefer_not_to_say"]

- `role_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `role_name` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `is_active` (required)
  Type: boolean

- `member_active` (optional)
  Type: boolean
  
  default: true

- `activated_at` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `image_url` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `user_code` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `created_at` (required)
  Type: string

- `updated_at` (required)
  Type: string

- `tenant_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `permissions` (optional)
  Type: unknown
  
  anyOf:
    Type: array
    
    Items:
      Type: string
  
    Type: null

- `agreed_to_terms` (optional)
  Type: boolean
  
  default: false

- 422: Validation Error

Content type: application/json

Type: object

Schema: [Backend_HTTPValidationError](/api-reference/schemas/backend-httpvalidationerror-b82f7839b1.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [Backend_ValidationError](/api-reference/schemas/backend-validationerror-b5b4376c23.md); Type: object

## Examples

### cURL

```bash
curl -X GET 'http://localhost:8000/api/v1/users/search/by-email?email=string' \
  -H 'Authorization: Bearer YOUR_TOKEN'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8000/api/v1/users/search/by-email?email=string', {
  method: 'GET',
  headers: {
    'Authorization': 'Bearer YOUR_TOKEN',
  },
});

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

### Python

```python
import requests

response = requests.get(
    'http://localhost:8000/api/v1/users/search/by-email?email=string',
    headers={
        'Authorization': 'Bearer YOUR_TOKEN',
    },
)
print(response.text)
```


## Search Users With Roles

`GET /api/v1/users/search/with-roles`

Search users with role filtering.

Useful for form access management where you need to find Field Supervisors
or Enumerators in the same tenant.

SECURITY: Form Builders and Field Supervisors can only search Field Supervisors and Enumerators.
Admins and Survey Managers can search all users.

- role_ids: Comma-separated list of role UUIDs (e.g., "uuid1,uuid2")
- search: Search by first_name, last_name, email, or user_code

Authentication (security requirement alternatives):

```json
[
  {
    "OAuth2PasswordBearer": []
  }
]
```

- OAuth2PasswordBearer: oauth2

Parameters:

- `skip` (query, integer, optional)
  Type: integer
  
  default: 0
  
  minimum: 0

- `limit` (query, integer, optional)
  Type: integer
  
  default: 20
  
  minimum: 1
  
  maximum: 100

- `role_ids` (query, unknown, optional) - Comma-separated list of role IDs to filter by
  Type: unknown
  
  Comma-separated list of role IDs to filter by
  
  anyOf:
    Type: string
  
    Type: null

- `search` (query, unknown, optional) - Search by name, email, or user_code
  Type: unknown
  
  Search by name, email, or user_code
  
  anyOf:
    Type: string
  
    Type: null

Responses:

- 200: Successful Response

Content type: application/json

Type: object

Schema: [Backend_UserListDto](/api-reference/schemas/backend-userlistdto-f264831fe0.md)

- `items` (required)
  Type: array
  
  Items:
    Reference: [Backend_UserDto](/api-reference/schemas/backend-userdto-dff074e6e0.md); Type: object

- `skip` (required)
  Type: integer

- `limit` (required)
  Type: integer

- `total` (required)
  Type: integer

- `has_previous` (required)
  Type: boolean

- `has_next` (required)
  Type: boolean

- 422: Validation Error

Content type: application/json

Type: object

Schema: [Backend_HTTPValidationError](/api-reference/schemas/backend-httpvalidationerror-b82f7839b1.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [Backend_ValidationError](/api-reference/schemas/backend-validationerror-b5b4376c23.md); Type: object

## Examples

### cURL

```bash
curl -X GET 'http://localhost:8000/api/v1/users/search/with-roles?skip=0&limit=20' \
  -H 'Authorization: Bearer YOUR_TOKEN'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8000/api/v1/users/search/with-roles?skip=0&limit=20', {
  method: 'GET',
  headers: {
    'Authorization': 'Bearer YOUR_TOKEN',
  },
});

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

### Python

```python
import requests

response = requests.get(
    'http://localhost:8000/api/v1/users/search/with-roles?skip=0&limit=20',
    headers={
        'Authorization': 'Bearer YOUR_TOKEN',
    },
)
print(response.text)
```


## Get Users Bulk

`POST /api/v1/users/bulk`

Fetch multiple users by their IDs in bulk, scoped to the current tenant.
Prevents cross-tenant user enumeration.

Authentication (security requirement alternatives):

```json
[
  {
    "OAuth2PasswordBearer": []
  }
]
```

- OAuth2PasswordBearer: oauth2

Request body: application/json (required)

Type: object

Schema: [Backend_BulkUserRequestDto](/api-reference/schemas/backend-bulkuserrequestdto-cc1956263f.md)

- `user_ids` (required)
  Type: array
  
  Items:
    Type: string

Responses:

- 200: Successful Response

Content type: application/json

Type: array

Items:
  Reference: [Backend_UserDto](/api-reference/schemas/backend-userdto-dff074e6e0.md); Type: object

- 422: Validation Error

Content type: application/json

Type: object

Schema: [Backend_HTTPValidationError](/api-reference/schemas/backend-httpvalidationerror-b82f7839b1.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [Backend_ValidationError](/api-reference/schemas/backend-validationerror-b5b4376c23.md); Type: object

## Examples

### cURL

```bash
curl -X POST 'http://localhost:8000/api/v1/users/bulk' \
  -H 'Authorization: Bearer YOUR_TOKEN' \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "user_ids": [
    "string"
  ]
}'
```

### JavaScript

```javascript
const body = `{
  "user_ids": [
    "string"
  ]
}`;

const response = await fetch('http://localhost:8000/api/v1/users/bulk', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer YOUR_TOKEN',
    'Content-Type': 'application/json',
  },
  body,
});

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

### Python

```python
import requests

body = '''{
  "user_ids": [
    "string"
  ]
}'''

response = requests.post(
    'http://localhost:8000/api/v1/users/bulk',
    data=body.encode('utf-8'),
    headers={
        'Authorization': 'Bearer YOUR_TOKEN',
        'Content-Type': 'application/json',
    },
)
print(response.text)
```


## Provision User

`POST /api/v1/users/provision`

Provision a user to the current tenant.

CASE A — New user: Creates the user and adds them to the tenant with the selected role.
CASE B — Existing user: Adds the existing user to the tenant with the selected role.
CASE C — Already a member: Returns a friendly message without creating duplicates.

Role selection is mandatory in all cases.

Authentication (security requirement alternatives):

```json
[
  {
    "OAuth2PasswordBearer": []
  }
]
```

- OAuth2PasswordBearer: oauth2

Request body: application/json (required)

Type: object

DTO for provisioning a user to a tenant (create or invite)

Schema: [Backend_ProvisionUserDto](/api-reference/schemas/backend-provisionuserdto-a7d98511b1.md)

- `email` (required)
  Type: string, email

- `role_id` (required)
  Type: string

- `password` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `first_name` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `last_name` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `gender` (optional)
  Type: unknown
  
  anyOf:
    Reference: [Backend_Gender](/api-reference/schemas/backend-gender-58aaeec09d.md); Type: string
    
    enum: ["male","female","other","prefer_not_to_say"]
  
    Type: null

Responses:

- 201: Successful Response

Content type: application/json

Type: object

Response DTO for user provisioning

Schema: [Backend_ProvisionUserResponseDto](/api-reference/schemas/backend-provisionuserresponsedto-af603590a1.md)

- `id` (required)
  Type: string

- `status` (required)
  Type: string

- `message` (required)
  Type: string

- 422: Validation Error

Content type: application/json

Type: object

Schema: [Backend_HTTPValidationError](/api-reference/schemas/backend-httpvalidationerror-b82f7839b1.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [Backend_ValidationError](/api-reference/schemas/backend-validationerror-b5b4376c23.md); Type: object

## Examples

### cURL

```bash
curl -X POST 'http://localhost:8000/api/v1/users/provision' \
  -H 'Authorization: Bearer YOUR_TOKEN' \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "email": "user@example.com",
  "role_id": "string",
  "password": "string",
  "first_name": "string",
  "last_name": "string",
  "gender": "male"
}'
```

### JavaScript

```javascript
const body = `{
  "email": "user@example.com",
  "role_id": "string",
  "password": "string",
  "first_name": "string",
  "last_name": "string",
  "gender": "male"
}`;

const response = await fetch('http://localhost:8000/api/v1/users/provision', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer YOUR_TOKEN',
    'Content-Type': 'application/json',
  },
  body,
});

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

### Python

```python
import requests

body = '''{
  "email": "user@example.com",
  "role_id": "string",
  "password": "string",
  "first_name": "string",
  "last_name": "string",
  "gender": "male"
}'''

response = requests.post(
    'http://localhost:8000/api/v1/users/provision',
    data=body.encode('utf-8'),
    headers={
        'Authorization': 'Bearer YOUR_TOKEN',
        'Content-Type': 'application/json',
    },
)
print(response.text)
```


## Get Available Roles

`GET /api/v1/users/available-roles`

Authentication (security requirement alternatives):

```json
[
  {
    "OAuth2PasswordBearer": []
  }
]
```

- OAuth2PasswordBearer: oauth2

Responses:

- 200: Successful Response

Content type: application/json

Type: array

Items:
  Type: object
  
  Additional properties: true

## Examples

### cURL

```bash
curl -X GET 'http://localhost:8000/api/v1/users/available-roles' \
  -H 'Authorization: Bearer YOUR_TOKEN'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8000/api/v1/users/available-roles', {
  method: 'GET',
  headers: {
    'Authorization': 'Bearer YOUR_TOKEN',
  },
});

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

### Python

```python
import requests

response = requests.get(
    'http://localhost:8000/api/v1/users/available-roles',
    headers={
        'Authorization': 'Bearer YOUR_TOKEN',
    },
)
print(response.text)
```


## Count Users

`GET /api/v1/users/count`

Count users in the current tenant, optionally filtered by account active
status and/or role name (e.g. "Enumerator"). Super admins count across all
tenants when no role filter is applied.

Authentication (security requirement alternatives):

```json
[
  {
    "OAuth2PasswordBearer": []
  }
]
```

- OAuth2PasswordBearer: oauth2

Parameters:

- `is_active` (query, unknown, optional)
  Type: unknown
  
  anyOf:
    Type: boolean
  
    Type: null

- `role_name` (query, unknown, optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

Responses:

- 200: Successful Response

Content type: application/json

Type: object

Schema: [Backend_UserCountDto](/api-reference/schemas/backend-usercountdto-fcc6c2e8f0.md)

- `total` (required)
  Type: integer

- 422: Validation Error

Content type: application/json

Type: object

Schema: [Backend_HTTPValidationError](/api-reference/schemas/backend-httpvalidationerror-b82f7839b1.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [Backend_ValidationError](/api-reference/schemas/backend-validationerror-b5b4376c23.md); Type: object

## Examples

### cURL

```bash
curl -X GET 'http://localhost:8000/api/v1/users/count' \
  -H 'Authorization: Bearer YOUR_TOKEN'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8000/api/v1/users/count', {
  method: 'GET',
  headers: {
    'Authorization': 'Bearer YOUR_TOKEN',
  },
});

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

### Python

```python
import requests

response = requests.get(
    'http://localhost:8000/api/v1/users/count',
    headers={
        'Authorization': 'Bearer YOUR_TOKEN',
    },
)
print(response.text)
```


## Get User

`GET /api/v1/users/{user_id}`

Get a single user by ID, scoped to the current tenant.
Non-super-admin users can only retrieve users belonging to their active tenant.

Authentication (security requirement alternatives):

```json
[
  {
    "OAuth2PasswordBearer": []
  }
]
```

- OAuth2PasswordBearer: oauth2

Parameters:

- `user_id` (path, string, required)
  Type: string

Responses:

- 200: Successful Response

Content type: application/json

Type: object

Schema: [Backend_UserDto](/api-reference/schemas/backend-userdto-dff074e6e0.md)

- `id` (required)
  Type: string

- `first_name` (required)
  Type: string

- `last_name` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `email` (required)
  Type: string, email

- `gender` (required)
  Reference: [Backend_Gender](/api-reference/schemas/backend-gender-58aaeec09d.md); Type: string
  
  enum: ["male","female","other","prefer_not_to_say"]

- `role_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `role_name` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `is_active` (required)
  Type: boolean

- `member_active` (optional)
  Type: boolean
  
  default: true

- `activated_at` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `image_url` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `user_code` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `created_at` (required)
  Type: string

- `updated_at` (required)
  Type: string

- `tenant_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `permissions` (optional)
  Type: unknown
  
  anyOf:
    Type: array
    
    Items:
      Type: string
  
    Type: null

- `agreed_to_terms` (optional)
  Type: boolean
  
  default: false

- 422: Validation Error

Content type: application/json

Type: object

Schema: [Backend_HTTPValidationError](/api-reference/schemas/backend-httpvalidationerror-b82f7839b1.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [Backend_ValidationError](/api-reference/schemas/backend-validationerror-b5b4376c23.md); Type: object

## Examples

### cURL

```bash
curl -X GET 'http://localhost:8000/api/v1/users/string' \
  -H 'Authorization: Bearer YOUR_TOKEN'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8000/api/v1/users/string', {
  method: 'GET',
  headers: {
    'Authorization': 'Bearer YOUR_TOKEN',
  },
});

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

### Python

```python
import requests

response = requests.get(
    'http://localhost:8000/api/v1/users/string',
    headers={
        'Authorization': 'Bearer YOUR_TOKEN',
    },
)
print(response.text)
```


## Update User

`PUT /api/v1/users/{user_id}`

Authentication (security requirement alternatives):

```json
[
  {
    "OAuth2PasswordBearer": []
  }
]
```

- OAuth2PasswordBearer: oauth2

Parameters:

- `user_id` (path, string, required)
  Type: string

Request body: application/json (required)

Type: object

Schema: [Backend_UpdateUserDto](/api-reference/schemas/backend-updateuserdto-f76ba6d54a.md)

- `first_name` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `last_name` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `email` (optional)
  Type: unknown
  
  anyOf:
    Type: string, email
  
    Type: null

- `gender` (optional)
  Type: unknown
  
  anyOf:
    Reference: [Backend_Gender](/api-reference/schemas/backend-gender-58aaeec09d.md); Type: string
    
    enum: ["male","female","other","prefer_not_to_say"]
  
    Type: null

- `image_url` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `role_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `is_active` (optional)
  Type: unknown
  
  anyOf:
    Type: boolean
  
    Type: null

- `activated_at` (optional)
  Type: unknown
  
  anyOf:
    Type: string, date-time
  
    Type: null

- `tenant_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `password` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

Responses:

- 200: Successful Response

Content type: application/json

Type: object

Schema: [Backend_UserDto](/api-reference/schemas/backend-userdto-dff074e6e0.md)

- `id` (required)
  Type: string

- `first_name` (required)
  Type: string

- `last_name` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `email` (required)
  Type: string, email

- `gender` (required)
  Reference: [Backend_Gender](/api-reference/schemas/backend-gender-58aaeec09d.md); Type: string
  
  enum: ["male","female","other","prefer_not_to_say"]

- `role_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `role_name` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `is_active` (required)
  Type: boolean

- `member_active` (optional)
  Type: boolean
  
  default: true

- `activated_at` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `image_url` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `user_code` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `created_at` (required)
  Type: string

- `updated_at` (required)
  Type: string

- `tenant_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `permissions` (optional)
  Type: unknown
  
  anyOf:
    Type: array
    
    Items:
      Type: string
  
    Type: null

- `agreed_to_terms` (optional)
  Type: boolean
  
  default: false

- 422: Validation Error

Content type: application/json

Type: object

Schema: [Backend_HTTPValidationError](/api-reference/schemas/backend-httpvalidationerror-b82f7839b1.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [Backend_ValidationError](/api-reference/schemas/backend-validationerror-b5b4376c23.md); Type: object

## Examples

### cURL

```bash
curl -X PUT 'http://localhost:8000/api/v1/users/string' \
  -H 'Authorization: Bearer YOUR_TOKEN' \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "first_name": "string",
  "last_name": "string",
  "email": "user@example.com",
  "gender": "male",
  "image_url": "string",
  "role_id": "string",
  "is_active": true,
  "activated_at": "2024-01-15T09:30:00Z",
  "tenant_id": "string",
  "password": "string"
}'
```

### JavaScript

```javascript
const body = `{
  "first_name": "string",
  "last_name": "string",
  "email": "user@example.com",
  "gender": "male",
  "image_url": "string",
  "role_id": "string",
  "is_active": true,
  "activated_at": "2024-01-15T09:30:00Z",
  "tenant_id": "string",
  "password": "string"
}`;

const response = await fetch('http://localhost:8000/api/v1/users/string', {
  method: 'PUT',
  headers: {
    'Authorization': 'Bearer YOUR_TOKEN',
    'Content-Type': 'application/json',
  },
  body,
});

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

### Python

```python
import requests

body = '''{
  "first_name": "string",
  "last_name": "string",
  "email": "user@example.com",
  "gender": "male",
  "image_url": "string",
  "role_id": "string",
  "is_active": true,
  "activated_at": "2024-01-15T09:30:00Z",
  "tenant_id": "string",
  "password": "string"
}'''

response = requests.put(
    'http://localhost:8000/api/v1/users/string',
    data=body.encode('utf-8'),
    headers={
        'Authorization': 'Bearer YOUR_TOKEN',
        'Content-Type': 'application/json',
    },
)
print(response.text)
```


## Delete User

`DELETE /api/v1/users/{user_id}`

Authentication (security requirement alternatives):

```json
[
  {
    "OAuth2PasswordBearer": []
  }
]
```

- OAuth2PasswordBearer: oauth2

Parameters:

- `user_id` (path, string, required)
  Type: string

Responses:

- 202: Successful Response

Content type: application/json

Type: unknown

- 422: Validation Error

Content type: application/json

Type: object

Schema: [Backend_HTTPValidationError](/api-reference/schemas/backend-httpvalidationerror-b82f7839b1.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [Backend_ValidationError](/api-reference/schemas/backend-validationerror-b5b4376c23.md); Type: object

## Examples

### cURL

```bash
curl -X DELETE 'http://localhost:8000/api/v1/users/string' \
  -H 'Authorization: Bearer YOUR_TOKEN'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8000/api/v1/users/string', {
  method: 'DELETE',
  headers: {
    'Authorization': 'Bearer YOUR_TOKEN',
  },
});

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

### Python

```python
import requests

response = requests.delete(
    'http://localhost:8000/api/v1/users/string',
    headers={
        'Authorization': 'Bearer YOUR_TOKEN',
    },
)
print(response.text)
```


## Get Profile Image

`GET /api/v1/users/profile/{image_key}`

Authentication (security requirement alternatives):

```json
[
  {
    "OAuth2PasswordBearer": []
  }
]
```

- OAuth2PasswordBearer: oauth2

Parameters:

- `image_key` (path, string, required)
  Type: string

Responses:

- 200: Successful Response

Content type: application/json

Type: object

Schema: [Backend_UserProfileImageUpdateDto](/api-reference/schemas/backend-userprofileimageupdatedto-3f65b4d22e.md)

- `image_url` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- 422: Validation Error

Content type: application/json

Type: object

Schema: [Backend_HTTPValidationError](/api-reference/schemas/backend-httpvalidationerror-b82f7839b1.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [Backend_ValidationError](/api-reference/schemas/backend-validationerror-b5b4376c23.md); Type: object

## Examples

### cURL

```bash
curl -X GET 'http://localhost:8000/api/v1/users/profile/string' \
  -H 'Authorization: Bearer YOUR_TOKEN'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8000/api/v1/users/profile/string', {
  method: 'GET',
  headers: {
    'Authorization': 'Bearer YOUR_TOKEN',
  },
});

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

### Python

```python
import requests

response = requests.get(
    'http://localhost:8000/api/v1/users/profile/string',
    headers={
        'Authorization': 'Bearer YOUR_TOKEN',
    },
)
print(response.text)
```


## Update User Tenant Access

`PATCH /api/v1/users/{user_id}/tenant-access`

Activate or deactivate a user's membership in the active tenant.

Per-tenant activation: deactivating a membership in one tenant does NOT
affect the user's access or login ability in other tenants, nor does it
disable the global account (users.is_active). The active tenant is
resolved from the X-Tenant-ID header, falling back to the actor's primary
tenant.

Authentication (security requirement alternatives):

```json
[
  {
    "OAuth2PasswordBearer": []
  }
]
```

- OAuth2PasswordBearer: oauth2

Parameters:

- `user_id` (path, string, required)
  Type: string

Request body: application/json (required)

Type: object

DTO for updating a user's per-tenant access (activate/deactivate in the active tenant)

Schema: [Backend_TenantAccessUpdateDto](/api-reference/schemas/backend-tenantaccessupdatedto-3177c8ec59.md)

- `is_active` (required)
  Type: boolean

Responses:

- 200: Successful Response

Content type: application/json

Type: object

Additional properties: true

- 422: Validation Error

Content type: application/json

Type: object

Schema: [Backend_HTTPValidationError](/api-reference/schemas/backend-httpvalidationerror-b82f7839b1.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [Backend_ValidationError](/api-reference/schemas/backend-validationerror-b5b4376c23.md); Type: object

## Examples

### cURL

```bash
curl -X PATCH 'http://localhost:8000/api/v1/users/string/tenant-access' \
  -H 'Authorization: Bearer YOUR_TOKEN' \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "is_active": true
}'
```

### JavaScript

```javascript
const body = `{
  "is_active": true
}`;

const response = await fetch('http://localhost:8000/api/v1/users/string/tenant-access', {
  method: 'PATCH',
  headers: {
    'Authorization': 'Bearer YOUR_TOKEN',
    'Content-Type': 'application/json',
  },
  body,
});

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

### Python

```python
import requests

body = '''{
  "is_active": true
}'''

response = requests.patch(
    'http://localhost:8000/api/v1/users/string/tenant-access',
    data=body.encode('utf-8'),
    headers={
        'Authorization': 'Bearer YOUR_TOKEN',
        'Content-Type': 'application/json',
    },
)
print(response.text)
```


## Update Profile Picture

`PUT /api/v1/users/{user_id}/update_profile_picture`

Authentication (security requirement alternatives):

```json
[
  {
    "OAuth2PasswordBearer": []
  }
]
```

- OAuth2PasswordBearer: oauth2

Parameters:

- `user_id` (path, string, required)
  Type: string

Request body: multipart/form-data (required)

Type: object

Schema: [Backend_Body_update_profile_picture_api_v1_users__user_id__update_profile_picture_put](/api-reference/schemas/backend-body-update-profile-picture-api-v1-users-user-id-update-profile-picture-put-f81a5c112c.md)

- `file` (required)
  Type: string, binary

Responses:

- 202: Successful Response

Content type: application/json

Type: object

Schema: [Backend_UserProfileImageUpdateDto](/api-reference/schemas/backend-userprofileimageupdatedto-3f65b4d22e.md)

- `image_url` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- 422: Validation Error

Content type: application/json

Type: object

Schema: [Backend_HTTPValidationError](/api-reference/schemas/backend-httpvalidationerror-b82f7839b1.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [Backend_ValidationError](/api-reference/schemas/backend-validationerror-b5b4376c23.md); Type: object

## Examples

### cURL

```bash
curl -X PUT 'http://localhost:8000/api/v1/users/string/update_profile_picture' \
  -H 'Authorization: Bearer YOUR_TOKEN'
```

### JavaScript

```javascript
const form = new FormData();
const response = await fetch('http://localhost:8000/api/v1/users/string/update_profile_picture', {
  method: 'PUT',
  headers: {"Authorization":"Bearer YOUR_TOKEN"},
  body: form,
});
console.log(await response.text());
```

### Python

```python
import requests
from contextlib import ExitStack

with ExitStack() as stack:
    files = [
    ]
    response = requests.request('PUT', 'http://localhost:8000/api/v1/users/string/update_profile_picture', headers={"Authorization":"Bearer YOUR_TOKEN"}, files=files)
    print(response.text)
```


## Delete Profile Picture

`DELETE /api/v1/users/{user_id}/delete_profile_picture`

Authentication (security requirement alternatives):

```json
[
  {
    "OAuth2PasswordBearer": []
  }
]
```

- OAuth2PasswordBearer: oauth2

Parameters:

- `user_id` (path, string, required)
  Type: string

Responses:

- 202: Successful Response

Content type: application/json

Type: object

Schema: [Backend_UserProfileImageUpdateDto](/api-reference/schemas/backend-userprofileimageupdatedto-3f65b4d22e.md)

- `image_url` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- 422: Validation Error

Content type: application/json

Type: object

Schema: [Backend_HTTPValidationError](/api-reference/schemas/backend-httpvalidationerror-b82f7839b1.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [Backend_ValidationError](/api-reference/schemas/backend-validationerror-b5b4376c23.md); Type: object

## Examples

### cURL

```bash
curl -X DELETE 'http://localhost:8000/api/v1/users/string/delete_profile_picture' \
  -H 'Authorization: Bearer YOUR_TOKEN'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8000/api/v1/users/string/delete_profile_picture', {
  method: 'DELETE',
  headers: {
    'Authorization': 'Bearer YOUR_TOKEN',
  },
});

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

### Python

```python
import requests

response = requests.delete(
    'http://localhost:8000/api/v1/users/string/delete_profile_picture',
    headers={
        'Authorization': 'Bearer YOUR_TOKEN',
    },
)
print(response.text)
```


## Patch User

`PATCH /api/v1/users/{user_id}/assign_role`

Authentication (security requirement alternatives):

```json
[
  {
    "OAuth2PasswordBearer": []
  }
]
```

- OAuth2PasswordBearer: oauth2

Parameters:

- `user_id` (path, string, required)
  Type: string

Request body: application/json (required)

Type: object

Schema: [Backend_UserRoleUpdateRequestDto](/api-reference/schemas/backend-userroleupdaterequestdto-8e940551d0.md)

- `role_id` (required)
  Type: string

Responses:

- 202: Successful Response

Content type: application/json

Type: object

Schema: [Backend_UserDto](/api-reference/schemas/backend-userdto-dff074e6e0.md)

- `id` (required)
  Type: string

- `first_name` (required)
  Type: string

- `last_name` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `email` (required)
  Type: string, email

- `gender` (required)
  Reference: [Backend_Gender](/api-reference/schemas/backend-gender-58aaeec09d.md); Type: string
  
  enum: ["male","female","other","prefer_not_to_say"]

- `role_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `role_name` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `is_active` (required)
  Type: boolean

- `member_active` (optional)
  Type: boolean
  
  default: true

- `activated_at` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `image_url` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `user_code` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `created_at` (required)
  Type: string

- `updated_at` (required)
  Type: string

- `tenant_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `permissions` (optional)
  Type: unknown
  
  anyOf:
    Type: array
    
    Items:
      Type: string
  
    Type: null

- `agreed_to_terms` (optional)
  Type: boolean
  
  default: false

- 422: Validation Error

Content type: application/json

Type: object

Schema: [Backend_HTTPValidationError](/api-reference/schemas/backend-httpvalidationerror-b82f7839b1.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [Backend_ValidationError](/api-reference/schemas/backend-validationerror-b5b4376c23.md); Type: object

## Examples

### cURL

```bash
curl -X PATCH 'http://localhost:8000/api/v1/users/string/assign_role' \
  -H 'Authorization: Bearer YOUR_TOKEN' \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "role_id": "string"
}'
```

### JavaScript

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

const response = await fetch('http://localhost:8000/api/v1/users/string/assign_role', {
  method: 'PATCH',
  headers: {
    'Authorization': 'Bearer YOUR_TOKEN',
    'Content-Type': 'application/json',
  },
  body,
});

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

### Python

```python
import requests

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

response = requests.patch(
    'http://localhost:8000/api/v1/users/string/assign_role',
    data=body.encode('utf-8'),
    headers={
        'Authorization': 'Bearer YOUR_TOKEN',
        'Content-Type': 'application/json',
    },
)
print(response.text)
```


## Remove User Role

`PATCH /api/v1/users/{user_id}/remove_role`

Authentication (security requirement alternatives):

```json
[
  {
    "OAuth2PasswordBearer": []
  }
]
```

- OAuth2PasswordBearer: oauth2

Parameters:

- `user_id` (path, string, required)
  Type: string

Request body: application/json (required)

Type: object

Schema: [Backend_UserRoleUpdateRequestDto](/api-reference/schemas/backend-userroleupdaterequestdto-8e940551d0.md)

- `role_id` (required)
  Type: string

Responses:

- 202: Successful Response

Content type: application/json

Type: object

Schema: [Backend_UserDto](/api-reference/schemas/backend-userdto-dff074e6e0.md)

- `id` (required)
  Type: string

- `first_name` (required)
  Type: string

- `last_name` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `email` (required)
  Type: string, email

- `gender` (required)
  Reference: [Backend_Gender](/api-reference/schemas/backend-gender-58aaeec09d.md); Type: string
  
  enum: ["male","female","other","prefer_not_to_say"]

- `role_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `role_name` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `is_active` (required)
  Type: boolean

- `member_active` (optional)
  Type: boolean
  
  default: true

- `activated_at` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `image_url` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `user_code` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `created_at` (required)
  Type: string

- `updated_at` (required)
  Type: string

- `tenant_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `permissions` (optional)
  Type: unknown
  
  anyOf:
    Type: array
    
    Items:
      Type: string
  
    Type: null

- `agreed_to_terms` (optional)
  Type: boolean
  
  default: false

- 422: Validation Error

Content type: application/json

Type: object

Schema: [Backend_HTTPValidationError](/api-reference/schemas/backend-httpvalidationerror-b82f7839b1.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [Backend_ValidationError](/api-reference/schemas/backend-validationerror-b5b4376c23.md); Type: object

## Examples

### cURL

```bash
curl -X PATCH 'http://localhost:8000/api/v1/users/string/remove_role' \
  -H 'Authorization: Bearer YOUR_TOKEN' \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "role_id": "string"
}'
```

### JavaScript

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

const response = await fetch('http://localhost:8000/api/v1/users/string/remove_role', {
  method: 'PATCH',
  headers: {
    'Authorization': 'Bearer YOUR_TOKEN',
    'Content-Type': 'application/json',
  },
  body,
});

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

### Python

```python
import requests

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

response = requests.patch(
    'http://localhost:8000/api/v1/users/string/remove_role',
    data=body.encode('utf-8'),
    headers={
        'Authorization': 'Bearer YOUR_TOKEN',
        'Content-Type': 'application/json',
    },
)
print(response.text)
```


## Get My Tenants

`GET /api/v1/users/me/tenants`

Get all tenants for the currently authenticated user.
This endpoint is accessible to all authenticated users.

Authentication (security requirement alternatives):

```json
[
  {
    "OAuth2PasswordBearer": []
  }
]
```

- OAuth2PasswordBearer: oauth2

Parameters:

- `skip` (query, integer, optional)
  Type: integer
  
  default: 0

- `limit` (query, integer, optional)
  Type: integer
  
  default: 100

Responses:

- 200: Successful Response

Content type: application/json

Type: object

DTO for listing user tenants

Schema: [Backend_UserTenantListDto](/api-reference/schemas/backend-usertenantlistdto-0548bfc1ea.md)

- `items` (required)
  Type: array
  
  Items:
    Reference: [Backend_UserTenantDto](/api-reference/schemas/backend-usertenantdto-55d675b543.md); Type: object
    
    DTO for user-tenant relationship

- `total` (required)
  Type: integer

- `skip` (optional)
  Type: integer
  
  default: 0

- `limit` (optional)
  Type: integer
  
  default: 10

- `has_next` (optional)
  Type: boolean
  
  default: false

- `has_previous` (optional)
  Type: boolean
  
  default: false

- 422: Validation Error

Content type: application/json

Type: object

Schema: [Backend_HTTPValidationError](/api-reference/schemas/backend-httpvalidationerror-b82f7839b1.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [Backend_ValidationError](/api-reference/schemas/backend-validationerror-b5b4376c23.md); Type: object

## Examples

### cURL

```bash
curl -X GET 'http://localhost:8000/api/v1/users/me/tenants?skip=0&limit=100' \
  -H 'Authorization: Bearer YOUR_TOKEN'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8000/api/v1/users/me/tenants?skip=0&limit=100', {
  method: 'GET',
  headers: {
    'Authorization': 'Bearer YOUR_TOKEN',
  },
});

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

### Python

```python
import requests

response = requests.get(
    'http://localhost:8000/api/v1/users/me/tenants?skip=0&limit=100',
    headers={
        'Authorization': 'Bearer YOUR_TOKEN',
    },
)
print(response.text)
```


## Get User Tenants

`GET /api/v1/users/{user_id}/tenants`

Get all tenants for a user.
Users can view their own tenants. Platform admins can view any user's tenants.
Tenant admins can only view memberships for their own authorized tenant(s).

Authentication (security requirement alternatives):

```json
[
  {
    "OAuth2PasswordBearer": []
  }
]
```

- OAuth2PasswordBearer: oauth2

Parameters:

- `user_id` (path, string, required)
  Type: string

- `skip` (query, integer, optional)
  Type: integer
  
  default: 0

- `limit` (query, integer, optional)
  Type: integer
  
  default: 100

Responses:

- 200: Successful Response

Content type: application/json

Type: object

DTO for listing user tenants

Schema: [Backend_UserTenantListDto](/api-reference/schemas/backend-usertenantlistdto-0548bfc1ea.md)

- `items` (required)
  Type: array
  
  Items:
    Reference: [Backend_UserTenantDto](/api-reference/schemas/backend-usertenantdto-55d675b543.md); Type: object
    
    DTO for user-tenant relationship

- `total` (required)
  Type: integer

- `skip` (optional)
  Type: integer
  
  default: 0

- `limit` (optional)
  Type: integer
  
  default: 10

- `has_next` (optional)
  Type: boolean
  
  default: false

- `has_previous` (optional)
  Type: boolean
  
  default: false

- 422: Validation Error

Content type: application/json

Type: object

Schema: [Backend_HTTPValidationError](/api-reference/schemas/backend-httpvalidationerror-b82f7839b1.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [Backend_ValidationError](/api-reference/schemas/backend-validationerror-b5b4376c23.md); Type: object

## Examples

### cURL

```bash
curl -X GET 'http://localhost:8000/api/v1/users/string/tenants?skip=0&limit=100' \
  -H 'Authorization: Bearer YOUR_TOKEN'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8000/api/v1/users/string/tenants?skip=0&limit=100', {
  method: 'GET',
  headers: {
    'Authorization': 'Bearer YOUR_TOKEN',
  },
});

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

### Python

```python
import requests

response = requests.get(
    'http://localhost:8000/api/v1/users/string/tenants?skip=0&limit=100',
    headers={
        'Authorization': 'Bearer YOUR_TOKEN',
    },
)
print(response.text)
```


## Add User To Tenant

`POST /api/v1/users/{user_id}/tenants`

Add a user to a tenant.
Only users with USER_READ_AND_WRITE_ONLY permission can add users to tenants.

Authentication (security requirement alternatives):

```json
[
  {
    "OAuth2PasswordBearer": []
  }
]
```

- OAuth2PasswordBearer: oauth2

Parameters:

- `user_id` (path, string, required)
  Type: string

Request body: application/json (required)

Type: object

DTO for creating user-tenant relationship

Schema: [Backend_UserTenantCreateDto](/api-reference/schemas/backend-usertenantcreatedto-9349389c4c.md)

- `user_id` (required)
  Type: string

- `tenant_id` (required)
  Type: string

- `role_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `is_primary` (optional)
  Type: boolean
  
  default: false

- `is_active` (optional)
  Type: boolean
  
  default: true

Responses:

- 201: Successful Response

Content type: application/json

Type: object

Additional properties: true

- 422: Validation Error

Content type: application/json

Type: object

Schema: [Backend_HTTPValidationError](/api-reference/schemas/backend-httpvalidationerror-b82f7839b1.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [Backend_ValidationError](/api-reference/schemas/backend-validationerror-b5b4376c23.md); Type: object

## Examples

### cURL

```bash
curl -X POST 'http://localhost:8000/api/v1/users/string/tenants' \
  -H 'Authorization: Bearer YOUR_TOKEN' \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "user_id": "string",
  "tenant_id": "string",
  "role_id": "string",
  "is_primary": false,
  "is_active": true
}'
```

### JavaScript

```javascript
const body = `{
  "user_id": "string",
  "tenant_id": "string",
  "role_id": "string",
  "is_primary": false,
  "is_active": true
}`;

const response = await fetch('http://localhost:8000/api/v1/users/string/tenants', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer YOUR_TOKEN',
    'Content-Type': 'application/json',
  },
  body,
});

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

### Python

```python
import requests

body = '''{
  "user_id": "string",
  "tenant_id": "string",
  "role_id": "string",
  "is_primary": false,
  "is_active": true
}'''

response = requests.post(
    'http://localhost:8000/api/v1/users/string/tenants',
    data=body.encode('utf-8'),
    headers={
        'Authorization': 'Bearer YOUR_TOKEN',
        'Content-Type': 'application/json',
    },
)
print(response.text)
```


## Update User Tenant

`PUT /api/v1/users/{user_id}/tenants/{user_tenant_id}`

Update a user-tenant relationship (change role or primary status).
Only users with USER_READ_AND_WRITE_ONLY permission can update.

Authentication (security requirement alternatives):

```json
[
  {
    "OAuth2PasswordBearer": []
  }
]
```

- OAuth2PasswordBearer: oauth2

Parameters:

- `user_id` (path, string, required)
  Type: string

- `user_tenant_id` (path, string, required)
  Type: string

Request body: application/json (required)

Type: object

DTO for updating user-tenant relationship

Schema: [Backend_UserTenantUpdateDto](/api-reference/schemas/backend-usertenantupdatedto-0d1b7de16b.md)

- `role_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `is_primary` (optional)
  Type: unknown
  
  anyOf:
    Type: boolean
  
    Type: null

- `is_active` (optional)
  Type: unknown
  
  anyOf:
    Type: boolean
  
    Type: null

Responses:

- 200: Successful Response

Content type: application/json

Type: object

Additional properties: true

- 422: Validation Error

Content type: application/json

Type: object

Schema: [Backend_HTTPValidationError](/api-reference/schemas/backend-httpvalidationerror-b82f7839b1.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [Backend_ValidationError](/api-reference/schemas/backend-validationerror-b5b4376c23.md); Type: object

## Examples

### cURL

```bash
curl -X PUT 'http://localhost:8000/api/v1/users/string/tenants/string' \
  -H 'Authorization: Bearer YOUR_TOKEN' \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "role_id": "string",
  "is_primary": true,
  "is_active": true
}'
```

### JavaScript

```javascript
const body = `{
  "role_id": "string",
  "is_primary": true,
  "is_active": true
}`;

const response = await fetch('http://localhost:8000/api/v1/users/string/tenants/string', {
  method: 'PUT',
  headers: {
    'Authorization': 'Bearer YOUR_TOKEN',
    'Content-Type': 'application/json',
  },
  body,
});

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

### Python

```python
import requests

body = '''{
  "role_id": "string",
  "is_primary": true,
  "is_active": true
}'''

response = requests.put(
    'http://localhost:8000/api/v1/users/string/tenants/string',
    data=body.encode('utf-8'),
    headers={
        'Authorization': 'Bearer YOUR_TOKEN',
        'Content-Type': 'application/json',
    },
)
print(response.text)
```


## Remove User From Tenant

`DELETE /api/v1/users/{user_id}/tenants/{user_tenant_id}`

Remove a user from a tenant.
Only users with USER_DELETE_ONLY permission can remove users from tenants.

Authentication (security requirement alternatives):

```json
[
  {
    "OAuth2PasswordBearer": []
  }
]
```

- OAuth2PasswordBearer: oauth2

Parameters:

- `user_id` (path, string, required)
  Type: string

- `user_tenant_id` (path, string, required)
  Type: string

Responses:

- 200: Successful Response

Content type: application/json

Type: object

Additional properties: true

- 422: Validation Error

Content type: application/json

Type: object

Schema: [Backend_HTTPValidationError](/api-reference/schemas/backend-httpvalidationerror-b82f7839b1.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [Backend_ValidationError](/api-reference/schemas/backend-validationerror-b5b4376c23.md); Type: object

## Examples

### cURL

```bash
curl -X DELETE 'http://localhost:8000/api/v1/users/string/tenants/string' \
  -H 'Authorization: Bearer YOUR_TOKEN'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8000/api/v1/users/string/tenants/string', {
  method: 'DELETE',
  headers: {
    'Authorization': 'Bearer YOUR_TOKEN',
  },
});

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

### Python

```python
import requests

response = requests.delete(
    'http://localhost:8000/api/v1/users/string/tenants/string',
    headers={
        'Authorization': 'Bearer YOUR_TOKEN',
    },
)
print(response.text)
```


## Set Primary Tenant

`POST /api/v1/users/{user_id}/tenants/set-primary`

Set a tenant as the primary tenant for a user.
Users can set their own primary tenant. Admins can set for any user.

Authentication (security requirement alternatives):

```json
[
  {
    "OAuth2PasswordBearer": []
  }
]
```

- OAuth2PasswordBearer: oauth2

Parameters:

- `user_id` (path, string, required)
  Type: string

Request body: application/json (required)

Type: object

DTO for setting primary tenant

Schema: [Backend_SetPrimaryTenantDto](/api-reference/schemas/backend-setprimarytenantdto-2023e6d94c.md)

- `tenant_id` (required)
  Type: string

Responses:

- 200: Successful Response

Content type: application/json

Type: object

Additional properties: true

- 422: Validation Error

Content type: application/json

Type: object

Schema: [Backend_HTTPValidationError](/api-reference/schemas/backend-httpvalidationerror-b82f7839b1.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [Backend_ValidationError](/api-reference/schemas/backend-validationerror-b5b4376c23.md); Type: object

## Examples

### cURL

```bash
curl -X POST 'http://localhost:8000/api/v1/users/string/tenants/set-primary' \
  -H 'Authorization: Bearer YOUR_TOKEN' \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "tenant_id": "string"
}'
```

### JavaScript

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

const response = await fetch('http://localhost:8000/api/v1/users/string/tenants/set-primary', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer YOUR_TOKEN',
    'Content-Type': 'application/json',
  },
  body,
});

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

### Python

```python
import requests

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

response = requests.post(
    'http://localhost:8000/api/v1/users/string/tenants/set-primary',
    data=body.encode('utf-8'),
    headers={
        'Authorization': 'Bearer YOUR_TOKEN',
        'Content-Type': 'application/json',
    },
)
print(response.text)
```


## Get Primary Tenant

`GET /api/v1/users/{user_id}/tenants/primary`

Get the primary tenant for a user.
Users can view their own primary tenant. Admins can view for any user.

Authentication (security requirement alternatives):

```json
[
  {
    "OAuth2PasswordBearer": []
  }
]
```

- OAuth2PasswordBearer: oauth2

Parameters:

- `user_id` (path, string, required)
  Type: string

Responses:

- 200: Successful Response

Content type: application/json

Type: unknown

anyOf:
  Type: object
  
  Additional properties: true

  Type: null

- 422: Validation Error

Content type: application/json

Type: object

Schema: [Backend_HTTPValidationError](/api-reference/schemas/backend-httpvalidationerror-b82f7839b1.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [Backend_ValidationError](/api-reference/schemas/backend-validationerror-b5b4376c23.md); Type: object

## Examples

### cURL

```bash
curl -X GET 'http://localhost:8000/api/v1/users/string/tenants/primary' \
  -H 'Authorization: Bearer YOUR_TOKEN'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8000/api/v1/users/string/tenants/primary', {
  method: 'GET',
  headers: {
    'Authorization': 'Bearer YOUR_TOKEN',
  },
});

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

### Python

```python
import requests

response = requests.get(
    'http://localhost:8000/api/v1/users/string/tenants/primary',
    headers={
        'Authorization': 'Bearer YOUR_TOKEN',
    },
)
print(response.text)
```


## Switch Primary Tenant

`POST /api/v1/users/me/tenants/switch`

Switch the primary tenant for the currently authenticated user.
The user must already be a member of the tenant.

Authentication (security requirement alternatives):

```json
[
  {
    "OAuth2PasswordBearer": []
  }
]
```

- OAuth2PasswordBearer: oauth2

Request body: application/json (required)

Type: object

DTO for setting primary tenant

Schema: [Backend_SetPrimaryTenantDto](/api-reference/schemas/backend-setprimarytenantdto-2023e6d94c.md)

- `tenant_id` (required)
  Type: string

Responses:

- 200: Successful Response

Content type: application/json

Type: object

Additional properties: true

- 422: Validation Error

Content type: application/json

Type: object

Schema: [Backend_HTTPValidationError](/api-reference/schemas/backend-httpvalidationerror-b82f7839b1.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [Backend_ValidationError](/api-reference/schemas/backend-validationerror-b5b4376c23.md); Type: object

## Examples

### cURL

```bash
curl -X POST 'http://localhost:8000/api/v1/users/me/tenants/switch' \
  -H 'Authorization: Bearer YOUR_TOKEN' \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "tenant_id": "string"
}'
```

### JavaScript

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

const response = await fetch('http://localhost:8000/api/v1/users/me/tenants/switch', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer YOUR_TOKEN',
    'Content-Type': 'application/json',
  },
  body,
});

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

### Python

```python
import requests

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

response = requests.post(
    'http://localhost:8000/api/v1/users/me/tenants/switch',
    data=body.encode('utf-8'),
    headers={
        'Authorization': 'Bearer YOUR_TOKEN',
        'Content-Type': 'application/json',
    },
)
print(response.text)
```


## Bulk Upload Users

`POST /api/v1/users/bulk-upload`

Bulk upload users to a tenant from CSV or Excel file.

Expected CSV/Excel columns:
- email (required)
- first_name or firstName (required)
- last_name or lastName (optional)
- gender (optional: male, female, other, prefer_not_to_say)
- role_name or roleName (optional: e.g., 'Admin', 'User', 'Manager')

For existing users: They will be added to the tenant.
For new users: They will be created and added to the tenant.

Note: Use role_name instead of role_id for easier file preparation.
Get available role names from GET /api/v1/users/available-roles endpoint.

Authentication (security requirement alternatives):

```json
[
  {
    "OAuth2PasswordBearer": []
  }
]
```

- OAuth2PasswordBearer: oauth2

Request body: multipart/form-data (required)

Type: object

Schema: [Backend_Body_bulk_upload_users_api_v1_users_bulk_upload_post](/api-reference/schemas/backend-body-bulk-upload-users-api-v1-users-bulk-upload-post-40ef5bd154.md)

- `tenant_id` (required)
  Type: string
  
  Tenant ID to add users to

- `default_role_id` (optional)
  Type: unknown
  
  Default role ID for new users
  
  anyOf:
    Type: string
  
    Type: null

- `default_role_name` (optional)
  Type: unknown
  
  Default role name for new users (e.g., 'Admin', 'User')
  
  anyOf:
    Type: string
  
    Type: null

- `send_invitation` (optional)
  Type: boolean
  
  Whether to send invitation emails
  
  default: true

- `file` (required)
  Type: string, binary
  
  CSV or Excel file with user data

Responses:

- 201: Successful Response

Content type: application/json

Type: object

DTO for bulk user upload response

Schema: [Backend_BulkUserUploadResponseDto](/api-reference/schemas/backend-bulkuseruploadresponsedto-0571e0cd8f.md)

- `total` (required)
  Type: integer

- `success` (required)
  Type: integer

- `failed` (required)
  Type: integer

- `results` (required)
  Type: array
  
  Items:
    Reference: [Backend_BulkUserUploadResultDto](/api-reference/schemas/backend-bulkuseruploadresultdto-48f2f6aebf.md); Type: object
    
    DTO for individual user upload result

- 422: Validation Error

Content type: application/json

Type: object

Schema: [Backend_HTTPValidationError](/api-reference/schemas/backend-httpvalidationerror-b82f7839b1.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [Backend_ValidationError](/api-reference/schemas/backend-validationerror-b5b4376c23.md); Type: object

## Examples

### cURL

```bash
curl -X POST 'http://localhost:8000/api/v1/users/bulk-upload' \
  -H 'Authorization: Bearer YOUR_TOKEN' \
  --form-string 'tenant_id=string' \
  --form-string 'default_role_id=string' \
  --form-string 'default_role_name=string' \
  --form-string 'send_invitation=true'
```

### JavaScript

```javascript
const form = new FormData();
form.append('tenant_id', 'string');
form.append('default_role_id', 'string');
form.append('default_role_name', 'string');
form.append('send_invitation', 'true');
const response = await fetch('http://localhost:8000/api/v1/users/bulk-upload', {
  method: 'POST',
  headers: {"Authorization":"Bearer YOUR_TOKEN"},
  body: form,
});
console.log(await response.text());
```

### Python

```python
import requests
from contextlib import ExitStack

with ExitStack() as stack:
    files = [
        ('tenant_id', (None, 'string')),
        ('default_role_id', (None, 'string')),
        ('default_role_name', (None, 'string')),
        ('send_invitation', (None, 'true')),
    ]
    response = requests.request('POST', 'http://localhost:8000/api/v1/users/bulk-upload', headers={"Authorization":"Bearer YOUR_TOKEN"}, files=files)
    print(response.text)
```


## List Roles

`GET /api/v1/roles`

Authentication (security requirement alternatives):

```json
[
  {
    "OAuth2PasswordBearer": []
  }
]
```

- OAuth2PasswordBearer: oauth2

Parameters:

- `skip` (query, integer, optional)
  Type: integer
  
  default: 0
  
  minimum: 0

- `limit` (query, integer, optional)
  Type: integer
  
  default: 20
  
  minimum: 1
  
  maximum: 100

- `search` (query, unknown, optional) - Search by role name
  Type: unknown
  
  Search by role name
  
  anyOf:
    Type: string
  
    Type: null

Responses:

- 200: Successful Response

Content type: application/json

Type: object

Schema: [Backend_RoleListDto](/api-reference/schemas/backend-rolelistdto-5c10c1c004.md)

- `items` (required)
  Type: array
  
  Items:
    Reference: [Backend_RoleDto](/api-reference/schemas/backend-roledto-67a8c19f32.md); Type: object

- `skip` (required)
  Type: integer

- `limit` (required)
  Type: integer

- `total` (required)
  Type: integer

- `has_previous` (required)
  Type: boolean

- `has_next` (required)
  Type: boolean

- 422: Validation Error

Content type: application/json

Type: object

Schema: [Backend_HTTPValidationError](/api-reference/schemas/backend-httpvalidationerror-b82f7839b1.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [Backend_ValidationError](/api-reference/schemas/backend-validationerror-b5b4376c23.md); Type: object

## Examples

### cURL

```bash
curl -X GET 'http://localhost:8000/api/v1/roles?skip=0&limit=20' \
  -H 'Authorization: Bearer YOUR_TOKEN'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8000/api/v1/roles?skip=0&limit=20', {
  method: 'GET',
  headers: {
    'Authorization': 'Bearer YOUR_TOKEN',
  },
});

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

### Python

```python
import requests

response = requests.get(
    'http://localhost:8000/api/v1/roles?skip=0&limit=20',
    headers={
        'Authorization': 'Bearer YOUR_TOKEN',
    },
)
print(response.text)
```


## Create Role

`POST /api/v1/roles`

Authentication (security requirement alternatives):

```json
[
  {
    "OAuth2PasswordBearer": []
  }
]
```

- OAuth2PasswordBearer: oauth2

Request body: application/json (required)

Type: object

Schema: [Backend_CreateRoleDto](/api-reference/schemas/backend-createroledto-0210bfd3a8.md)

- `name` (required)
  Type: string

- `description` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `tenant_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `permissions` (optional)
  Type: array
  
  Items:
    Reference: [Backend_Permission](/api-reference/schemas/backend-permission-f0b845e64b.md); Type: string
    
    enum: ["super:admin","full:access","user:read_and_write_only","user:delete_only","user:self_read_and_write_only","user:role_assign_or_remove_only","user:view_only","role:view_only","role:read_and_write_only","role:delete_only","role:permission_read_and_write_only","host:manage_tenants","manage:storage_settings","manage:tenant_settings","manage:billing","manage:payments_settings","manage:products_and_pricing","audit_logs:view_only","audit_logs:download","audit_logs:write","compliance:manage","forms:render","forms:preview","forms:render_anonymous","forms:submit","forms:submit_anonymous","forms:submit_offline","forms:draft_create","forms:draft_read","forms:draft_update","forms:draft_delete","forms:draft_read_all","forms:session_create","forms:session_read","forms:session_delete","forms:session_read_all","forms:config_read","forms:config_write","forms:analytics_view","forms:analytics_export","forms:admin","dashboard:view","dashboard:read","dashboard:create","dashboard:update","dashboard:delete","billing:read","config:read","config:write","survey:manage","survey:create","survey:read","survey:update","survey:delete","survey:publish","survey:unpublish","survey:grant_access","survey:manage_access","survey:response_view","survey:response_download","template:read","template:create","template:update","template:delete","template:manage","submission:create","submission:read","submission:update","submission:update_own","submission:delete","submission:view","submission:export","submission:approve","submission:assign","workspace:create","workspace:read","workspace:update","workspace:delete","workspace:manage","workspace:manage_members","project:create","project:read","project:update","project:delete","project:manage","analytics:view","analytics:export","analytics:admin","report:view","report:create","export:create","export:view","export:download","export:cancel","export:template:create","export:template:view","webhook:create","webhook:read","webhook:update","webhook:delete","webhook:manage","search:execute","search:manage","notification:send","notification:view","notification:read_all","notification:delete","notification:manage","notification:template:view","notification:template:create","notification:template:update","notification:template:delete","notification:preferences:read","notification:preferences:write","media:upload","media:read","media:update","media:delete","media:library_upload","media:library_read","media:library_delete","media:manage","feature_flag:read","feature_flag:create","feature_flag:update","feature_flag:delete","feature_flag:toggle","response:create","response:read","response:update","response:delete","response:export","response:approve","response:revise_own","attachment:create","attachment:read","attachment:delete","odk:view","odk:submit","odk:manage"]

- `is_immutable` (optional)
  Type: boolean
  
  default: false

Responses:

- 201: Successful Response

Content type: application/json

Type: object

Schema: [Backend_CreateRoleResponseDto](/api-reference/schemas/backend-createroleresponsedto-7610ae55ee.md)

- `id` (required)
  Type: string

- 422: Validation Error

Content type: application/json

Type: object

Schema: [Backend_HTTPValidationError](/api-reference/schemas/backend-httpvalidationerror-b82f7839b1.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [Backend_ValidationError](/api-reference/schemas/backend-validationerror-b5b4376c23.md); Type: object

## Examples

### cURL

```bash
curl -X POST 'http://localhost:8000/api/v1/roles' \
  -H 'Authorization: Bearer YOUR_TOKEN' \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "name": "string",
  "description": "string",
  "tenant_id": "string",
  "permissions": [
    "super:admin"
  ],
  "is_immutable": false
}'
```

### JavaScript

```javascript
const body = `{
  "name": "string",
  "description": "string",
  "tenant_id": "string",
  "permissions": [
    "super:admin"
  ],
  "is_immutable": false
}`;

const response = await fetch('http://localhost:8000/api/v1/roles', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer YOUR_TOKEN',
    'Content-Type': 'application/json',
  },
  body,
});

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

### Python

```python
import requests

body = '''{
  "name": "string",
  "description": "string",
  "tenant_id": "string",
  "permissions": [
    "super:admin"
  ],
  "is_immutable": false
}'''

response = requests.post(
    'http://localhost:8000/api/v1/roles',
    data=body.encode('utf-8'),
    headers={
        'Authorization': 'Bearer YOUR_TOKEN',
        'Content-Type': 'application/json',
    },
)
print(response.text)
```


## Search Role By Name

`GET /api/v1/roles/search_by_name`

Authentication (security requirement alternatives):

```json
[
  {
    "OAuth2PasswordBearer": []
  }
]
```

- OAuth2PasswordBearer: oauth2

Parameters:

- `name` (query, string, required)
  Type: string

Responses:

- 200: Successful Response

Content type: application/json

Type: array

Items:
  Reference: [Backend_RoleDto](/api-reference/schemas/backend-roledto-67a8c19f32.md); Type: object

- 422: Validation Error

Content type: application/json

Type: object

Schema: [Backend_HTTPValidationError](/api-reference/schemas/backend-httpvalidationerror-b82f7839b1.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [Backend_ValidationError](/api-reference/schemas/backend-validationerror-b5b4376c23.md); Type: object

## Examples

### cURL

```bash
curl -X GET 'http://localhost:8000/api/v1/roles/search_by_name?name=string' \
  -H 'Authorization: Bearer YOUR_TOKEN'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8000/api/v1/roles/search_by_name?name=string', {
  method: 'GET',
  headers: {
    'Authorization': 'Bearer YOUR_TOKEN',
  },
});

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

### Python

```python
import requests

response = requests.get(
    'http://localhost:8000/api/v1/roles/search_by_name?name=string',
    headers={
        'Authorization': 'Bearer YOUR_TOKEN',
    },
)
print(response.text)
```


## Update Role Permissions

`PATCH /api/v1/roles/{role_id}/permissions`

Update role permissions only (for inline editing in Role Details).

Authentication (security requirement alternatives):

```json
[
  {
    "OAuth2PasswordBearer": []
  }
]
```

- OAuth2PasswordBearer: oauth2

Parameters:

- `role_id` (path, string, required)
  Type: string

Request body: application/json (required)

Type: object

Schema: [Backend_UpdateRolePermissionsDto](/api-reference/schemas/backend-updaterolepermissionsdto-cc5e27857c.md)

- `permissions` (optional)
  Type: array
  
  Items:
    Reference: [Backend_Permission](/api-reference/schemas/backend-permission-f0b845e64b.md); Type: string
    
    enum: ["super:admin","full:access","user:read_and_write_only","user:delete_only","user:self_read_and_write_only","user:role_assign_or_remove_only","user:view_only","role:view_only","role:read_and_write_only","role:delete_only","role:permission_read_and_write_only","host:manage_tenants","manage:storage_settings","manage:tenant_settings","manage:billing","manage:payments_settings","manage:products_and_pricing","audit_logs:view_only","audit_logs:download","audit_logs:write","compliance:manage","forms:render","forms:preview","forms:render_anonymous","forms:submit","forms:submit_anonymous","forms:submit_offline","forms:draft_create","forms:draft_read","forms:draft_update","forms:draft_delete","forms:draft_read_all","forms:session_create","forms:session_read","forms:session_delete","forms:session_read_all","forms:config_read","forms:config_write","forms:analytics_view","forms:analytics_export","forms:admin","dashboard:view","dashboard:read","dashboard:create","dashboard:update","dashboard:delete","billing:read","config:read","config:write","survey:manage","survey:create","survey:read","survey:update","survey:delete","survey:publish","survey:unpublish","survey:grant_access","survey:manage_access","survey:response_view","survey:response_download","template:read","template:create","template:update","template:delete","template:manage","submission:create","submission:read","submission:update","submission:update_own","submission:delete","submission:view","submission:export","submission:approve","submission:assign","workspace:create","workspace:read","workspace:update","workspace:delete","workspace:manage","workspace:manage_members","project:create","project:read","project:update","project:delete","project:manage","analytics:view","analytics:export","analytics:admin","report:view","report:create","export:create","export:view","export:download","export:cancel","export:template:create","export:template:view","webhook:create","webhook:read","webhook:update","webhook:delete","webhook:manage","search:execute","search:manage","notification:send","notification:view","notification:read_all","notification:delete","notification:manage","notification:template:view","notification:template:create","notification:template:update","notification:template:delete","notification:preferences:read","notification:preferences:write","media:upload","media:read","media:update","media:delete","media:library_upload","media:library_read","media:library_delete","media:manage","feature_flag:read","feature_flag:create","feature_flag:update","feature_flag:delete","feature_flag:toggle","response:create","response:read","response:update","response:delete","response:export","response:approve","response:revise_own","attachment:create","attachment:read","attachment:delete","odk:view","odk:submit","odk:manage"]

Responses:

- 200: Successful Response

Content type: application/json

Type: object

Additional properties: true

- 422: Validation Error

Content type: application/json

Type: object

Schema: [Backend_HTTPValidationError](/api-reference/schemas/backend-httpvalidationerror-b82f7839b1.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [Backend_ValidationError](/api-reference/schemas/backend-validationerror-b5b4376c23.md); Type: object

## Examples

### cURL

```bash
curl -X PATCH 'http://localhost:8000/api/v1/roles/string/permissions' \
  -H 'Authorization: Bearer YOUR_TOKEN' \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "permissions": [
    "super:admin"
  ]
}'
```

### JavaScript

```javascript
const body = `{
  "permissions": [
    "super:admin"
  ]
}`;

const response = await fetch('http://localhost:8000/api/v1/roles/string/permissions', {
  method: 'PATCH',
  headers: {
    'Authorization': 'Bearer YOUR_TOKEN',
    'Content-Type': 'application/json',
  },
  body,
});

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

### Python

```python
import requests

body = '''{
  "permissions": [
    "super:admin"
  ]
}'''

response = requests.patch(
    'http://localhost:8000/api/v1/roles/string/permissions',
    data=body.encode('utf-8'),
    headers={
        'Authorization': 'Bearer YOUR_TOKEN',
        'Content-Type': 'application/json',
    },
)
print(response.text)
```


## Get Role

`GET /api/v1/roles/{role_id}`

Authentication (security requirement alternatives):

```json
[
  {
    "OAuth2PasswordBearer": []
  }
]
```

- OAuth2PasswordBearer: oauth2

Parameters:

- `role_id` (path, string, required)
  Type: string

Responses:

- 200: Successful Response

Content type: application/json

Type: object

Schema: [Backend_RoleDto](/api-reference/schemas/backend-roledto-67a8c19f32.md)

- `id` (required)
  Type: string

- `name` (required)
  Type: string

- `description` (required)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `permissions` (optional)
  Type: array
  
  default: []
  
  Items:
    Reference: [Backend_Permission](/api-reference/schemas/backend-permission-f0b845e64b.md); Type: string
    
    enum: ["super:admin","full:access","user:read_and_write_only","user:delete_only","user:self_read_and_write_only","user:role_assign_or_remove_only","user:view_only","role:view_only","role:read_and_write_only","role:delete_only","role:permission_read_and_write_only","host:manage_tenants","manage:storage_settings","manage:tenant_settings","manage:billing","manage:payments_settings","manage:products_and_pricing","audit_logs:view_only","audit_logs:download","audit_logs:write","compliance:manage","forms:render","forms:preview","forms:render_anonymous","forms:submit","forms:submit_anonymous","forms:submit_offline","forms:draft_create","forms:draft_read","forms:draft_update","forms:draft_delete","forms:draft_read_all","forms:session_create","forms:session_read","forms:session_delete","forms:session_read_all","forms:config_read","forms:config_write","forms:analytics_view","forms:analytics_export","forms:admin","dashboard:view","dashboard:read","dashboard:create","dashboard:update","dashboard:delete","billing:read","config:read","config:write","survey:manage","survey:create","survey:read","survey:update","survey:delete","survey:publish","survey:unpublish","survey:grant_access","survey:manage_access","survey:response_view","survey:response_download","template:read","template:create","template:update","template:delete","template:manage","submission:create","submission:read","submission:update","submission:update_own","submission:delete","submission:view","submission:export","submission:approve","submission:assign","workspace:create","workspace:read","workspace:update","workspace:delete","workspace:manage","workspace:manage_members","project:create","project:read","project:update","project:delete","project:manage","analytics:view","analytics:export","analytics:admin","report:view","report:create","export:create","export:view","export:download","export:cancel","export:template:create","export:template:view","webhook:create","webhook:read","webhook:update","webhook:delete","webhook:manage","search:execute","search:manage","notification:send","notification:view","notification:read_all","notification:delete","notification:manage","notification:template:view","notification:template:create","notification:template:update","notification:template:delete","notification:preferences:read","notification:preferences:write","media:upload","media:read","media:update","media:delete","media:library_upload","media:library_read","media:library_delete","media:manage","feature_flag:read","feature_flag:create","feature_flag:update","feature_flag:delete","feature_flag:toggle","response:create","response:read","response:update","response:delete","response:export","response:approve","response:revise_own","attachment:create","attachment:read","attachment:delete","odk:view","odk:submit","odk:manage"]

- `is_immutable` (optional)
  Type: boolean
  
  default: false

- `created_at` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `updated_at` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `tenant_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `scope` (optional)
  Reference: [Backend_RoleScope](/api-reference/schemas/backend-rolescope-986b18b833.md); Type: string
  
  Defines where a role can be used.
  
  default: "tenant_custom"
  
  enum: ["platform","system","tenant_custom"]

- `users_count` (optional)
  Type: integer
  
  default: 0

- 422: Validation Error

Content type: application/json

Type: object

Schema: [Backend_HTTPValidationError](/api-reference/schemas/backend-httpvalidationerror-b82f7839b1.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [Backend_ValidationError](/api-reference/schemas/backend-validationerror-b5b4376c23.md); Type: object

## Examples

### cURL

```bash
curl -X GET 'http://localhost:8000/api/v1/roles/string' \
  -H 'Authorization: Bearer YOUR_TOKEN'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8000/api/v1/roles/string', {
  method: 'GET',
  headers: {
    'Authorization': 'Bearer YOUR_TOKEN',
  },
});

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

### Python

```python
import requests

response = requests.get(
    'http://localhost:8000/api/v1/roles/string',
    headers={
        'Authorization': 'Bearer YOUR_TOKEN',
    },
)
print(response.text)
```


## Update Role

`PUT /api/v1/roles/{role_id}`

Authentication (security requirement alternatives):

```json
[
  {
    "OAuth2PasswordBearer": []
  }
]
```

- OAuth2PasswordBearer: oauth2

Parameters:

- `role_id` (path, string, required)
  Type: string

Request body: application/json (required)

Type: object

Schema: [Backend_UpdateRoleDto](/api-reference/schemas/backend-updateroledto-11a3356246.md)

- `name` (required)
  Type: string

- `description` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `tenant_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `permissions` (optional)
  Type: array
  
  Items:
    Reference: [Backend_Permission](/api-reference/schemas/backend-permission-f0b845e64b.md); Type: string
    
    enum: ["super:admin","full:access","user:read_and_write_only","user:delete_only","user:self_read_and_write_only","user:role_assign_or_remove_only","user:view_only","role:view_only","role:read_and_write_only","role:delete_only","role:permission_read_and_write_only","host:manage_tenants","manage:storage_settings","manage:tenant_settings","manage:billing","manage:payments_settings","manage:products_and_pricing","audit_logs:view_only","audit_logs:download","audit_logs:write","compliance:manage","forms:render","forms:preview","forms:render_anonymous","forms:submit","forms:submit_anonymous","forms:submit_offline","forms:draft_create","forms:draft_read","forms:draft_update","forms:draft_delete","forms:draft_read_all","forms:session_create","forms:session_read","forms:session_delete","forms:session_read_all","forms:config_read","forms:config_write","forms:analytics_view","forms:analytics_export","forms:admin","dashboard:view","dashboard:read","dashboard:create","dashboard:update","dashboard:delete","billing:read","config:read","config:write","survey:manage","survey:create","survey:read","survey:update","survey:delete","survey:publish","survey:unpublish","survey:grant_access","survey:manage_access","survey:response_view","survey:response_download","template:read","template:create","template:update","template:delete","template:manage","submission:create","submission:read","submission:update","submission:update_own","submission:delete","submission:view","submission:export","submission:approve","submission:assign","workspace:create","workspace:read","workspace:update","workspace:delete","workspace:manage","workspace:manage_members","project:create","project:read","project:update","project:delete","project:manage","analytics:view","analytics:export","analytics:admin","report:view","report:create","export:create","export:view","export:download","export:cancel","export:template:create","export:template:view","webhook:create","webhook:read","webhook:update","webhook:delete","webhook:manage","search:execute","search:manage","notification:send","notification:view","notification:read_all","notification:delete","notification:manage","notification:template:view","notification:template:create","notification:template:update","notification:template:delete","notification:preferences:read","notification:preferences:write","media:upload","media:read","media:update","media:delete","media:library_upload","media:library_read","media:library_delete","media:manage","feature_flag:read","feature_flag:create","feature_flag:update","feature_flag:delete","feature_flag:toggle","response:create","response:read","response:update","response:delete","response:export","response:approve","response:revise_own","attachment:create","attachment:read","attachment:delete","odk:view","odk:submit","odk:manage"]

- `is_immutable` (optional)
  Type: boolean
  
  default: false

Responses:

- 200: Successful Response

Content type: application/json

Type: object

Additional properties: true

- 422: Validation Error

Content type: application/json

Type: object

Schema: [Backend_HTTPValidationError](/api-reference/schemas/backend-httpvalidationerror-b82f7839b1.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [Backend_ValidationError](/api-reference/schemas/backend-validationerror-b5b4376c23.md); Type: object

## Examples

### cURL

```bash
curl -X PUT 'http://localhost:8000/api/v1/roles/string' \
  -H 'Authorization: Bearer YOUR_TOKEN' \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "name": "string",
  "description": "string",
  "tenant_id": "string",
  "permissions": [
    "super:admin"
  ],
  "is_immutable": false
}'
```

### JavaScript

```javascript
const body = `{
  "name": "string",
  "description": "string",
  "tenant_id": "string",
  "permissions": [
    "super:admin"
  ],
  "is_immutable": false
}`;

const response = await fetch('http://localhost:8000/api/v1/roles/string', {
  method: 'PUT',
  headers: {
    'Authorization': 'Bearer YOUR_TOKEN',
    'Content-Type': 'application/json',
  },
  body,
});

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

### Python

```python
import requests

body = '''{
  "name": "string",
  "description": "string",
  "tenant_id": "string",
  "permissions": [
    "super:admin"
  ],
  "is_immutable": false
}'''

response = requests.put(
    'http://localhost:8000/api/v1/roles/string',
    data=body.encode('utf-8'),
    headers={
        'Authorization': 'Bearer YOUR_TOKEN',
        'Content-Type': 'application/json',
    },
)
print(response.text)
```


## Delete Role

`DELETE /api/v1/roles/{role_id}`

Deletes a role if it is not assigned to any users.

Authentication (security requirement alternatives):

```json
[
  {
    "OAuth2PasswordBearer": []
  }
]
```

- OAuth2PasswordBearer: oauth2

Parameters:

- `role_id` (path, string, required)
  Type: string

Responses:

- 200: Successful Response

Content type: application/json

Type: unknown

- 422: Validation Error

Content type: application/json

Type: object

Schema: [Backend_HTTPValidationError](/api-reference/schemas/backend-httpvalidationerror-b82f7839b1.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [Backend_ValidationError](/api-reference/schemas/backend-validationerror-b5b4376c23.md); Type: object

## Examples

### cURL

```bash
curl -X DELETE 'http://localhost:8000/api/v1/roles/string' \
  -H 'Authorization: Bearer YOUR_TOKEN'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8000/api/v1/roles/string', {
  method: 'DELETE',
  headers: {
    'Authorization': 'Bearer YOUR_TOKEN',
  },
});

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

### Python

```python
import requests

response = requests.delete(
    'http://localhost:8000/api/v1/roles/string',
    headers={
        'Authorization': 'Bearer YOUR_TOKEN',
    },
)
print(response.text)
```


## Sync Admin Permissions

`POST /api/v1/roles/sync-admin-permissions`

Sync ADMIN role permissions with the latest from seeder_utils. Use this after adding new permissions.

Authentication (security requirement alternatives):

```json
[
  {
    "OAuth2PasswordBearer": []
  }
]
```

- OAuth2PasswordBearer: oauth2

Responses:

- 200: Successful Response

Content type: application/json

Type: unknown

## Examples

### cURL

```bash
curl -X POST 'http://localhost:8000/api/v1/roles/sync-admin-permissions' \
  -H 'Authorization: Bearer YOUR_TOKEN'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8000/api/v1/roles/sync-admin-permissions', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer YOUR_TOKEN',
  },
});

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

### Python

```python
import requests

response = requests.post(
    'http://localhost:8000/api/v1/roles/sync-admin-permissions',
    headers={
        'Authorization': 'Bearer YOUR_TOKEN',
    },
)
print(response.text)
```


## Sync User Permissions

`POST /api/v1/roles/sync-user-permissions`

Sync USER role permissions with the latest from seeder_utils. Use this after adding new permissions.

Authentication (security requirement alternatives):

```json
[
  {
    "OAuth2PasswordBearer": []
  }
]
```

- OAuth2PasswordBearer: oauth2

Responses:

- 200: Successful Response

Content type: application/json

Type: unknown

## Examples

### cURL

```bash
curl -X POST 'http://localhost:8000/api/v1/roles/sync-user-permissions' \
  -H 'Authorization: Bearer YOUR_TOKEN'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8000/api/v1/roles/sync-user-permissions', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer YOUR_TOKEN',
  },
});

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

### Python

```python
import requests

response = requests.post(
    'http://localhost:8000/api/v1/roles/sync-user-permissions',
    headers={
        'Authorization': 'Bearer YOUR_TOKEN',
    },
)
print(response.text)
```


## Get Grouped Permissions

`GET /api/v1/roles/grouped-permissions`

Get permissions grouped by category for enterprise permission management UI

Authentication (security requirement alternatives):

```json
[
  {
    "OAuth2PasswordBearer": []
  }
]
```

- OAuth2PasswordBearer: oauth2

Responses:

- 200: Successful Response

Content type: application/json

Type: array

Items:
  Reference: [Backend_PermissionGroupedDto](/api-reference/schemas/backend-permissiongroupeddto-e4796298d2.md); Type: object

## Examples

### cURL

```bash
curl -X GET 'http://localhost:8000/api/v1/roles/grouped-permissions' \
  -H 'Authorization: Bearer YOUR_TOKEN'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8000/api/v1/roles/grouped-permissions', {
  method: 'GET',
  headers: {
    'Authorization': 'Bearer YOUR_TOKEN',
  },
});

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

### Python

```python
import requests

response = requests.get(
    'http://localhost:8000/api/v1/roles/grouped-permissions',
    headers={
        'Authorization': 'Bearer YOUR_TOKEN',
    },
)
print(response.text)
```


## Get Role Stats

`GET /api/v1/roles/{role_id}/stats`

Get role statistics including assigned users count

Authentication (security requirement alternatives):

```json
[
  {
    "OAuth2PasswordBearer": []
  }
]
```

- OAuth2PasswordBearer: oauth2

Parameters:

- `role_id` (path, string, required)
  Type: string

Responses:

- 200: Successful Response

Content type: application/json

Type: object

Additional properties: true

- 422: Validation Error

Content type: application/json

Type: object

Schema: [Backend_HTTPValidationError](/api-reference/schemas/backend-httpvalidationerror-b82f7839b1.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [Backend_ValidationError](/api-reference/schemas/backend-validationerror-b5b4376c23.md); Type: object

## Examples

### cURL

```bash
curl -X GET 'http://localhost:8000/api/v1/roles/string/stats' \
  -H 'Authorization: Bearer YOUR_TOKEN'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8000/api/v1/roles/string/stats', {
  method: 'GET',
  headers: {
    'Authorization': 'Bearer YOUR_TOKEN',
  },
});

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

### Python

```python
import requests

response = requests.get(
    'http://localhost:8000/api/v1/roles/string/stats',
    headers={
        'Authorization': 'Bearer YOUR_TOKEN',
    },
)
print(response.text)
```


## Get Role Users

`GET /api/v1/roles/{role_id}/users`

List users assigned to a role (checks both users.role_id and user_tenants.role_id).

Authentication (security requirement alternatives):

```json
[
  {
    "OAuth2PasswordBearer": []
  }
]
```

- OAuth2PasswordBearer: oauth2

Parameters:

- `role_id` (path, string, required)
  Type: string

- `skip` (query, integer, optional)
  Type: integer
  
  default: 0
  
  minimum: 0

- `limit` (query, integer, optional)
  Type: integer
  
  default: 20
  
  minimum: 1
  
  maximum: 100

Responses:

- 200: Successful Response

Content type: application/json

Type: object

Schema: [Backend_UserListDto](/api-reference/schemas/backend-userlistdto-f264831fe0.md)

- `items` (required)
  Type: array
  
  Items:
    Reference: [Backend_UserDto](/api-reference/schemas/backend-userdto-dff074e6e0.md); Type: object

- `skip` (required)
  Type: integer

- `limit` (required)
  Type: integer

- `total` (required)
  Type: integer

- `has_previous` (required)
  Type: boolean

- `has_next` (required)
  Type: boolean

- 422: Validation Error

Content type: application/json

Type: object

Schema: [Backend_HTTPValidationError](/api-reference/schemas/backend-httpvalidationerror-b82f7839b1.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [Backend_ValidationError](/api-reference/schemas/backend-validationerror-b5b4376c23.md); Type: object

## Examples

### cURL

```bash
curl -X GET 'http://localhost:8000/api/v1/roles/string/users?skip=0&limit=20' \
  -H 'Authorization: Bearer YOUR_TOKEN'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8000/api/v1/roles/string/users?skip=0&limit=20', {
  method: 'GET',
  headers: {
    'Authorization': 'Bearer YOUR_TOKEN',
  },
});

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

### Python

```python
import requests

response = requests.get(
    'http://localhost:8000/api/v1/roles/string/users?skip=0&limit=20',
    headers={
        'Authorization': 'Bearer YOUR_TOKEN',
    },
)
print(response.text)
```


## Get Permissions

`GET /api/v1/permissions`

Authentication (security requirement alternatives):

```json
[
  {
    "OAuth2PasswordBearer": []
  }
]
```

- OAuth2PasswordBearer: oauth2

Responses:

- 200: Successful Response

Content type: application/json

Type: array

Items:
  Reference: [Backend_PermissionDto](/api-reference/schemas/backend-permissiondto-fff0936857.md); Type: object

## Examples

### cURL

```bash
curl -X GET 'http://localhost:8000/api/v1/permissions' \
  -H 'Authorization: Bearer YOUR_TOKEN'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8000/api/v1/permissions', {
  method: 'GET',
  headers: {
    'Authorization': 'Bearer YOUR_TOKEN',
  },
});

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

### Python

```python
import requests

response = requests.get(
    'http://localhost:8000/api/v1/permissions',
    headers={
        'Authorization': 'Bearer YOUR_TOKEN',
    },
)
print(response.text)
```


## List Products

`GET /api/v1/products`

Authentication (security requirement alternatives):

```json
[
  {
    "OAuth2PasswordBearer": []
  }
]
```

- OAuth2PasswordBearer: oauth2

Parameters:

- `active` (query, unknown, optional) - Filter active products. None returns all.
  Type: unknown
  
  Filter active products. None returns all.
  
  anyOf:
    Type: boolean
  
    Type: null

Responses:

- 200: Successful Response

Content type: application/json

Type: object

Schema: [Backend_ProductListDto](/api-reference/schemas/backend-productlistdto-a35d4183a4.md)

- `products` (required)
  Type: array
  
  Items:
    Reference: [Backend_ProductDto](/api-reference/schemas/backend-productdto-45e8c99190.md); Type: object

- `has_more` (required)
  Type: boolean

- 422: Validation Error

Content type: application/json

Type: object

Schema: [Backend_HTTPValidationError](/api-reference/schemas/backend-httpvalidationerror-b82f7839b1.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [Backend_ValidationError](/api-reference/schemas/backend-validationerror-b5b4376c23.md); Type: object

## Examples

### cURL

```bash
curl -X GET 'http://localhost:8000/api/v1/products' \
  -H 'Authorization: Bearer YOUR_TOKEN'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8000/api/v1/products', {
  method: 'GET',
  headers: {
    'Authorization': 'Bearer YOUR_TOKEN',
  },
});

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

### Python

```python
import requests

response = requests.get(
    'http://localhost:8000/api/v1/products',
    headers={
        'Authorization': 'Bearer YOUR_TOKEN',
    },
)
print(response.text)
```


## Create a Product

`POST /api/v1/products`

Authentication (security requirement alternatives):

```json
[
  {
    "OAuth2PasswordBearer": []
  }
]
```

- OAuth2PasswordBearer: oauth2

Request body: application/json (required)

Type: object

Schema: [Backend_CreateProductDto](/api-reference/schemas/backend-createproductdto-f35d014276.md)

- `name` (required)
  Type: string

- `description` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `tax_code` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `active` (optional)
  Type: boolean
  
  default: true

Responses:

- 201: Successful Response

Content type: application/json

Type: unknown

- 422: Validation Error

Content type: application/json

Type: object

Schema: [Backend_HTTPValidationError](/api-reference/schemas/backend-httpvalidationerror-b82f7839b1.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [Backend_ValidationError](/api-reference/schemas/backend-validationerror-b5b4376c23.md); Type: object

## Examples

### cURL

```bash
curl -X POST 'http://localhost:8000/api/v1/products' \
  -H 'Authorization: Bearer YOUR_TOKEN' \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "name": "string",
  "description": "string",
  "tax_code": "string",
  "active": true
}'
```

### JavaScript

```javascript
const body = `{
  "name": "string",
  "description": "string",
  "tax_code": "string",
  "active": true
}`;

const response = await fetch('http://localhost:8000/api/v1/products', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer YOUR_TOKEN',
    'Content-Type': 'application/json',
  },
  body,
});

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

### Python

```python
import requests

body = '''{
  "name": "string",
  "description": "string",
  "tax_code": "string",
  "active": true
}'''

response = requests.post(
    'http://localhost:8000/api/v1/products',
    data=body.encode('utf-8'),
    headers={
        'Authorization': 'Bearer YOUR_TOKEN',
        'Content-Type': 'application/json',
    },
)
print(response.text)
```


## Get Product by ID

`GET /api/v1/products/{product_id}`

Authentication (security requirement alternatives):

```json
[
  {
    "OAuth2PasswordBearer": []
  }
]
```

- OAuth2PasswordBearer: oauth2

Parameters:

- `product_id` (path, string, required)
  Type: string

Responses:

- 200: Successful Response

Content type: application/json

Type: object

Schema: [Backend_ProductDto](/api-reference/schemas/backend-productdto-45e8c99190.md)

- `id` (required)
  Type: string

- `name` (required)
  Type: string

- `description` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `tax_code` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `active` (required)
  Type: boolean

- 422: Validation Error

Content type: application/json

Type: object

Schema: [Backend_HTTPValidationError](/api-reference/schemas/backend-httpvalidationerror-b82f7839b1.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [Backend_ValidationError](/api-reference/schemas/backend-validationerror-b5b4376c23.md); Type: object

## Examples

### cURL

```bash
curl -X GET 'http://localhost:8000/api/v1/products/string' \
  -H 'Authorization: Bearer YOUR_TOKEN'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8000/api/v1/products/string', {
  method: 'GET',
  headers: {
    'Authorization': 'Bearer YOUR_TOKEN',
  },
});

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

### Python

```python
import requests

response = requests.get(
    'http://localhost:8000/api/v1/products/string',
    headers={
        'Authorization': 'Bearer YOUR_TOKEN',
    },
)
print(response.text)
```


## Delete a Product

`DELETE /api/v1/products/{product_id}`

Authentication (security requirement alternatives):

```json
[
  {
    "OAuth2PasswordBearer": []
  }
]
```

- OAuth2PasswordBearer: oauth2

Parameters:

- `product_id` (path, string, required)
  Type: string

Responses:

- 202: Successful Response

Content type: application/json

Type: unknown

- 422: Validation Error

Content type: application/json

Type: object

Schema: [Backend_HTTPValidationError](/api-reference/schemas/backend-httpvalidationerror-b82f7839b1.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [Backend_ValidationError](/api-reference/schemas/backend-validationerror-b5b4376c23.md); Type: object

## Examples

### cURL

```bash
curl -X DELETE 'http://localhost:8000/api/v1/products/string' \
  -H 'Authorization: Bearer YOUR_TOKEN'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8000/api/v1/products/string', {
  method: 'DELETE',
  headers: {
    'Authorization': 'Bearer YOUR_TOKEN',
  },
});

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

### Python

```python
import requests

response = requests.delete(
    'http://localhost:8000/api/v1/products/string',
    headers={
        'Authorization': 'Bearer YOUR_TOKEN',
    },
)
print(response.text)
```


## Update a Product

`PATCH /api/v1/products/{product_id}`

Authentication (security requirement alternatives):

```json
[
  {
    "OAuth2PasswordBearer": []
  }
]
```

- OAuth2PasswordBearer: oauth2

Parameters:

- `product_id` (path, string, required)
  Type: string

Request body: application/json (required)

Type: object

Schema: [Backend_CreateProductDto](/api-reference/schemas/backend-createproductdto-f35d014276.md)

- `name` (required)
  Type: string

- `description` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `tax_code` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `active` (optional)
  Type: boolean
  
  default: true

Responses:

- 204: Successful Response

- 422: Validation Error

Content type: application/json

Type: object

Schema: [Backend_HTTPValidationError](/api-reference/schemas/backend-httpvalidationerror-b82f7839b1.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [Backend_ValidationError](/api-reference/schemas/backend-validationerror-b5b4376c23.md); Type: object

## Examples

### cURL

```bash
curl -X PATCH 'http://localhost:8000/api/v1/products/string' \
  -H 'Authorization: Bearer YOUR_TOKEN' \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "name": "string",
  "description": "string",
  "tax_code": "string",
  "active": true
}'
```

### JavaScript

```javascript
const body = `{
  "name": "string",
  "description": "string",
  "tax_code": "string",
  "active": true
}`;

const response = await fetch('http://localhost:8000/api/v1/products/string', {
  method: 'PATCH',
  headers: {
    'Authorization': 'Bearer YOUR_TOKEN',
    'Content-Type': 'application/json',
  },
  body,
});

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

### Python

```python
import requests

body = '''{
  "name": "string",
  "description": "string",
  "tax_code": "string",
  "active": true
}'''

response = requests.patch(
    'http://localhost:8000/api/v1/products/string',
    data=body.encode('utf-8'),
    headers={
        'Authorization': 'Bearer YOUR_TOKEN',
        'Content-Type': 'application/json',
    },
)
print(response.text)
```


## Get Pricing List

`GET /api/v1/prices`

Authentication (security requirement alternatives):

```json
[
  {
    "OAuth2PasswordBearer": []
  }
]
```

- OAuth2PasswordBearer: oauth2

Responses:

- 200: Successful Response

Content type: application/json

Type: object

Schema: [Backend_PricingListDto](/api-reference/schemas/backend-pricinglistdto-39d7e3ce33.md)

- `pricings` (required)
  Type: array
  
  Items:
    Reference: [Backend_PricingDto](/api-reference/schemas/backend-pricingdto-6f370db28d.md); Type: object

- `has_more` (required)
  Type: boolean

## Examples

### cURL

```bash
curl -X GET 'http://localhost:8000/api/v1/prices' \
  -H 'Authorization: Bearer YOUR_TOKEN'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8000/api/v1/prices', {
  method: 'GET',
  headers: {
    'Authorization': 'Bearer YOUR_TOKEN',
  },
});

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

### Python

```python
import requests

response = requests.get(
    'http://localhost:8000/api/v1/prices',
    headers={
        'Authorization': 'Bearer YOUR_TOKEN',
    },
)
print(response.text)
```


## Create Pricing

`POST /api/v1/prices`

Authentication (security requirement alternatives):

```json
[
  {
    "OAuth2PasswordBearer": []
  }
]
```

- OAuth2PasswordBearer: oauth2

Request body: application/json (required)

Type: object

Schema: [Backend_CreatePricingDto](/api-reference/schemas/backend-createpricingdto-c5ec814c3d.md)

- `currency` (optional)
  Type: string
  
  Currency code, e.g., 'usd'
  
  default: "usd"

- `unit_amount` (required)
  Type: integer
  
  A positive integer in cents (or 0 for a free price) representing how much to charge. One of unit_amount, unit_amount_decimal, or custom_unit_amount is required, unless billing_scheme=tiered.

- `product` (required)
  Type: string
  
  The ID of the product this price is associated with

- `active` (optional)
  Type: boolean
  
  Whether the price is active or not
  
  default: true

- `recurring` (required)
  Reference: [Backend_RecurringDto](/api-reference/schemas/backend-recurringdto-a1f533306f.md); Type: object

Responses:

- 201: Successful Response

Content type: application/json

Type: unknown

- 422: Validation Error

Content type: application/json

Type: object

Schema: [Backend_HTTPValidationError](/api-reference/schemas/backend-httpvalidationerror-b82f7839b1.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [Backend_ValidationError](/api-reference/schemas/backend-validationerror-b5b4376c23.md); Type: object

## Examples

### cURL

```bash
curl -X POST 'http://localhost:8000/api/v1/prices' \
  -H 'Authorization: Bearer YOUR_TOKEN' \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "currency": "usd",
  "unit_amount": 0,
  "product": "string",
  "active": true,
  "recurring": {
    "interval": "month",
    "interval_count": 1,
    "usage_type": "licensed"
  }
}'
```

### JavaScript

```javascript
const body = `{
  "currency": "usd",
  "unit_amount": 0,
  "product": "string",
  "active": true,
  "recurring": {
    "interval": "month",
    "interval_count": 1,
    "usage_type": "licensed"
  }
}`;

const response = await fetch('http://localhost:8000/api/v1/prices', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer YOUR_TOKEN',
    'Content-Type': 'application/json',
  },
  body,
});

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

### Python

```python
import requests

body = '''{
  "currency": "usd",
  "unit_amount": 0,
  "product": "string",
  "active": true,
  "recurring": {
    "interval": "month",
    "interval_count": 1,
    "usage_type": "licensed"
  }
}'''

response = requests.post(
    'http://localhost:8000/api/v1/prices',
    data=body.encode('utf-8'),
    headers={
        'Authorization': 'Bearer YOUR_TOKEN',
        'Content-Type': 'application/json',
    },
)
print(response.text)
```


## Update Pricing

`PATCH /api/v1/prices/{price_id}`

Authentication (security requirement alternatives):

```json
[
  {
    "OAuth2PasswordBearer": []
  }
]
```

- OAuth2PasswordBearer: oauth2

Parameters:

- `price_id` (path, string, required)
  Type: string

Request body: application/json (required)

Type: object

Schema: [Backend_UpdatePricingDto](/api-reference/schemas/backend-updatepricingdto-6a5173adda.md)

- `active` (required)
  Type: boolean

- `metadata` (optional)
  Type: unknown
  
  anyOf:
    Type: object
    
    Additional properties: true
  
    Type: null

- `tax_behavior` (optional)
  Type: unknown
  
  anyOf:
    Type: string
    
    enum: ["exclusive","inclusive","unspecified"]
  
    Type: null

Responses:

- 204: Successful Response

- 422: Validation Error

Content type: application/json

Type: object

Schema: [Backend_HTTPValidationError](/api-reference/schemas/backend-httpvalidationerror-b82f7839b1.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [Backend_ValidationError](/api-reference/schemas/backend-validationerror-b5b4376c23.md); Type: object

## Examples

### cURL

```bash
curl -X PATCH 'http://localhost:8000/api/v1/prices/string' \
  -H 'Authorization: Bearer YOUR_TOKEN' \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "active": true,
  "metadata": {},
  "tax_behavior": "exclusive"
}'
```

### JavaScript

```javascript
const body = `{
  "active": true,
  "metadata": {},
  "tax_behavior": "exclusive"
}`;

const response = await fetch('http://localhost:8000/api/v1/prices/string', {
  method: 'PATCH',
  headers: {
    'Authorization': 'Bearer YOUR_TOKEN',
    'Content-Type': 'application/json',
  },
  body,
});

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

### Python

```python
import requests

body = '''{
  "active": true,
  "metadata": {},
  "tax_behavior": "exclusive"
}'''

response = requests.patch(
    'http://localhost:8000/api/v1/prices/string',
    data=body.encode('utf-8'),
    headers={
        'Authorization': 'Bearer YOUR_TOKEN',
        'Content-Type': 'application/json',
    },
)
print(response.text)
```


## Get billing configuration

`GET /api/v1/billing/config`

Returns the Stripe publishable key to the frontend.

Authentication (security requirement alternatives):

```json
[
  {
    "OAuth2PasswordBearer": []
  }
]
```

- OAuth2PasswordBearer: oauth2

Responses:

- 200: Successful Response

Content type: application/json

Type: object

Schema: [Backend_BillingConfigDto](/api-reference/schemas/backend-billingconfigdto-a2a6ee7028.md)

- `publishable_key` (required)
  Type: string

## Examples

### cURL

```bash
curl -X GET 'http://localhost:8000/api/v1/billing/config' \
  -H 'Authorization: Bearer YOUR_TOKEN'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8000/api/v1/billing/config', {
  method: 'GET',
  headers: {
    'Authorization': 'Bearer YOUR_TOKEN',
  },
});

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

### Python

```python
import requests

response = requests.get(
    'http://localhost:8000/api/v1/billing/config',
    headers={
        'Authorization': 'Bearer YOUR_TOKEN',
    },
)
print(response.text)
```


## List available plans

`GET /api/v1/billing/plans`

Authentication (security requirement alternatives):

```json
[
  {
    "OAuth2PasswordBearer": []
  }
]
```

- OAuth2PasswordBearer: oauth2

Parameters:

- `skip` (query, integer, optional)
  Type: integer
  
  default: 0

- `limit` (query, integer, optional)
  Type: integer
  
  default: 10

- `search` (query, unknown, optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

Responses:

- 200: Successful Response

Content type: application/json

Type: object

Schema: [Backend_PlanListDto](/api-reference/schemas/backend-planlistdto-c6e93917e7.md)

- `items` (required)
  Type: array
  
  Items:
    Reference: [Backend_PlanDto](/api-reference/schemas/backend-plandto-591471c431.md); Type: object

- `total` (required)
  Type: integer

- `skip` (optional)
  Type: integer
  
  default: 0

- `limit` (optional)
  Type: integer
  
  default: 10

- `has_next` (optional)
  Type: boolean
  
  default: false

- `has_previous` (optional)
  Type: boolean
  
  default: false

- 422: Validation Error

Content type: application/json

Type: object

Schema: [Backend_HTTPValidationError](/api-reference/schemas/backend-httpvalidationerror-b82f7839b1.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [Backend_ValidationError](/api-reference/schemas/backend-validationerror-b5b4376c23.md); Type: object

## Examples

### cURL

```bash
curl -X GET 'http://localhost:8000/api/v1/billing/plans?skip=0&limit=10' \
  -H 'Authorization: Bearer YOUR_TOKEN'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8000/api/v1/billing/plans?skip=0&limit=10', {
  method: 'GET',
  headers: {
    'Authorization': 'Bearer YOUR_TOKEN',
  },
});

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

### Python

```python
import requests

response = requests.get(
    'http://localhost:8000/api/v1/billing/plans?skip=0&limit=10',
    headers={
        'Authorization': 'Bearer YOUR_TOKEN',
    },
)
print(response.text)
```


## Create a new plan

`POST /api/v1/billing/plans`

Authentication (security requirement alternatives):

```json
[
  {
    "OAuth2PasswordBearer": []
  }
]
```

- OAuth2PasswordBearer: oauth2

Request body: application/json (required)

Type: object

Schema: [Backend_CreatePlanDto](/api-reference/schemas/backend-createplandto-5f23e90b85.md)

- `currency` (optional)
  Type: string
  
  Must be a supported currency: https://docs.stripe.com/currencies
  
  default: "usd"

- `interval` (required)
  Type: string
  
  enum: ["month","year"]

- `product_id` (required)
  Type: string
  
  The product whose pricing the created plan will represent. This must be the ID of an existing product.

- `amount` (required)
  Type: integer

- `trial_period_days` (optional)
  Type: unknown
  
  Number of days for the trial period. Set > 0 to enable trials.
  
  anyOf:
    Type: integer
  
    Type: null

Responses:

- 201: Successful Response

Content type: application/json

Type: unknown

- 422: Validation Error

Content type: application/json

Type: object

Schema: [Backend_HTTPValidationError](/api-reference/schemas/backend-httpvalidationerror-b82f7839b1.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [Backend_ValidationError](/api-reference/schemas/backend-validationerror-b5b4376c23.md); Type: object

## Examples

### cURL

```bash
curl -X POST 'http://localhost:8000/api/v1/billing/plans' \
  -H 'Authorization: Bearer YOUR_TOKEN' \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "currency": "usd",
  "interval": "month",
  "product_id": "string",
  "amount": 0,
  "trial_period_days": 0
}'
```

### JavaScript

```javascript
const body = `{
  "currency": "usd",
  "interval": "month",
  "product_id": "string",
  "amount": 0,
  "trial_period_days": 0
}`;

const response = await fetch('http://localhost:8000/api/v1/billing/plans', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer YOUR_TOKEN',
    'Content-Type': 'application/json',
  },
  body,
});

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

### Python

```python
import requests

body = '''{
  "currency": "usd",
  "interval": "month",
  "product_id": "string",
  "amount": 0,
  "trial_period_days": 0
}'''

response = requests.post(
    'http://localhost:8000/api/v1/billing/plans',
    data=body.encode('utf-8'),
    headers={
        'Authorization': 'Bearer YOUR_TOKEN',
        'Content-Type': 'application/json',
    },
)
print(response.text)
```


## Get a plan details

`GET /api/v1/billing/plans/{plan_id}`

Authentication (security requirement alternatives):

```json
[
  {
    "OAuth2PasswordBearer": []
  }
]
```

- OAuth2PasswordBearer: oauth2

Parameters:

- `plan_id` (path, string, required)
  Type: string

Responses:

- 200: Successful Response

Content type: application/json

Type: object

Schema: [Backend_PlanDto](/api-reference/schemas/backend-plandto-591471c431.md)

- `id` (required)
  Type: string

- `active` (required)
  Type: boolean

- `amount` (required)
  Type: integer

- `amount_decimal` (required)
  Type: string

- `billing_scheme` (required)
  Type: string

- `currency` (optional)
  Type: string
  
  default: "usd"

- `interval` (required)
  Type: string

- `interval_count` (required)
  Type: integer

- `product` (required)
  Type: string

- `trial_period_days` (optional)
  Type: unknown
  
  anyOf:
    Type: integer
  
    Type: null

- `usage_type` (required)
  Type: string

- 422: Validation Error

Content type: application/json

Type: object

Schema: [Backend_HTTPValidationError](/api-reference/schemas/backend-httpvalidationerror-b82f7839b1.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [Backend_ValidationError](/api-reference/schemas/backend-validationerror-b5b4376c23.md); Type: object

## Examples

### cURL

```bash
curl -X GET 'http://localhost:8000/api/v1/billing/plans/string' \
  -H 'Authorization: Bearer YOUR_TOKEN'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8000/api/v1/billing/plans/string', {
  method: 'GET',
  headers: {
    'Authorization': 'Bearer YOUR_TOKEN',
  },
});

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

### Python

```python
import requests

response = requests.get(
    'http://localhost:8000/api/v1/billing/plans/string',
    headers={
        'Authorization': 'Bearer YOUR_TOKEN',
    },
)
print(response.text)
```


## Delete existing plan

`DELETE /api/v1/billing/plans/{plan_id}`

Authentication (security requirement alternatives):

```json
[
  {
    "OAuth2PasswordBearer": []
  }
]
```

- OAuth2PasswordBearer: oauth2

Parameters:

- `plan_id` (path, string, required)
  Type: string

Responses:

- 202: Successful Response

Content type: application/json

Type: unknown

- 422: Validation Error

Content type: application/json

Type: object

Schema: [Backend_HTTPValidationError](/api-reference/schemas/backend-httpvalidationerror-b82f7839b1.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [Backend_ValidationError](/api-reference/schemas/backend-validationerror-b5b4376c23.md); Type: object

## Examples

### cURL

```bash
curl -X DELETE 'http://localhost:8000/api/v1/billing/plans/string' \
  -H 'Authorization: Bearer YOUR_TOKEN'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8000/api/v1/billing/plans/string', {
  method: 'DELETE',
  headers: {
    'Authorization': 'Bearer YOUR_TOKEN',
  },
});

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

### Python

```python
import requests

response = requests.delete(
    'http://localhost:8000/api/v1/billing/plans/string',
    headers={
        'Authorization': 'Bearer YOUR_TOKEN',
    },
)
print(response.text)
```


## Update a existing plan

`PATCH /api/v1/billing/plans/{plan_id}`

Authentication (security requirement alternatives):

```json
[
  {
    "OAuth2PasswordBearer": []
  }
]
```

- OAuth2PasswordBearer: oauth2

Parameters:

- `plan_id` (path, string, required)
  Type: string

Request body: application/json (required)

Type: object

Schema: [Backend_UpdatePlanDto](/api-reference/schemas/backend-updateplandto-2433de4034.md)

- `trial_period_days` (required)
  Type: integer

- `active` (optional)
  Type: boolean
  
  default: true

- `metadata` (optional)
  Type: unknown
  
  anyOf:
    Type: object
    
    Additional properties: true
  
    Type: null

Responses:

- 204: Successful Response

- 422: Validation Error

Content type: application/json

Type: object

Schema: [Backend_HTTPValidationError](/api-reference/schemas/backend-httpvalidationerror-b82f7839b1.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [Backend_ValidationError](/api-reference/schemas/backend-validationerror-b5b4376c23.md); Type: object

## Examples

### cURL

```bash
curl -X PATCH 'http://localhost:8000/api/v1/billing/plans/string' \
  -H 'Authorization: Bearer YOUR_TOKEN' \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "trial_period_days": 0,
  "active": true,
  "metadata": {}
}'
```

### JavaScript

```javascript
const body = `{
  "trial_period_days": 0,
  "active": true,
  "metadata": {}
}`;

const response = await fetch('http://localhost:8000/api/v1/billing/plans/string', {
  method: 'PATCH',
  headers: {
    'Authorization': 'Bearer YOUR_TOKEN',
    'Content-Type': 'application/json',
  },
  body,
});

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

### Python

```python
import requests

body = '''{
  "trial_period_days": 0,
  "active": true,
  "metadata": {}
}'''

response = requests.patch(
    'http://localhost:8000/api/v1/billing/plans/string',
    data=body.encode('utf-8'),
    headers={
        'Authorization': 'Bearer YOUR_TOKEN',
        'Content-Type': 'application/json',
    },
)
print(response.text)
```


## Create a Stripe SetupIntent for adding a payment method inline

`POST /api/v1/billing/payment-methods/setup-intent`

Returns a Stripe SetupIntent `client_secret`. The frontend uses this with
Stripe.js `confirmCardSetup()` to save a card without charging it.

Authentication (security requirement alternatives):

```json
[
  {
    "OAuth2PasswordBearer": []
  }
]
```

- OAuth2PasswordBearer: oauth2

Responses:

- 201: Successful Response

Content type: application/json

Type: object

Schema: [Backend_SetupIntentDto](/api-reference/schemas/backend-setupintentdto-cffd034048.md)

- `client_secret` (required)
  Type: string

- `setup_intent_id` (required)
  Type: string

## Examples

### cURL

```bash
curl -X POST 'http://localhost:8000/api/v1/billing/payment-methods/setup-intent' \
  -H 'Authorization: Bearer YOUR_TOKEN'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8000/api/v1/billing/payment-methods/setup-intent', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer YOUR_TOKEN',
  },
});

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

### Python

```python
import requests

response = requests.post(
    'http://localhost:8000/api/v1/billing/payment-methods/setup-intent',
    headers={
        'Authorization': 'Bearer YOUR_TOKEN',
    },
)
print(response.text)
```


## List saved payment methods for the current tenant

`GET /api/v1/billing/payment-methods`

Authentication (security requirement alternatives):

```json
[
  {
    "OAuth2PasswordBearer": []
  }
]
```

- OAuth2PasswordBearer: oauth2

Responses:

- 200: Successful Response

Content type: application/json

Type: object

Schema: [Backend_PaymentMethodListDto](/api-reference/schemas/backend-paymentmethodlistdto-e8814be407.md)

- `items` (required)
  Type: array
  
  Items:
    Reference: [Backend_PaymentMethodDto](/api-reference/schemas/backend-paymentmethoddto-e072310f2c.md); Type: object

- `customer_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

## Examples

### cURL

```bash
curl -X GET 'http://localhost:8000/api/v1/billing/payment-methods' \
  -H 'Authorization: Bearer YOUR_TOKEN'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8000/api/v1/billing/payment-methods', {
  method: 'GET',
  headers: {
    'Authorization': 'Bearer YOUR_TOKEN',
  },
});

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

### Python

```python
import requests

response = requests.get(
    'http://localhost:8000/api/v1/billing/payment-methods',
    headers={
        'Authorization': 'Bearer YOUR_TOKEN',
    },
)
print(response.text)
```


## Remove a saved payment method

`DELETE /api/v1/billing/payment-methods/{payment_method_id}`

Authentication (security requirement alternatives):

```json
[
  {
    "OAuth2PasswordBearer": []
  }
]
```

- OAuth2PasswordBearer: oauth2

Parameters:

- `payment_method_id` (path, string, required)
  Type: string

Responses:

- 202: Successful Response

Content type: application/json

Type: unknown

- 422: Validation Error

Content type: application/json

Type: object

Schema: [Backend_HTTPValidationError](/api-reference/schemas/backend-httpvalidationerror-b82f7839b1.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [Backend_ValidationError](/api-reference/schemas/backend-validationerror-b5b4376c23.md); Type: object

## Examples

### cURL

```bash
curl -X DELETE 'http://localhost:8000/api/v1/billing/payment-methods/string' \
  -H 'Authorization: Bearer YOUR_TOKEN'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8000/api/v1/billing/payment-methods/string', {
  method: 'DELETE',
  headers: {
    'Authorization': 'Bearer YOUR_TOKEN',
  },
});

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

### Python

```python
import requests

response = requests.delete(
    'http://localhost:8000/api/v1/billing/payment-methods/string',
    headers={
        'Authorization': 'Bearer YOUR_TOKEN',
    },
)
print(response.text)
```


## Set a payment method as the default for the tenant

`POST /api/v1/billing/payment-methods/{payment_method_id}/default`

Authentication (security requirement alternatives):

```json
[
  {
    "OAuth2PasswordBearer": []
  }
]
```

- OAuth2PasswordBearer: oauth2

Parameters:

- `payment_method_id` (path, string, required)
  Type: string

Responses:

- 204: Successful Response

- 422: Validation Error

Content type: application/json

Type: object

Schema: [Backend_HTTPValidationError](/api-reference/schemas/backend-httpvalidationerror-b82f7839b1.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [Backend_ValidationError](/api-reference/schemas/backend-validationerror-b5b4376c23.md); Type: object

## Examples

### cURL

```bash
curl -X POST 'http://localhost:8000/api/v1/billing/payment-methods/string/default' \
  -H 'Authorization: Bearer YOUR_TOKEN'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8000/api/v1/billing/payment-methods/string/default', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer YOUR_TOKEN',
  },
});

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

### Python

```python
import requests

response = requests.post(
    'http://localhost:8000/api/v1/billing/payment-methods/string/default',
    headers={
        'Authorization': 'Bearer YOUR_TOKEN',
    },
)
print(response.text)
```


## Sync tenant subscription with Stripe

`POST /api/v1/billing/sync`

Sync tenant subscription with Stripe.

Authentication (security requirement alternatives):

```json
[
  {
    "OAuth2PasswordBearer": []
  }
]
```

- OAuth2PasswordBearer: oauth2

Responses:

- 200: Successful Response

Content type: application/json

Type: unknown

## Examples

### cURL

```bash
curl -X POST 'http://localhost:8000/api/v1/billing/sync' \
  -H 'Authorization: Bearer YOUR_TOKEN'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8000/api/v1/billing/sync', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer YOUR_TOKEN',
  },
});

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

### Python

```python
import requests

response = requests.post(
    'http://localhost:8000/api/v1/billing/sync',
    headers={
        'Authorization': 'Bearer YOUR_TOKEN',
    },
)
print(response.text)
```


## Create native subscription intent (compatibility endpoint)

`POST /api/v1/billing/subscription/create-intent`

Create native subscription for tenant using Stripe Elements.

Authentication (security requirement alternatives):

```json
[
  {
    "OAuth2PasswordBearer": []
  }
]
```

- OAuth2PasswordBearer: oauth2

Request body: application/json (required)

Type: object

Schema: [Backend_CreateNativeSubscriptionRequestDto](/api-reference/schemas/backend-createnativesubscriptionrequestdto-355a817343.md)

- `price_id` (required)
  Type: string

- `tenant_id` (required)
  Type: string

- `mode` (optional)
  Type: string
  
  default: "subscription"
  
  enum: ["subscription","payment"]

- `email` (required)
  Type: string

Responses:

- 201: Successful Response

Content type: application/json

Type: object

Schema: [Backend_NativeSubscriptionResponseDto](/api-reference/schemas/backend-nativesubscriptionresponsedto-22bafd8b40.md)

- `client_secret` (required)
  Type: string

- `subscription_id` (required)
  Type: string

- `customer_id` (required)
  Type: string

- `billing_record_id` (required)
  Type: string

- `is_upgrade` (optional)
  Type: boolean
  
  default: false

- `requires_confirmation` (optional)
  Type: boolean
  
  default: true

- 422: Validation Error

Content type: application/json

Type: object

Schema: [Backend_HTTPValidationError](/api-reference/schemas/backend-httpvalidationerror-b82f7839b1.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [Backend_ValidationError](/api-reference/schemas/backend-validationerror-b5b4376c23.md); Type: object

## Examples

### cURL

```bash
curl -X POST 'http://localhost:8000/api/v1/billing/subscription/create-intent' \
  -H 'Authorization: Bearer YOUR_TOKEN' \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "price_id": "string",
  "tenant_id": "string",
  "mode": "subscription",
  "email": "string"
}'
```

### JavaScript

```javascript
const body = `{
  "price_id": "string",
  "tenant_id": "string",
  "mode": "subscription",
  "email": "string"
}`;

const response = await fetch('http://localhost:8000/api/v1/billing/subscription/create-intent', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer YOUR_TOKEN',
    'Content-Type': 'application/json',
  },
  body,
});

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

### Python

```python
import requests

body = '''{
  "price_id": "string",
  "tenant_id": "string",
  "mode": "subscription",
  "email": "string"
}'''

response = requests.post(
    'http://localhost:8000/api/v1/billing/subscription/create-intent',
    data=body.encode('utf-8'),
    headers={
        'Authorization': 'Bearer YOUR_TOKEN',
        'Content-Type': 'application/json',
    },
)
print(response.text)
```


## Create native subscription intent with Stripe Elements

`POST /api/v1/billing/native-subscription`

Create native subscription for tenant using Stripe Elements.

Authentication (security requirement alternatives):

```json
[
  {
    "OAuth2PasswordBearer": []
  }
]
```

- OAuth2PasswordBearer: oauth2

Request body: application/json (required)

Type: object

Schema: [Backend_CreateNativeSubscriptionRequestDto](/api-reference/schemas/backend-createnativesubscriptionrequestdto-355a817343.md)

- `price_id` (required)
  Type: string

- `tenant_id` (required)
  Type: string

- `mode` (optional)
  Type: string
  
  default: "subscription"
  
  enum: ["subscription","payment"]

- `email` (required)
  Type: string

Responses:

- 201: Successful Response

Content type: application/json

Type: object

Schema: [Backend_NativeSubscriptionResponseDto](/api-reference/schemas/backend-nativesubscriptionresponsedto-22bafd8b40.md)

- `client_secret` (required)
  Type: string

- `subscription_id` (required)
  Type: string

- `customer_id` (required)
  Type: string

- `billing_record_id` (required)
  Type: string

- `is_upgrade` (optional)
  Type: boolean
  
  default: false

- `requires_confirmation` (optional)
  Type: boolean
  
  default: true

- 422: Validation Error

Content type: application/json

Type: object

Schema: [Backend_HTTPValidationError](/api-reference/schemas/backend-httpvalidationerror-b82f7839b1.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [Backend_ValidationError](/api-reference/schemas/backend-validationerror-b5b4376c23.md); Type: object

## Examples

### cURL

```bash
curl -X POST 'http://localhost:8000/api/v1/billing/native-subscription' \
  -H 'Authorization: Bearer YOUR_TOKEN' \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "price_id": "string",
  "tenant_id": "string",
  "mode": "subscription",
  "email": "string"
}'
```

### JavaScript

```javascript
const body = `{
  "price_id": "string",
  "tenant_id": "string",
  "mode": "subscription",
  "email": "string"
}`;

const response = await fetch('http://localhost:8000/api/v1/billing/native-subscription', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer YOUR_TOKEN',
    'Content-Type': 'application/json',
  },
  body,
});

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

### Python

```python
import requests

body = '''{
  "price_id": "string",
  "tenant_id": "string",
  "mode": "subscription",
  "email": "string"
}'''

response = requests.post(
    'http://localhost:8000/api/v1/billing/native-subscription',
    data=body.encode('utf-8'),
    headers={
        'Authorization': 'Bearer YOUR_TOKEN',
        'Content-Type': 'application/json',
    },
)
print(response.text)
```


## Confirm native subscription (compatibility endpoint)

`POST /api/v1/billing/subscription/confirm`

Confirm native subscription: update billing record and sync tenant subscription with Stripe.

Authentication (security requirement alternatives):

```json
[
  {
    "OAuth2PasswordBearer": []
  }
]
```

- OAuth2PasswordBearer: oauth2

Request body: application/json (required)

Type: object

Schema: [Backend_ConfirmNativeSubscriptionRequestDto](/api-reference/schemas/backend-confirmnativesubscriptionrequestdto-c9b2ae4bcc.md)

- `billing_record_id` (required)
  Type: string

Responses:

- 200: Successful Response

Content type: application/json

Type: unknown

- 422: Validation Error

Content type: application/json

Type: object

Schema: [Backend_HTTPValidationError](/api-reference/schemas/backend-httpvalidationerror-b82f7839b1.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [Backend_ValidationError](/api-reference/schemas/backend-validationerror-b5b4376c23.md); Type: object

## Examples

### cURL

```bash
curl -X POST 'http://localhost:8000/api/v1/billing/subscription/confirm' \
  -H 'Authorization: Bearer YOUR_TOKEN' \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "billing_record_id": "string"
}'
```

### JavaScript

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

const response = await fetch('http://localhost:8000/api/v1/billing/subscription/confirm', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer YOUR_TOKEN',
    'Content-Type': 'application/json',
  },
  body,
});

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

### Python

```python
import requests

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

response = requests.post(
    'http://localhost:8000/api/v1/billing/subscription/confirm',
    data=body.encode('utf-8'),
    headers={
        'Authorization': 'Bearer YOUR_TOKEN',
        'Content-Type': 'application/json',
    },
)
print(response.text)
```


## Confirm native subscription and sync tenant data

`POST /api/v1/billing/native-subscription/confirm`

Confirm native subscription: update billing record and sync tenant subscription with Stripe.

Authentication (security requirement alternatives):

```json
[
  {
    "OAuth2PasswordBearer": []
  }
]
```

- OAuth2PasswordBearer: oauth2

Request body: application/json (required)

Type: object

Schema: [Backend_ConfirmNativeSubscriptionRequestDto](/api-reference/schemas/backend-confirmnativesubscriptionrequestdto-c9b2ae4bcc.md)

- `billing_record_id` (required)
  Type: string

Responses:

- 200: Successful Response

Content type: application/json

Type: unknown

- 422: Validation Error

Content type: application/json

Type: object

Schema: [Backend_HTTPValidationError](/api-reference/schemas/backend-httpvalidationerror-b82f7839b1.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [Backend_ValidationError](/api-reference/schemas/backend-validationerror-b5b4376c23.md); Type: object

## Examples

### cURL

```bash
curl -X POST 'http://localhost:8000/api/v1/billing/native-subscription/confirm' \
  -H 'Authorization: Bearer YOUR_TOKEN' \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "billing_record_id": "string"
}'
```

### JavaScript

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

const response = await fetch('http://localhost:8000/api/v1/billing/native-subscription/confirm', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer YOUR_TOKEN',
    'Content-Type': 'application/json',
  },
  body,
});

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

### Python

```python
import requests

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

response = requests.post(
    'http://localhost:8000/api/v1/billing/native-subscription/confirm',
    data=body.encode('utf-8'),
    headers={
        'Authorization': 'Bearer YOUR_TOKEN',
        'Content-Type': 'application/json',
    },
)
print(response.text)
```


## Create payment intent for incomplete subscription

`POST /api/v1/billing/subscription/complete-payment`

Create a payment intent for an incomplete subscription so the user can complete payment.

Authentication (security requirement alternatives):

```json
[
  {
    "OAuth2PasswordBearer": []
  }
]
```

- OAuth2PasswordBearer: oauth2

Request body: application/json (required)

Type: object

Schema: [Backend_CompleteIncompletePaymentRequestDto](/api-reference/schemas/backend-completeincompletepaymentrequestdto-fd9a34863a.md)

- `subscription_id` (required)
  Type: string

- `tenant_id` (required)
  Type: string

Responses:

- 201: Successful Response

Content type: application/json

Type: object

Schema: [Backend_NativeSubscriptionResponseDto](/api-reference/schemas/backend-nativesubscriptionresponsedto-22bafd8b40.md)

- `client_secret` (required)
  Type: string

- `subscription_id` (required)
  Type: string

- `customer_id` (required)
  Type: string

- `billing_record_id` (required)
  Type: string

- `is_upgrade` (optional)
  Type: boolean
  
  default: false

- `requires_confirmation` (optional)
  Type: boolean
  
  default: true

- 422: Validation Error

Content type: application/json

Type: object

Schema: [Backend_HTTPValidationError](/api-reference/schemas/backend-httpvalidationerror-b82f7839b1.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [Backend_ValidationError](/api-reference/schemas/backend-validationerror-b5b4376c23.md); Type: object

## Examples

### cURL

```bash
curl -X POST 'http://localhost:8000/api/v1/billing/subscription/complete-payment' \
  -H 'Authorization: Bearer YOUR_TOKEN' \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "subscription_id": "string",
  "tenant_id": "string"
}'
```

### JavaScript

```javascript
const body = `{
  "subscription_id": "string",
  "tenant_id": "string"
}`;

const response = await fetch('http://localhost:8000/api/v1/billing/subscription/complete-payment', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer YOUR_TOKEN',
    'Content-Type': 'application/json',
  },
  body,
});

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

### Python

```python
import requests

body = '''{
  "subscription_id": "string",
  "tenant_id": "string"
}'''

response = requests.post(
    'http://localhost:8000/api/v1/billing/subscription/complete-payment',
    data=body.encode('utf-8'),
    headers={
        'Authorization': 'Bearer YOUR_TOKEN',
        'Content-Type': 'application/json',
    },
)
print(response.text)
```


## Get current tenant subscription status

`GET /api/v1/billing/subscription/status`

Returns the current tenant's subscription status including dormant state.

Authentication (security requirement alternatives):

```json
[
  {
    "OAuth2PasswordBearer": []
  }
]
```

- OAuth2PasswordBearer: oauth2

Responses:

- 200: Successful Response

Content type: application/json

Type: unknown

## Examples

### cURL

```bash
curl -X GET 'http://localhost:8000/api/v1/billing/subscription/status' \
  -H 'Authorization: Bearer YOUR_TOKEN'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8000/api/v1/billing/subscription/status', {
  method: 'GET',
  headers: {
    'Authorization': 'Bearer YOUR_TOKEN',
  },
});

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

### Python

```python
import requests

response = requests.get(
    'http://localhost:8000/api/v1/billing/subscription/status',
    headers={
        'Authorization': 'Bearer YOUR_TOKEN',
    },
)
print(response.text)
```


## Downgrade dormant tenant to Free plan

`POST /api/v1/billing/subscription/downgrade-to-free`

Downgrade a dormant/expired tenant to the Free plan.
Cancels Stripe subscription but preserves all tenant data.

Authentication (security requirement alternatives):

```json
[
  {
    "OAuth2PasswordBearer": []
  }
]
```

- OAuth2PasswordBearer: oauth2

Responses:

- 200: Successful Response

Content type: application/json

Type: unknown

## Examples

### cURL

```bash
curl -X POST 'http://localhost:8000/api/v1/billing/subscription/downgrade-to-free' \
  -H 'Authorization: Bearer YOUR_TOKEN'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8000/api/v1/billing/subscription/downgrade-to-free', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer YOUR_TOKEN',
  },
});

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

### Python

```python
import requests

response = requests.post(
    'http://localhost:8000/api/v1/billing/subscription/downgrade-to-free',
    headers={
        'Authorization': 'Bearer YOUR_TOKEN',
    },
)
print(response.text)
```


## Stripe Webhook

`POST /api/v1/stripe/webhooks`

Authentication: no security requirement declared for this operation.

Responses:

- 200: Successful Response

Content type: application/json

Type: unknown

## Examples

### cURL

```bash
curl -X POST 'http://localhost:8000/api/v1/stripe/webhooks'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8000/api/v1/stripe/webhooks', {
  method: 'POST',
});

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

### Python

```python
import requests

response = requests.post('http://localhost:8000/api/v1/stripe/webhooks')
print(response.text)
```


## List invoices

`GET /api/v1/invoices`

Authentication (security requirement alternatives):

```json
[
  {
    "OAuth2PasswordBearer": []
  }
]
```

- OAuth2PasswordBearer: oauth2

Parameters:

- `skip` (query, integer, optional)
  Type: integer
  
  default: 0

- `limit` (query, integer, optional)
  Type: integer
  
  default: 10

- `search` (query, unknown, optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

Responses:

- 200: Successful Response

Content type: application/json

Type: object

Schema: [Backend_InvoiceListDto](/api-reference/schemas/backend-invoicelistdto-a5e37bf2bc.md)

- `items` (required)
  Type: array
  
  Items:
    Reference: [Backend_InvoiceDto](/api-reference/schemas/backend-invoicedto-1b8b9080ea.md); Type: object

- `total` (required)
  Type: integer

- `skip` (optional)
  Type: integer
  
  default: 0

- `limit` (optional)
  Type: integer
  
  default: 10

- `has_next` (optional)
  Type: boolean
  
  default: false

- `has_previous` (optional)
  Type: boolean
  
  default: false

- 422: Validation Error

Content type: application/json

Type: object

Schema: [Backend_HTTPValidationError](/api-reference/schemas/backend-httpvalidationerror-b82f7839b1.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [Backend_ValidationError](/api-reference/schemas/backend-validationerror-b5b4376c23.md); Type: object

## Examples

### cURL

```bash
curl -X GET 'http://localhost:8000/api/v1/invoices?skip=0&limit=10' \
  -H 'Authorization: Bearer YOUR_TOKEN'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8000/api/v1/invoices?skip=0&limit=10', {
  method: 'GET',
  headers: {
    'Authorization': 'Bearer YOUR_TOKEN',
  },
});

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

### Python

```python
import requests

response = requests.get(
    'http://localhost:8000/api/v1/invoices?skip=0&limit=10',
    headers={
        'Authorization': 'Bearer YOUR_TOKEN',
    },
)
print(response.text)
```


## List subscription history

`GET /api/v1/invoices/history`

Authentication (security requirement alternatives):

```json
[
  {
    "OAuth2PasswordBearer": []
  }
]
```

- OAuth2PasswordBearer: oauth2

Parameters:

- `skip` (query, integer, optional)
  Type: integer
  
  default: 0

- `limit` (query, integer, optional)
  Type: integer
  
  default: 10

- `search` (query, unknown, optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

Responses:

- 200: Successful Response

Content type: application/json

Type: object

Schema: [Backend_BillingRecordListDto](/api-reference/schemas/backend-billingrecordlistdto-f4e335d23c.md)

- `items` (required)
  Type: array
  
  Items:
    Reference: [Backend_BillingRecordDto](/api-reference/schemas/backend-billingrecorddto-b31535330f.md); Type: object

- `skip` (required)
  Type: integer

- `limit` (required)
  Type: integer

- `total` (required)
  Type: integer

- `has_previous` (required)
  Type: boolean

- `has_next` (required)
  Type: boolean

- 422: Validation Error

Content type: application/json

Type: object

Schema: [Backend_HTTPValidationError](/api-reference/schemas/backend-httpvalidationerror-b82f7839b1.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [Backend_ValidationError](/api-reference/schemas/backend-validationerror-b5b4376c23.md); Type: object

## Examples

### cURL

```bash
curl -X GET 'http://localhost:8000/api/v1/invoices/history?skip=0&limit=10' \
  -H 'Authorization: Bearer YOUR_TOKEN'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8000/api/v1/invoices/history?skip=0&limit=10', {
  method: 'GET',
  headers: {
    'Authorization': 'Bearer YOUR_TOKEN',
  },
});

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

### Python

```python
import requests

response = requests.get(
    'http://localhost:8000/api/v1/invoices/history?skip=0&limit=10',
    headers={
        'Authorization': 'Bearer YOUR_TOKEN',
    },
)
print(response.text)
```


## List tenant invoices

`GET /api/v1/invoices/tenant`

List invoices for the current tenant only, filtered by date range and status.

Authentication (security requirement alternatives):

```json
[
  {
    "OAuth2PasswordBearer": []
  }
]
```

- OAuth2PasswordBearer: oauth2

Parameters:

- `start_date` (query, string, optional)
  Type: string

- `end_date` (query, string, optional)
  Type: string

- `status` (query, string, optional)
  Type: string

- `skip` (query, integer, optional)
  Type: integer
  
  default: 0

- `limit` (query, integer, optional)
  Type: integer
  
  default: 20

- `search` (query, unknown, optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

Responses:

- 200: Successful Response

Content type: application/json

Type: object

Schema: [Backend_TenantInvoiceListDto](/api-reference/schemas/backend-tenantinvoicelistdto-d564a4d9d3.md)

- `items` (required)
  Type: array
  
  Items:
    Reference: [Backend_TenantInvoiceExportDto](/api-reference/schemas/backend-tenantinvoiceexportdto-341c930220.md); Type: object

- `total` (required)
  Type: integer

- `skip` (optional)
  Type: integer
  
  default: 0

- `limit` (optional)
  Type: integer
  
  default: 10

- `has_next` (optional)
  Type: boolean
  
  default: false

- `has_previous` (optional)
  Type: boolean
  
  default: false

- 422: Validation Error

Content type: application/json

Type: object

Schema: [Backend_HTTPValidationError](/api-reference/schemas/backend-httpvalidationerror-b82f7839b1.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [Backend_ValidationError](/api-reference/schemas/backend-validationerror-b5b4376c23.md); Type: object

## Examples

### cURL

```bash
curl -X GET 'http://localhost:8000/api/v1/invoices/tenant?skip=0&limit=20' \
  -H 'Authorization: Bearer YOUR_TOKEN'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8000/api/v1/invoices/tenant?skip=0&limit=20', {
  method: 'GET',
  headers: {
    'Authorization': 'Bearer YOUR_TOKEN',
  },
});

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

### Python

```python
import requests

response = requests.get(
    'http://localhost:8000/api/v1/invoices/tenant?skip=0&limit=20',
    headers={
        'Authorization': 'Bearer YOUR_TOKEN',
    },
)
print(response.text)
```


## Export tenant invoices as CSV

`GET /api/v1/invoices/tenant/export`

Export all tenant invoices as CSV for tax filing purposes.

Authentication (security requirement alternatives):

```json
[
  {
    "OAuth2PasswordBearer": []
  }
]
```

- OAuth2PasswordBearer: oauth2

Parameters:

- `start_date` (query, string, optional)
  Type: string

- `end_date` (query, string, optional)
  Type: string

- `status` (query, string, optional)
  Type: string

Responses:

- 200: Successful Response

Content type: application/json

Type: unknown

- 422: Validation Error

Content type: application/json

Type: object

Schema: [Backend_HTTPValidationError](/api-reference/schemas/backend-httpvalidationerror-b82f7839b1.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [Backend_ValidationError](/api-reference/schemas/backend-validationerror-b5b4376c23.md); Type: object

## Examples

### cURL

```bash
curl -X GET 'http://localhost:8000/api/v1/invoices/tenant/export' \
  -H 'Authorization: Bearer YOUR_TOKEN'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8000/api/v1/invoices/tenant/export', {
  method: 'GET',
  headers: {
    'Authorization': 'Bearer YOUR_TOKEN',
  },
});

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

### Python

```python
import requests

response = requests.get(
    'http://localhost:8000/api/v1/invoices/tenant/export',
    headers={
        'Authorization': 'Bearer YOUR_TOKEN',
    },
)
print(response.text)
```


## Create Host Checkout Session

`POST /api/v1/checkouts/host/{tenant_id}/tenant`

Authentication (security requirement alternatives):

```json
[
  {
    "OAuth2PasswordBearer": []
  }
]
```

- OAuth2PasswordBearer: oauth2

Request body: application/json (required)

Type: object

Schema: [Backend_CheckoutRequestDto](/api-reference/schemas/backend-checkoutrequestdto-481b5dd219.md)

- `price_id` (required)
  Type: string

- `tenant_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `mode` (optional)
  Type: string
  
  default: "subscription"
  
  enum: ["payment","subscription","setup"]

- `email` (required)
  Type: string, email

Responses:

- 200: Successful Response

Content type: application/json

Type: object

Schema: [Backend_CheckoutResponseDto](/api-reference/schemas/backend-checkoutresponsedto-4588ecfd01.md)

- `checkout_url` (required)
  Type: string

- 422: Validation Error

Content type: application/json

Type: object

Schema: [Backend_HTTPValidationError](/api-reference/schemas/backend-httpvalidationerror-b82f7839b1.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [Backend_ValidationError](/api-reference/schemas/backend-validationerror-b5b4376c23.md); Type: object

## Examples

### cURL

```bash
curl -X POST 'http://localhost:8000/api/v1/checkouts/host/%7Btenant_id%7D/tenant' \
  -H 'Authorization: Bearer YOUR_TOKEN' \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "price_id": "string",
  "tenant_id": "string",
  "mode": "subscription",
  "email": "user@example.com"
}'
```

### JavaScript

```javascript
const body = `{
  "price_id": "string",
  "tenant_id": "string",
  "mode": "subscription",
  "email": "user@example.com"
}`;

const response = await fetch('http://localhost:8000/api/v1/checkouts/host/%7Btenant_id%7D/tenant', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer YOUR_TOKEN',
    'Content-Type': 'application/json',
  },
  body,
});

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

### Python

```python
import requests

body = '''{
  "price_id": "string",
  "tenant_id": "string",
  "mode": "subscription",
  "email": "user@example.com"
}'''

response = requests.post(
    'http://localhost:8000/api/v1/checkouts/host/%7Btenant_id%7D/tenant',
    data=body.encode('utf-8'),
    headers={
        'Authorization': 'Bearer YOUR_TOKEN',
        'Content-Type': 'application/json',
    },
)
print(response.text)
```


## Create Tenant Subscription Checkout

`POST /api/v1/checkouts/tenant/subscription`

Create a Stripe checkout session for tenant subscription.
Uses host-level Stripe settings (NOT tenant-specific).
Host charges tenants for their subscriptions.

Authentication (security requirement alternatives):

```json
[
  {
    "OAuth2PasswordBearer": []
  }
]
```

- OAuth2PasswordBearer: oauth2

Request body: application/json (required)

Type: object

Schema: [Backend_CheckoutRequestDto](/api-reference/schemas/backend-checkoutrequestdto-481b5dd219.md)

- `price_id` (required)
  Type: string

- `tenant_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `mode` (optional)
  Type: string
  
  default: "subscription"
  
  enum: ["payment","subscription","setup"]

- `email` (required)
  Type: string, email

Responses:

- 200: Successful Response

Content type: application/json

Type: object

Schema: [Backend_CheckoutResponseDto](/api-reference/schemas/backend-checkoutresponsedto-4588ecfd01.md)

- `checkout_url` (required)
  Type: string

- 422: Validation Error

Content type: application/json

Type: object

Schema: [Backend_HTTPValidationError](/api-reference/schemas/backend-httpvalidationerror-b82f7839b1.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [Backend_ValidationError](/api-reference/schemas/backend-validationerror-b5b4376c23.md); Type: object

## Examples

### cURL

```bash
curl -X POST 'http://localhost:8000/api/v1/checkouts/tenant/subscription' \
  -H 'Authorization: Bearer YOUR_TOKEN' \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "price_id": "string",
  "tenant_id": "string",
  "mode": "subscription",
  "email": "user@example.com"
}'
```

### JavaScript

```javascript
const body = `{
  "price_id": "string",
  "tenant_id": "string",
  "mode": "subscription",
  "email": "user@example.com"
}`;

const response = await fetch('http://localhost:8000/api/v1/checkouts/tenant/subscription', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer YOUR_TOKEN',
    'Content-Type': 'application/json',
  },
  body,
});

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

### Python

```python
import requests

body = '''{
  "price_id": "string",
  "tenant_id": "string",
  "mode": "subscription",
  "email": "user@example.com"
}'''

response = requests.post(
    'http://localhost:8000/api/v1/checkouts/tenant/subscription',
    data=body.encode('utf-8'),
    headers={
        'Authorization': 'Bearer YOUR_TOKEN',
        'Content-Type': 'application/json',
    },
)
print(response.text)
```


## Host Checkout Success

`POST /api/v1/checkouts/host/payment/success`

Authentication (security requirement alternatives):

```json
[
  {
    "OAuth2PasswordBearer": []
  }
]
```

- OAuth2PasswordBearer: oauth2

Parameters:

- `session_id` (query, string, required)
  Type: string

- `tenant_id` (query, string, required)
  Type: string

Responses:

- 202: Successful Response

Content type: application/json

Type: unknown

- 422: Validation Error

Content type: application/json

Type: object

Schema: [Backend_HTTPValidationError](/api-reference/schemas/backend-httpvalidationerror-b82f7839b1.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [Backend_ValidationError](/api-reference/schemas/backend-validationerror-b5b4376c23.md); Type: object

## Examples

### cURL

```bash
curl -X POST 'http://localhost:8000/api/v1/checkouts/host/payment/success?session_id=string&tenant_id=string' \
  -H 'Authorization: Bearer YOUR_TOKEN'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8000/api/v1/checkouts/host/payment/success?session_id=string&tenant_id=string', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer YOUR_TOKEN',
  },
});

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

### Python

```python
import requests

response = requests.post(
    'http://localhost:8000/api/v1/checkouts/host/payment/success?session_id=string&tenant_id=string',
    headers={
        'Authorization': 'Bearer YOUR_TOKEN',
    },
)
print(response.text)
```


## Host Checkout Canceled

`POST /api/v1/checkouts/host/payment/cancel`

Authentication (security requirement alternatives):

```json
[
  {
    "OAuth2PasswordBearer": []
  }
]
```

- OAuth2PasswordBearer: oauth2

Parameters:

- `tenant_id` (query, string, required)
  Type: string

Responses:

- 202: Successful Response

Content type: application/json

Type: unknown

- 422: Validation Error

Content type: application/json

Type: object

Schema: [Backend_HTTPValidationError](/api-reference/schemas/backend-httpvalidationerror-b82f7839b1.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [Backend_ValidationError](/api-reference/schemas/backend-validationerror-b5b4376c23.md); Type: object

## Examples

### cURL

```bash
curl -X POST 'http://localhost:8000/api/v1/checkouts/host/payment/cancel?tenant_id=string' \
  -H 'Authorization: Bearer YOUR_TOKEN'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8000/api/v1/checkouts/host/payment/cancel?tenant_id=string', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer YOUR_TOKEN',
  },
});

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

### Python

```python
import requests

response = requests.post(
    'http://localhost:8000/api/v1/checkouts/host/payment/cancel?tenant_id=string',
    headers={
        'Authorization': 'Bearer YOUR_TOKEN',
    },
)
print(response.text)
```


## Tenant Checkout Success

`POST /api/v1/checkouts/tenant/payment/success`

Handle successful tenant subscription checkout.
Uses host-level Stripe settings.

Authentication (security requirement alternatives):

```json
[
  {
    "OAuth2PasswordBearer": []
  }
]
```

- OAuth2PasswordBearer: oauth2

Parameters:

- `session_id` (query, string, required)
  Type: string

Responses:

- 202: Successful Response

Content type: application/json

Type: unknown

- 422: Validation Error

Content type: application/json

Type: object

Schema: [Backend_HTTPValidationError](/api-reference/schemas/backend-httpvalidationerror-b82f7839b1.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [Backend_ValidationError](/api-reference/schemas/backend-validationerror-b5b4376c23.md); Type: object

## Examples

### cURL

```bash
curl -X POST 'http://localhost:8000/api/v1/checkouts/tenant/payment/success?session_id=string' \
  -H 'Authorization: Bearer YOUR_TOKEN'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8000/api/v1/checkouts/tenant/payment/success?session_id=string', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer YOUR_TOKEN',
  },
});

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

### Python

```python
import requests

response = requests.post(
    'http://localhost:8000/api/v1/checkouts/tenant/payment/success?session_id=string',
    headers={
        'Authorization': 'Bearer YOUR_TOKEN',
    },
)
print(response.text)
```


## Tenant Checkout Canceled

`POST /api/v1/checkouts/tenant/payment/cancel`

Handle cancelled tenant subscription checkout.

Authentication (security requirement alternatives):

```json
[
  {
    "OAuth2PasswordBearer": []
  }
]
```

- OAuth2PasswordBearer: oauth2

Responses:

- 202: Successful Response

Content type: application/json

Type: unknown

## Examples

### cURL

```bash
curl -X POST 'http://localhost:8000/api/v1/checkouts/tenant/payment/cancel' \
  -H 'Authorization: Bearer YOUR_TOKEN'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8000/api/v1/checkouts/tenant/payment/cancel', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer YOUR_TOKEN',
  },
});

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

### Python

```python
import requests

response = requests.post(
    'http://localhost:8000/api/v1/checkouts/tenant/payment/cancel',
    headers={
        'Authorization': 'Bearer YOUR_TOKEN',
    },
)
print(response.text)
```


## List Checkout Records

`GET /api/v1/checkouts/all`

Authentication (security requirement alternatives):

```json
[
  {
    "OAuth2PasswordBearer": []
  }
]
```

- OAuth2PasswordBearer: oauth2

Parameters:

- `skip` (query, integer, optional)
  Type: integer
  
  default: 0

- `limit` (query, integer, optional)
  Type: integer
  
  default: 100

- `search` (query, unknown, optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

Responses:

- 200: Successful Response

Content type: application/json

Type: object

Schema: [Backend_BillingRecordListDto](/api-reference/schemas/backend-billingrecordlistdto-f4e335d23c.md)

- `items` (required)
  Type: array
  
  Items:
    Reference: [Backend_BillingRecordDto](/api-reference/schemas/backend-billingrecorddto-b31535330f.md); Type: object

- `skip` (required)
  Type: integer

- `limit` (required)
  Type: integer

- `total` (required)
  Type: integer

- `has_previous` (required)
  Type: boolean

- `has_next` (required)
  Type: boolean

- 422: Validation Error

Content type: application/json

Type: object

Schema: [Backend_HTTPValidationError](/api-reference/schemas/backend-httpvalidationerror-b82f7839b1.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [Backend_ValidationError](/api-reference/schemas/backend-validationerror-b5b4376c23.md); Type: object

## Examples

### cURL

```bash
curl -X GET 'http://localhost:8000/api/v1/checkouts/all?skip=0&limit=100' \
  -H 'Authorization: Bearer YOUR_TOKEN'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8000/api/v1/checkouts/all?skip=0&limit=100', {
  method: 'GET',
  headers: {
    'Authorization': 'Bearer YOUR_TOKEN',
  },
});

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

### Python

```python
import requests

response = requests.get(
    'http://localhost:8000/api/v1/checkouts/all?skip=0&limit=100',
    headers={
        'Authorization': 'Bearer YOUR_TOKEN',
    },
)
print(response.text)
```


## Get Notification Banner

`GET /api/v1/notifications/banner`

Get the current notification banner information.

Authentication: no security requirement declared for this operation.

Responses:

- 200: Successful Response

Content type: application/json

Type: object

Schema: [Backend_NotificationBannerSettingDto](/api-reference/schemas/backend-notificationbannersettingdto-28e88cbb83.md)

- `is_enabled` (required)
  Type: boolean

- `message` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `id` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `tenant_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `created_at` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `updated_at` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

## Examples

### cURL

```bash
curl -X GET 'http://localhost:8000/api/v1/notifications/banner'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8000/api/v1/notifications/banner', {
  method: 'GET',
});

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

### Python

```python
import requests

response = requests.get('http://localhost:8000/api/v1/notifications/banner')
print(response.text)
```


## Create Notification Banner

`POST /api/v1/notifications/banner`

Create a new notification banner setting.

Authentication (security requirement alternatives):

```json
[
  {
    "OAuth2PasswordBearer": []
  }
]
```

- OAuth2PasswordBearer: oauth2

Request body: application/json (required)

Type: object

Schema: [Backend_CreateNotificationBannerSettingDto](/api-reference/schemas/backend-createnotificationbannersettingdto-c10872f428.md)

- `is_enabled` (required)
  Type: boolean

- `message` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

Responses:

- 201: Successful Response

Content type: application/json

Type: unknown

- 422: Validation Error

Content type: application/json

Type: object

Schema: [Backend_HTTPValidationError](/api-reference/schemas/backend-httpvalidationerror-b82f7839b1.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [Backend_ValidationError](/api-reference/schemas/backend-validationerror-b5b4376c23.md); Type: object

## Examples

### cURL

```bash
curl -X POST 'http://localhost:8000/api/v1/notifications/banner' \
  -H 'Authorization: Bearer YOUR_TOKEN' \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "is_enabled": true,
  "message": "string"
}'
```

### JavaScript

```javascript
const body = `{
  "is_enabled": true,
  "message": "string"
}`;

const response = await fetch('http://localhost:8000/api/v1/notifications/banner', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer YOUR_TOKEN',
    'Content-Type': 'application/json',
  },
  body,
});

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

### Python

```python
import requests

body = '''{
  "is_enabled": true,
  "message": "string"
}'''

response = requests.post(
    'http://localhost:8000/api/v1/notifications/banner',
    data=body.encode('utf-8'),
    headers={
        'Authorization': 'Bearer YOUR_TOKEN',
        'Content-Type': 'application/json',
    },
)
print(response.text)
```


## Update Notification Banner

`PUT /api/v1/notifications/banner/{id}`

Update an existing notification banner setting.

Authentication (security requirement alternatives):

```json
[
  {
    "OAuth2PasswordBearer": []
  }
]
```

- OAuth2PasswordBearer: oauth2

Parameters:

- `id` (path, string, required)
  Type: string

Request body: application/json (required)

Type: object

Schema: [Backend_CreateNotificationBannerSettingDto](/api-reference/schemas/backend-createnotificationbannersettingdto-c10872f428.md)

- `is_enabled` (required)
  Type: boolean

- `message` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

Responses:

- 204: Successful Response

- 422: Validation Error

Content type: application/json

Type: object

Schema: [Backend_HTTPValidationError](/api-reference/schemas/backend-httpvalidationerror-b82f7839b1.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [Backend_ValidationError](/api-reference/schemas/backend-validationerror-b5b4376c23.md); Type: object

## Examples

### cURL

```bash
curl -X PUT 'http://localhost:8000/api/v1/notifications/banner/string' \
  -H 'Authorization: Bearer YOUR_TOKEN' \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "is_enabled": true,
  "message": "string"
}'
```

### JavaScript

```javascript
const body = `{
  "is_enabled": true,
  "message": "string"
}`;

const response = await fetch('http://localhost:8000/api/v1/notifications/banner/string', {
  method: 'PUT',
  headers: {
    'Authorization': 'Bearer YOUR_TOKEN',
    'Content-Type': 'application/json',
  },
  body,
});

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

### Python

```python
import requests

body = '''{
  "is_enabled": true,
  "message": "string"
}'''

response = requests.put(
    'http://localhost:8000/api/v1/notifications/banner/string',
    data=body.encode('utf-8'),
    headers={
        'Authorization': 'Bearer YOUR_TOKEN',
        'Content-Type': 'application/json',
    },
)
print(response.text)
```


## List Audit Logs

`GET /api/v1/audit/logs`

Also served by Audit Service at http://localhost:8013.

Authentication (security requirement alternatives):

```json
[
  {
    "OAuth2PasswordBearer": []
  }
]
```

- OAuth2PasswordBearer: oauth2

Parameters:

- `limit` (query, integer, optional)
  Type: integer
  
  default: 10

- `skip` (query, integer, optional)
  Type: integer
  
  default: 0

- `action` (query, unknown, optional)
  Type: unknown
  
  anyOf:
    Type: string
    
    enum: ["create","update","delete","read","login","logout","error","download"]
  
    Type: null

- `search` (query, unknown, optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `user_id` (query, unknown, optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `service_name` (query, unknown, optional) - Filter by service name
  Type: unknown
  
  Filter by service name
  
  anyOf:
    Type: string
  
    Type: null

- `resource_type` (query, unknown, optional) - Filter by resource type
  Type: unknown
  
  Filter by resource type
  
  anyOf:
    Type: string
  
    Type: null

- `category` (query, unknown, optional) - Filter by event category
  Type: unknown
  
  Filter by event category
  
  anyOf:
    Type: string
  
    Type: null

- `date_from` (query, unknown, optional) - Filter from date (ISO format)
  Type: unknown
  
  Filter from date (ISO format)
  
  anyOf:
    Type: string
  
    Type: null

- `date_to` (query, unknown, optional) - Filter to date (ISO format)
  Type: unknown
  
  Filter to date (ISO format)
  
  anyOf:
    Type: string
  
    Type: null

Responses:

- 200: Successful Response

Content type: application/json

Type: object

Schema: [Backend_AuditLogListDto](/api-reference/schemas/backend-auditloglistdto-38ea4dd52f.md)

- `total` (required)
  Type: integer

- `items` (required)
  Type: array
  
  Items:
    Reference: [Backend_AuditLogDto](/api-reference/schemas/backend-auditlogdto-5cac555828.md); Type: object

- `has_next` (required)
  Type: boolean

- `has_previous` (required)
  Type: boolean

- `limit` (required)
  Type: integer

- `skip` (required)
  Type: integer

- 422: Validation Error

Content type: application/json

Type: object

Schema: [Backend_HTTPValidationError](/api-reference/schemas/backend-httpvalidationerror-b82f7839b1.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [Backend_ValidationError](/api-reference/schemas/backend-validationerror-b5b4376c23.md); Type: object

## Examples

### cURL

```bash
curl -X GET 'http://localhost:8000/api/v1/audit/logs?limit=10&skip=0' \
  -H 'Authorization: Bearer YOUR_TOKEN'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8000/api/v1/audit/logs?limit=10&skip=0', {
  method: 'GET',
  headers: {
    'Authorization': 'Bearer YOUR_TOKEN',
  },
});

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

### Python

```python
import requests

response = requests.get(
    'http://localhost:8000/api/v1/audit/logs?limit=10&skip=0',
    headers={
        'Authorization': 'Bearer YOUR_TOKEN',
    },
)
print(response.text)
```


## Ingest Audit Log

`POST /api/v1/audit/logs`

Ingest a new audit log entry.

Authentication (security requirement alternatives):

```json
[
  {
    "HTTPBearer": []
  }
]
```

- HTTPBearer: http (bearer)

Request body: application/json (required)

Type: object

Schema: [AuditService_AuditLogCreateRequest](/api-reference/schemas/auditservice-auditlogcreaterequest-190eafb833.md)

Example:

```json
{
  "action": "create",
  "actor_email": "admin@acme.org",
  "actor_id": "550e8400-e29b-41d4-a716-446655440001",
  "actor_type": "admin",
  "data_classification": "internal",
  "duration_ms": 45,
  "event_id": "550e8400-e29b-41d4-a716-446655440000",
  "event_type": "user.created",
  "http_method": "POST",
  "http_path": "/api/v1/users",
  "http_status": 201,
  "ip_address": "192.168.1.1",
  "log_schema_version": "1.0",
  "metadata": {
    "role": "viewer"
  },
  "request_id": "req-12345678",
  "resource_id": "550e8400-e29b-41d4-a716-446655440003",
  "resource_type": "User",
  "service_name": "backend",
  "status": "success",
  "tenant_id": "550e8400-e29b-41d4-a716-446655440002",
  "trace_id": "trace-12345678"
}
```

- `event_id` (optional)
  Type: unknown
  
  Unique event ID for idempotency
  
  anyOf:
    Type: string
  
    Type: null

- `event_type` (optional)
  Type: unknown
  
  Type of event (e.g., user.created)
  
  anyOf:
    Type: string
  
    Type: null

- `log_schema_version` (optional)
  Type: unknown
  
  Schema version
  
  default: "1.0"
  
  anyOf:
    Type: string
  
    Type: null

- `service_name` (required)
  Type: string
  
  Name of the service producing the event

- `action` (required)
  Type: string
  
  Action performed (create, update, delete, read, login, etc.)

- `actor_type` (optional)
  Type: unknown
  
  Type of actor
  
  anyOf:
    Type: string
    
    enum: ["user","admin","system","interviewer","supervisor"]
  
    Type: null

- `actor_id` (optional)
  Type: unknown
  
  ID of the actor
  
  anyOf:
    Type: string
  
    Type: null

- `actor_email` (optional)
  Type: unknown
  
  Email of the actor
  
  anyOf:
    Type: string
  
    Type: null

- `actor_name` (optional)
  Type: unknown
  
  Display name of the actor
  
  anyOf:
    Type: string
  
    Type: null

- `tenant_id` (optional)
  Type: unknown
  
  Tenant ID
  
  anyOf:
    Type: string
  
    Type: null

- `tenant_name` (optional)
  Type: unknown
  
  Display name of the tenant
  
  anyOf:
    Type: string
  
    Type: null

- `resource_type` (optional)
  Type: unknown
  
  Type of resource
  
  anyOf:
    Type: string
  
    Type: null

- `resource_id` (optional)
  Type: unknown
  
  ID of the resource
  
  anyOf:
    Type: string
  
    Type: null

- `resource_name` (optional)
  Type: unknown
  
  Display name of the resource
  
  anyOf:
    Type: string
  
    Type: null

- `status` (optional)
  Type: unknown
  
  Event status
  
  default: "success"
  
  anyOf:
    Type: string
    
    enum: ["success","failure","error"]
  
    Type: null

- `category` (optional)
  Type: unknown
  
  Event category for filtering
  
  anyOf:
    Type: string
    
    enum: ["AUTHENTICATION","USER_MANAGEMENT","ROLE_ACCESS","SURVEY_LIFECYCLE","RESPONSE_DATA","INTERVIEW","CONSENT","EXPORT","INTEGRATION","SYNC","MEDIA","CONFIGURATION","SECURITY","SYSTEM","REVIEW","NOTIFICATION","COMPLIANCE"]
  
    Type: null

- `severity` (optional)
  Type: unknown
  
  Event severity level
  
  default: "INFO"
  
  anyOf:
    Type: string
    
    enum: ["INFO","WARNING","CRITICAL"]
  
    Type: null

- `description` (optional)
  Type: unknown
  
  Human-readable event description
  
  anyOf:
    Type: string
  
    Type: null

- `failure_reason` (optional)
  Type: unknown
  
  Reason for failure if status is failure/error
  
  anyOf:
    Type: string
  
    Type: null

- `correlation_id` (optional)
  Type: unknown
  
  Cross-service correlation ID
  
  anyOf:
    Type: string
  
    Type: null

- `ip_address` (optional)
  Type: unknown
  
  Client IP address
  
  anyOf:
    Type: string
  
    Type: null

- `user_agent` (optional)
  Type: unknown
  
  Client user agent
  
  anyOf:
    Type: string
  
    Type: null

- `request_id` (optional)
  Type: unknown
  
  Request ID for correlation
  
  anyOf:
    Type: string
  
    Type: null

- `trace_id` (optional)
  Type: unknown
  
  Trace ID for cross-service correlation
  
  anyOf:
    Type: string
  
    Type: null

- `parent_trace_id` (optional)
  Type: unknown
  
  Parent trace ID
  
  anyOf:
    Type: string
  
    Type: null

- `http_method` (optional)
  Type: unknown
  
  HTTP method
  
  anyOf:
    Type: string
  
    Type: null

- `http_path` (optional)
  Type: unknown
  
  HTTP path
  
  anyOf:
    Type: string
  
    Type: null

- `http_status` (optional)
  Type: unknown
  
  HTTP status code
  
  anyOf:
    Type: integer
  
    Type: null

- `duration_ms` (optional)
  Type: unknown
  
  Request duration in milliseconds
  
  anyOf:
    Type: integer
  
    Type: null

- `metadata` (optional)
  Type: unknown
  
  Additional event metadata
  
  anyOf:
    Type: object
    
    Additional properties: true
  
    Type: null

- `event_idempotency_key` (optional)
  Type: unknown
  
  Key for deduplication
  
  anyOf:
    Type: string
  
    Type: null

- `data_classification` (optional)
  Type: unknown
  
  Data classification level
  
  default: "internal"
  
  anyOf:
    Type: string
    
    enum: ["public","internal","sensitive","restricted"]
  
    Type: null

Responses:

- 201: Successful Response

Content type: application/json

Type: object

Schema: [AuditService_AuditLogResponse](/api-reference/schemas/auditservice-auditlogresponse-a136345fdc.md)

- `id` (required)
  Type: string

- `event_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `event_type` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `log_schema_version` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `service_name` (required)
  Type: string

- `action` (required)
  Type: string

- `actor_type` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `actor_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `actor_email` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `actor_name` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `tenant_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `tenant_name` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `resource_type` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `resource_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `resource_name` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `status` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `category` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `severity` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `description` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `failure_reason` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `correlation_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `ip_address` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `user_agent` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `request_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `trace_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `parent_trace_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `http_method` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `http_path` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `http_status` (optional)
  Type: unknown
  
  anyOf:
    Type: integer
  
    Type: null

- `duration_ms` (optional)
  Type: unknown
  
  anyOf:
    Type: integer
  
    Type: null

- `metadata` (optional)
  Type: unknown
  
  anyOf:
    Type: object
    
    Additional properties: true
  
    Type: null

- `data_classification` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `checksum` (required)
  Type: string

- `created_at` (required)
  Type: string

- 422: Validation Error

Content type: application/json

Type: object

Schema: [AuditService_HTTPValidationError](/api-reference/schemas/auditservice-httpvalidationerror-3f968f5485.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [AuditService_ValidationError](/api-reference/schemas/auditservice-validationerror-e7f58675b6.md); Type: object

## Examples

### cURL

```bash
curl -X POST 'http://localhost:8013/api/v1/audit/logs' \
  -H 'Authorization: Bearer YOUR_TOKEN' \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "action": "create",
  "actor_email": "admin@acme.org",
  "actor_id": "550e8400-e29b-41d4-a716-446655440001",
  "actor_type": "admin",
  "data_classification": "internal",
  "duration_ms": 45,
  "event_id": "550e8400-e29b-41d4-a716-446655440000",
  "event_type": "user.created",
  "http_method": "POST",
  "http_path": "/api/v1/users",
  "http_status": 201,
  "ip_address": "192.168.1.1",
  "log_schema_version": "1.0",
  "metadata": {
    "role": "viewer"
  },
  "request_id": "req-12345678",
  "resource_id": "550e8400-e29b-41d4-a716-446655440003",
  "resource_type": "User",
  "service_name": "backend",
  "status": "success",
  "tenant_id": "550e8400-e29b-41d4-a716-446655440002",
  "trace_id": "trace-12345678"
}'
```

### JavaScript

```javascript
const body = `{
  "action": "create",
  "actor_email": "admin@acme.org",
  "actor_id": "550e8400-e29b-41d4-a716-446655440001",
  "actor_type": "admin",
  "data_classification": "internal",
  "duration_ms": 45,
  "event_id": "550e8400-e29b-41d4-a716-446655440000",
  "event_type": "user.created",
  "http_method": "POST",
  "http_path": "/api/v1/users",
  "http_status": 201,
  "ip_address": "192.168.1.1",
  "log_schema_version": "1.0",
  "metadata": {
    "role": "viewer"
  },
  "request_id": "req-12345678",
  "resource_id": "550e8400-e29b-41d4-a716-446655440003",
  "resource_type": "User",
  "service_name": "backend",
  "status": "success",
  "tenant_id": "550e8400-e29b-41d4-a716-446655440002",
  "trace_id": "trace-12345678"
}`;

const response = await fetch('http://localhost:8013/api/v1/audit/logs', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer YOUR_TOKEN',
    'Content-Type': 'application/json',
  },
  body,
});

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

### Python

```python
import requests

body = '''{
  "action": "create",
  "actor_email": "admin@acme.org",
  "actor_id": "550e8400-e29b-41d4-a716-446655440001",
  "actor_type": "admin",
  "data_classification": "internal",
  "duration_ms": 45,
  "event_id": "550e8400-e29b-41d4-a716-446655440000",
  "event_type": "user.created",
  "http_method": "POST",
  "http_path": "/api/v1/users",
  "http_status": 201,
  "ip_address": "192.168.1.1",
  "log_schema_version": "1.0",
  "metadata": {
    "role": "viewer"
  },
  "request_id": "req-12345678",
  "resource_id": "550e8400-e29b-41d4-a716-446655440003",
  "resource_type": "User",
  "service_name": "backend",
  "status": "success",
  "tenant_id": "550e8400-e29b-41d4-a716-446655440002",
  "trace_id": "trace-12345678"
}'''

response = requests.post(
    'http://localhost:8013/api/v1/audit/logs',
    data=body.encode('utf-8'),
    headers={
        'Authorization': 'Bearer YOUR_TOKEN',
        'Content-Type': 'application/json',
    },
)
print(response.text)
```


## Download Audit Logs

`POST /api/v1/audit-logs/download`

Authentication (security requirement alternatives):

```json
[
  {
    "OAuth2PasswordBearer": []
  }
]
```

- OAuth2PasswordBearer: oauth2

Request body: application/json (required)

Type: object

Schema: [Backend_DownloadAuditRequestDto](/api-reference/schemas/backend-downloadauditrequestdto-c5e1bd9710.md)

- `action` (optional)
  Type: unknown
  
  anyOf:
    Type: string
    
    enum: ["create","update","delete","read","login","logout","error","download"]
  
    Type: null

- `total_records` (required)
  Type: integer

Responses:

- 202: Successful Response

Content type: application/json

Type: object

Schema: [Backend_DownloadResponseDto](/api-reference/schemas/backend-downloadresponsedto-f11523e62f.md)

- `message` (required)
  Type: string

- 422: Validation Error

Content type: application/json

Type: object

Schema: [Backend_HTTPValidationError](/api-reference/schemas/backend-httpvalidationerror-b82f7839b1.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [Backend_ValidationError](/api-reference/schemas/backend-validationerror-b5b4376c23.md); Type: object

## Examples

### cURL

```bash
curl -X POST 'http://localhost:8000/api/v1/audit-logs/download' \
  -H 'Authorization: Bearer YOUR_TOKEN' \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "action": "create",
  "total_records": 0
}'
```

### JavaScript

```javascript
const body = `{
  "action": "create",
  "total_records": 0
}`;

const response = await fetch('http://localhost:8000/api/v1/audit-logs/download', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer YOUR_TOKEN',
    'Content-Type': 'application/json',
  },
  body,
});

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

### Python

```python
import requests

body = '''{
  "action": "create",
  "total_records": 0
}'''

response = requests.post(
    'http://localhost:8000/api/v1/audit-logs/download',
    data=body.encode('utf-8'),
    headers={
        'Authorization': 'Bearer YOUR_TOKEN',
        'Content-Type': 'application/json',
    },
)
print(response.text)
```


## Get User Activity Logs

`GET /api/v1/users/{user_id}/activity-logs`

Authentication (security requirement alternatives):

```json
[
  {
    "OAuth2PasswordBearer": []
  }
]
```

- OAuth2PasswordBearer: oauth2

Parameters:

- `user_id` (path, string, required)
  Type: string

- `limit` (query, integer, optional)
  Type: integer
  
  default: 10

- `skip` (query, integer, optional)
  Type: integer
  
  default: 0

- `action` (query, unknown, optional)
  Type: unknown
  
  anyOf:
    Type: string
    
    enum: ["create","update","delete","read","login","logout","error","download"]
  
    Type: null

- `category` (query, unknown, optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `search` (query, unknown, optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `date_from` (query, unknown, optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `date_to` (query, unknown, optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

Responses:

- 200: Successful Response

Content type: application/json

Type: object

Schema: [Backend_AuditLogListDto](/api-reference/schemas/backend-auditloglistdto-38ea4dd52f.md)

- `total` (required)
  Type: integer

- `items` (required)
  Type: array
  
  Items:
    Reference: [Backend_AuditLogDto](/api-reference/schemas/backend-auditlogdto-5cac555828.md); Type: object

- `has_next` (required)
  Type: boolean

- `has_previous` (required)
  Type: boolean

- `limit` (required)
  Type: integer

- `skip` (required)
  Type: integer

- 422: Validation Error

Content type: application/json

Type: object

Schema: [Backend_HTTPValidationError](/api-reference/schemas/backend-httpvalidationerror-b82f7839b1.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [Backend_ValidationError](/api-reference/schemas/backend-validationerror-b5b4376c23.md); Type: object

## Examples

### cURL

```bash
curl -X GET 'http://localhost:8000/api/v1/users/string/activity-logs?limit=10&skip=0' \
  -H 'Authorization: Bearer YOUR_TOKEN'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8000/api/v1/users/string/activity-logs?limit=10&skip=0', {
  method: 'GET',
  headers: {
    'Authorization': 'Bearer YOUR_TOKEN',
  },
});

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

### Python

```python
import requests

response = requests.get(
    'http://localhost:8000/api/v1/users/string/activity-logs?limit=10&skip=0',
    headers={
        'Authorization': 'Bearer YOUR_TOKEN',
    },
)
print(response.text)
```


## Create Frontend Log

`POST /api/v1/frontend-logs`

Receive frontend log entry and write to frontend/logs directory.

This endpoint accepts logs from the frontend and stores them in:
- frontend/logs/frontend-all.log (all logs)
- frontend/logs/frontend-errors.log (ERROR and FATAL only)

Logs are stored in JSON Lines format (one JSON object per line).

Authentication: no security requirement declared for this operation.

Request body: application/json (required)

Type: object

Frontend log entry model

Schema: [Backend_FrontendLogEntry](/api-reference/schemas/backend-frontendlogentry-306ecae18a.md)

- `timestamp` (required)
  Type: string

- `level` (required)
  Type: string

- `message` (required)
  Type: string

- `context` (optional)
  Type: unknown
  
  anyOf:
    Type: object
    
    Additional properties: true
  
    Type: null

- `stack` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `userAgent` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `url` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `userId` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `tenantId` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

Responses:

- 201: Successful Response

Content type: application/json

Type: unknown

- 422: Validation Error

Content type: application/json

Type: object

Schema: [Backend_HTTPValidationError](/api-reference/schemas/backend-httpvalidationerror-b82f7839b1.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [Backend_ValidationError](/api-reference/schemas/backend-validationerror-b5b4376c23.md); Type: object

## Examples

### cURL

```bash
curl -X POST 'http://localhost:8000/api/v1/frontend-logs' \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "timestamp": "string",
  "level": "string",
  "message": "string",
  "context": {},
  "stack": "string",
  "userAgent": "string",
  "url": "string",
  "userId": "string",
  "tenantId": "string"
}'
```

### JavaScript

```javascript
const body = `{
  "timestamp": "string",
  "level": "string",
  "message": "string",
  "context": {},
  "stack": "string",
  "userAgent": "string",
  "url": "string",
  "userId": "string",
  "tenantId": "string"
}`;

const response = await fetch('http://localhost:8000/api/v1/frontend-logs', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
  },
  body,
});

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

### Python

```python
import requests

body = '''{
  "timestamp": "string",
  "level": "string",
  "message": "string",
  "context": {},
  "stack": "string",
  "userAgent": "string",
  "url": "string",
  "userId": "string",
  "tenantId": "string"
}'''

response = requests.post(
    'http://localhost:8000/api/v1/frontend-logs',
    data=body.encode('utf-8'),
    headers={
        'Content-Type': 'application/json',
    },
)
print(response.text)
```


## Health Check

`GET /api/v1/frontend-logs/health`

Health check for frontend logging endpoint

Authentication: no security requirement declared for this operation.

Responses:

- 200: Successful Response

Content type: application/json

Type: unknown

## Examples

### cURL

```bash
curl -X GET 'http://localhost:8000/api/v1/frontend-logs/health'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8000/api/v1/frontend-logs/health', {
  method: 'GET',
});

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

### Python

```python
import requests

response = requests.get('http://localhost:8000/api/v1/frontend-logs/health')
print(response.text)
```


## Ingest Audit Event

`POST /api/v1/frontend-audit/logs`

Relay a client-originated audit event to the centralized audit-service.

The browser cannot call the audit-service's internal-only ingest endpoint
(service_only=True). This endpoint accepts authenticated user events and
forwards them with the backend's service token, pinning the actor to the
authenticated user so clients cannot forge audit entries.

Authentication (security requirement alternatives):

```json
[
  {
    "OAuth2PasswordBearer": []
  }
]
```

- OAuth2PasswordBearer: oauth2

Request body: application/json (required)

Type: object

Client-originated audit event relayed to the centralized audit-service.

Mirrors the schema the browser sends via the generated AuditLogsService
(createAuditLog). Unknown fields are preserved (extra="allow") so the relay
forwards the payload faithfully to the audit-service, which owns validation.

Schema: [Backend_AuditEventIngestRequest](/api-reference/schemas/backend-auditeventingestrequest-5835f9775d.md)

- `event_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `event_type` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `log_schema_version` (optional)
  Type: unknown
  
  default: "1.0"
  
  anyOf:
    Type: string
  
    Type: null

- `service_name` (optional)
  Type: string
  
  default: "frontend"

- `action` (required)
  Type: string

- `actor_type` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `actor_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `actor_email` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `tenant_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `resource_type` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `resource_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `status` (optional)
  Type: unknown
  
  default: "success"
  
  anyOf:
    Type: string
  
    Type: null

- `ip_address` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `user_agent` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `request_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `trace_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `parent_trace_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `http_method` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `http_path` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `http_status` (optional)
  Type: unknown
  
  anyOf:
    Type: integer
  
    Type: null

- `duration_ms` (optional)
  Type: unknown
  
  anyOf:
    Type: integer
  
    Type: null

- `metadata` (optional)
  Type: unknown
  
  anyOf:
    Type: object
    
    Additional properties: true
  
    Type: null

- `event_idempotency_key` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `data_classification` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

Additional properties: true

Responses:

- 201: Successful Response

Content type: application/json

Type: unknown

- 422: Validation Error

Content type: application/json

Type: object

Schema: [Backend_HTTPValidationError](/api-reference/schemas/backend-httpvalidationerror-b82f7839b1.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [Backend_ValidationError](/api-reference/schemas/backend-validationerror-b5b4376c23.md); Type: object

## Examples

### cURL

```bash
curl -X POST 'http://localhost:8000/api/v1/frontend-audit/logs' \
  -H 'Authorization: Bearer YOUR_TOKEN' \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "event_id": "string",
  "event_type": "string",
  "log_schema_version": "1.0",
  "service_name": "frontend",
  "action": "string",
  "actor_type": "string",
  "actor_id": "string",
  "actor_email": "string",
  "tenant_id": "string",
  "resource_type": "string",
  "resource_id": "string",
  "status": "success",
  "ip_address": "string",
  "user_agent": "string",
  "request_id": "string",
  "trace_id": "string",
  "parent_trace_id": "string",
  "http_method": "string",
  "http_path": "string",
  "http_status": 0,
  "duration_ms": 0,
  "metadata": {},
  "event_idempotency_key": "string",
  "data_classification": "string"
}'
```

### JavaScript

```javascript
const body = `{
  "event_id": "string",
  "event_type": "string",
  "log_schema_version": "1.0",
  "service_name": "frontend",
  "action": "string",
  "actor_type": "string",
  "actor_id": "string",
  "actor_email": "string",
  "tenant_id": "string",
  "resource_type": "string",
  "resource_id": "string",
  "status": "success",
  "ip_address": "string",
  "user_agent": "string",
  "request_id": "string",
  "trace_id": "string",
  "parent_trace_id": "string",
  "http_method": "string",
  "http_path": "string",
  "http_status": 0,
  "duration_ms": 0,
  "metadata": {},
  "event_idempotency_key": "string",
  "data_classification": "string"
}`;

const response = await fetch('http://localhost:8000/api/v1/frontend-audit/logs', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer YOUR_TOKEN',
    'Content-Type': 'application/json',
  },
  body,
});

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

### Python

```python
import requests

body = '''{
  "event_id": "string",
  "event_type": "string",
  "log_schema_version": "1.0",
  "service_name": "frontend",
  "action": "string",
  "actor_type": "string",
  "actor_id": "string",
  "actor_email": "string",
  "tenant_id": "string",
  "resource_type": "string",
  "resource_id": "string",
  "status": "success",
  "ip_address": "string",
  "user_agent": "string",
  "request_id": "string",
  "trace_id": "string",
  "parent_trace_id": "string",
  "http_method": "string",
  "http_path": "string",
  "http_status": 0,
  "duration_ms": 0,
  "metadata": {},
  "event_idempotency_key": "string",
  "data_classification": "string"
}'''

response = requests.post(
    'http://localhost:8000/api/v1/frontend-audit/logs',
    data=body.encode('utf-8'),
    headers={
        'Authorization': 'Bearer YOUR_TOKEN',
        'Content-Type': 'application/json',
    },
)
print(response.text)
```


## Get Deprecated Mobile Security Policy

`GET /api/v1/mobile-security-policies/{tenant_id}`

DEPRECATED: Use GET /tenant-governance/{tenant_id} + GET /runtime-security-config/ instead.

Deprecated.

Authentication (security requirement alternatives):

```json
[
  {
    "OAuth2PasswordBearer": []
  }
]
```

- OAuth2PasswordBearer: oauth2

Parameters:

- `tenant_id` (path, string, required)
  Type: string

Responses:

- 200: Successful Response

Content type: application/json

Type: object

Backward-compatible adapter for old mobile clients.

Maps from RuntimeSecurityConfig + TenantDataGovernance into
the old monolithic MobileSecurityPolicyDto format.
This is TEMPORARY — remove after migration window.

DEPRECATED: Use RuntimeSecurityConfigDto + TenantDataGovernanceDto instead.

Schema: [Backend_DeprecatedMobileSecurityPolicyDto](/api-reference/schemas/backend-deprecatedmobilesecuritypolicydto-26fe21cbe3.md)

- `id` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `tenant_id` (required)
  Type: string

- `global_mode` (optional)
  Type: string
  
  default: "warning"

- `screenshot_prevention_mode` (optional)
  Type: string
  
  default: "disabled"

- `root_detection_mode` (optional)
  Type: string
  
  default: "warning"

- `biometric_required_mode` (optional)
  Type: string
  
  default: "disabled"

- `session_timeout_minutes` (optional)
  Type: integer
  
  default: 0

- `wifi_only_sync` (optional)
  Type: boolean
  
  default: false

- `battery_aware_sync` (optional)
  Type: boolean
  
  default: false

- `battery_low_threshold_percent` (optional)
  Type: integer
  
  default: 20

- `block_sync_on_roaming` (optional)
  Type: boolean
  
  default: false

- `max_offline_duration_hours` (optional)
  Type: integer
  
  default: 0

- `force_revalidation_hours` (optional)
  Type: integer
  
  default: 0

- `media_upload_max_size_mb` (optional)
  Type: integer
  
  default: 50

- `media_upload_allowed_types` (optional)
  Type: unknown
  
  anyOf:
    Type: array
    
    Items:
      Type: unknown
  
    Type: null

- `local_retention_days` (optional)
  Type: integer
  
  default: 0

- `remote_wipe_enabled` (optional)
  Type: boolean
  
  default: false

- 422: Validation Error

Content type: application/json

Type: object

Schema: [Backend_HTTPValidationError](/api-reference/schemas/backend-httpvalidationerror-b82f7839b1.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [Backend_ValidationError](/api-reference/schemas/backend-validationerror-b5b4376c23.md); Type: object

## Examples

### cURL

```bash
curl -X GET 'http://localhost:8000/api/v1/mobile-security-policies/string' \
  -H 'Authorization: Bearer YOUR_TOKEN'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8000/api/v1/mobile-security-policies/string', {
  method: 'GET',
  headers: {
    'Authorization': 'Bearer YOUR_TOKEN',
  },
});

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

### Python

```python
import requests

response = requests.get(
    'http://localhost:8000/api/v1/mobile-security-policies/string',
    headers={
        'Authorization': 'Bearer YOUR_TOKEN',
    },
)
print(response.text)
```


## Update Deprecated Mobile Security Policy

`PUT /api/v1/mobile-security-policies/{tenant_id}`

DEPRECATED: Use PUT /runtime-security-config/ + PUT /tenant-governance/{tenant_id} instead.

Extracts runtime-global fields and updates runtime_security_config.
Extracts tenant-scoped fields and updates tenant_data_governance.

Deprecated.

Authentication (security requirement alternatives):

```json
[
  {
    "OAuth2PasswordBearer": []
  }
]
```

- OAuth2PasswordBearer: oauth2

Parameters:

- `tenant_id` (path, string, required)
  Type: string

Request body: application/json (required)

Type: object

Backward-compatible adapter for old mobile clients.

Maps from RuntimeSecurityConfig + TenantDataGovernance into
the old monolithic MobileSecurityPolicyDto format.
This is TEMPORARY — remove after migration window.

DEPRECATED: Use RuntimeSecurityConfigDto + TenantDataGovernanceDto instead.

Schema: [Backend_DeprecatedMobileSecurityPolicyDto](/api-reference/schemas/backend-deprecatedmobilesecuritypolicydto-26fe21cbe3.md)

- `id` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `tenant_id` (required)
  Type: string

- `global_mode` (optional)
  Type: string
  
  default: "warning"

- `screenshot_prevention_mode` (optional)
  Type: string
  
  default: "disabled"

- `root_detection_mode` (optional)
  Type: string
  
  default: "warning"

- `biometric_required_mode` (optional)
  Type: string
  
  default: "disabled"

- `session_timeout_minutes` (optional)
  Type: integer
  
  default: 0

- `wifi_only_sync` (optional)
  Type: boolean
  
  default: false

- `battery_aware_sync` (optional)
  Type: boolean
  
  default: false

- `battery_low_threshold_percent` (optional)
  Type: integer
  
  default: 20

- `block_sync_on_roaming` (optional)
  Type: boolean
  
  default: false

- `max_offline_duration_hours` (optional)
  Type: integer
  
  default: 0

- `force_revalidation_hours` (optional)
  Type: integer
  
  default: 0

- `media_upload_max_size_mb` (optional)
  Type: integer
  
  default: 50

- `media_upload_allowed_types` (optional)
  Type: unknown
  
  anyOf:
    Type: array
    
    Items:
      Type: unknown
  
    Type: null

- `local_retention_days` (optional)
  Type: integer
  
  default: 0

- `remote_wipe_enabled` (optional)
  Type: boolean
  
  default: false

Responses:

- 200: Successful Response

Content type: application/json

Type: object

Additional properties: true

- 422: Validation Error

Content type: application/json

Type: object

Schema: [Backend_HTTPValidationError](/api-reference/schemas/backend-httpvalidationerror-b82f7839b1.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [Backend_ValidationError](/api-reference/schemas/backend-validationerror-b5b4376c23.md); Type: object

## Examples

### cURL

```bash
curl -X PUT 'http://localhost:8000/api/v1/mobile-security-policies/string' \
  -H 'Authorization: Bearer YOUR_TOKEN' \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "id": "string",
  "tenant_id": "string",
  "global_mode": "warning",
  "screenshot_prevention_mode": "disabled",
  "root_detection_mode": "warning",
  "biometric_required_mode": "disabled",
  "session_timeout_minutes": 0,
  "wifi_only_sync": false,
  "battery_aware_sync": false,
  "battery_low_threshold_percent": 20,
  "block_sync_on_roaming": false,
  "max_offline_duration_hours": 0,
  "force_revalidation_hours": 0,
  "media_upload_max_size_mb": 50,
  "media_upload_allowed_types": [],
  "local_retention_days": 0,
  "remote_wipe_enabled": false
}'
```

### JavaScript

```javascript
const body = `{
  "id": "string",
  "tenant_id": "string",
  "global_mode": "warning",
  "screenshot_prevention_mode": "disabled",
  "root_detection_mode": "warning",
  "biometric_required_mode": "disabled",
  "session_timeout_minutes": 0,
  "wifi_only_sync": false,
  "battery_aware_sync": false,
  "battery_low_threshold_percent": 20,
  "block_sync_on_roaming": false,
  "max_offline_duration_hours": 0,
  "force_revalidation_hours": 0,
  "media_upload_max_size_mb": 50,
  "media_upload_allowed_types": [],
  "local_retention_days": 0,
  "remote_wipe_enabled": false
}`;

const response = await fetch('http://localhost:8000/api/v1/mobile-security-policies/string', {
  method: 'PUT',
  headers: {
    'Authorization': 'Bearer YOUR_TOKEN',
    'Content-Type': 'application/json',
  },
  body,
});

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

### Python

```python
import requests

body = '''{
  "id": "string",
  "tenant_id": "string",
  "global_mode": "warning",
  "screenshot_prevention_mode": "disabled",
  "root_detection_mode": "warning",
  "biometric_required_mode": "disabled",
  "session_timeout_minutes": 0,
  "wifi_only_sync": false,
  "battery_aware_sync": false,
  "battery_low_threshold_percent": 20,
  "block_sync_on_roaming": false,
  "max_offline_duration_hours": 0,
  "force_revalidation_hours": 0,
  "media_upload_max_size_mb": 50,
  "media_upload_allowed_types": [],
  "local_retention_days": 0,
  "remote_wipe_enabled": false
}'''

response = requests.put(
    'http://localhost:8000/api/v1/mobile-security-policies/string',
    data=body.encode('utf-8'),
    headers={
        'Authorization': 'Bearer YOUR_TOKEN',
        'Content-Type': 'application/json',
    },
)
print(response.text)
```


## Get Runtime Security Config

`GET /api/v1/runtime-security-config`

Authentication (security requirement alternatives):

```json
[
  {
    "OAuth2PasswordBearer": []
  }
]
```

- OAuth2PasswordBearer: oauth2

Responses:

- 200: Successful Response

Content type: application/json

Type: object

Schema: [Backend_RuntimeSecurityConfigDto](/api-reference/schemas/backend-runtimesecurityconfigdto-6fd5420810.md)

- `id` (optional)
  Type: string
  
  default: "system_default"

- `screenshot_prevention_mode` (optional)
  Type: string
  
  default: "disabled"
  
  enum: ["strict","warning","disabled"]

- `root_detection_mode` (optional)
  Type: string
  
  default: "warning"
  
  enum: ["strict","warning","disabled"]

- `biometric_required_mode` (optional)
  Type: string
  
  default: "disabled"
  
  enum: ["strict","warning","disabled"]

- `session_timeout_minutes` (optional)
  Type: integer
  
  default: 0

- `wifi_only_sync` (optional)
  Type: boolean
  
  default: false

- `battery_aware_sync` (optional)
  Type: boolean
  
  default: false

- `battery_low_threshold_percent` (optional)
  Type: integer
  
  default: 20

- `block_sync_on_roaming` (optional)
  Type: boolean
  
  default: false

- `background_sync_enabled` (optional)
  Type: boolean
  
  default: true

- `crash_reporting_enabled` (optional)
  Type: boolean
  
  default: true

- `telemetry_enabled` (optional)
  Type: boolean
  
  default: true

- `global_mode` (optional)
  Type: string
  
  default: "warning"
  
  enum: ["strict","warning","disabled"]

- `version_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `updated_at` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `updated_by` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

## Examples

### cURL

```bash
curl -X GET 'http://localhost:8000/api/v1/runtime-security-config' \
  -H 'Authorization: Bearer YOUR_TOKEN'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8000/api/v1/runtime-security-config', {
  method: 'GET',
  headers: {
    'Authorization': 'Bearer YOUR_TOKEN',
  },
});

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

### Python

```python
import requests

response = requests.get(
    'http://localhost:8000/api/v1/runtime-security-config',
    headers={
        'Authorization': 'Bearer YOUR_TOKEN',
    },
)
print(response.text)
```


## Update Runtime Security Config

`PUT /api/v1/runtime-security-config`

Authentication (security requirement alternatives):

```json
[
  {
    "OAuth2PasswordBearer": []
  }
]
```

- OAuth2PasswordBearer: oauth2

Request body: application/json (required)

Type: object

Schema: [Backend_UpdateRuntimeSecurityConfigDto](/api-reference/schemas/backend-updateruntimesecurityconfigdto-71765e5a41.md)

- `screenshot_prevention_mode` (optional)
  Type: unknown
  
  anyOf:
    Type: string
    
    enum: ["strict","warning","disabled"]
  
    Type: null

- `root_detection_mode` (optional)
  Type: unknown
  
  anyOf:
    Type: string
    
    enum: ["strict","warning","disabled"]
  
    Type: null

- `biometric_required_mode` (optional)
  Type: unknown
  
  anyOf:
    Type: string
    
    enum: ["strict","warning","disabled"]
  
    Type: null

- `session_timeout_minutes` (optional)
  Type: unknown
  
  anyOf:
    Type: integer
    
    minimum: 0
    
    maximum: 1440
  
    Type: null

- `wifi_only_sync` (optional)
  Type: unknown
  
  anyOf:
    Type: boolean
  
    Type: null

- `battery_aware_sync` (optional)
  Type: unknown
  
  anyOf:
    Type: boolean
  
    Type: null

- `battery_low_threshold_percent` (optional)
  Type: unknown
  
  anyOf:
    Type: integer
    
    minimum: 1
    
    maximum: 100
  
    Type: null

- `block_sync_on_roaming` (optional)
  Type: unknown
  
  anyOf:
    Type: boolean
  
    Type: null

- `background_sync_enabled` (optional)
  Type: unknown
  
  anyOf:
    Type: boolean
  
    Type: null

- `crash_reporting_enabled` (optional)
  Type: unknown
  
  anyOf:
    Type: boolean
  
    Type: null

- `telemetry_enabled` (optional)
  Type: unknown
  
  anyOf:
    Type: boolean
  
    Type: null

- `global_mode` (optional)
  Type: unknown
  
  anyOf:
    Type: string
    
    enum: ["strict","warning","disabled"]
  
    Type: null

Responses:

- 200: Successful Response

Content type: application/json

Type: object

Schema: [Backend_RuntimeSecurityConfigDto](/api-reference/schemas/backend-runtimesecurityconfigdto-6fd5420810.md)

- `id` (optional)
  Type: string
  
  default: "system_default"

- `screenshot_prevention_mode` (optional)
  Type: string
  
  default: "disabled"
  
  enum: ["strict","warning","disabled"]

- `root_detection_mode` (optional)
  Type: string
  
  default: "warning"
  
  enum: ["strict","warning","disabled"]

- `biometric_required_mode` (optional)
  Type: string
  
  default: "disabled"
  
  enum: ["strict","warning","disabled"]

- `session_timeout_minutes` (optional)
  Type: integer
  
  default: 0

- `wifi_only_sync` (optional)
  Type: boolean
  
  default: false

- `battery_aware_sync` (optional)
  Type: boolean
  
  default: false

- `battery_low_threshold_percent` (optional)
  Type: integer
  
  default: 20

- `block_sync_on_roaming` (optional)
  Type: boolean
  
  default: false

- `background_sync_enabled` (optional)
  Type: boolean
  
  default: true

- `crash_reporting_enabled` (optional)
  Type: boolean
  
  default: true

- `telemetry_enabled` (optional)
  Type: boolean
  
  default: true

- `global_mode` (optional)
  Type: string
  
  default: "warning"
  
  enum: ["strict","warning","disabled"]

- `version_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `updated_at` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `updated_by` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- 422: Validation Error

Content type: application/json

Type: object

Schema: [Backend_HTTPValidationError](/api-reference/schemas/backend-httpvalidationerror-b82f7839b1.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [Backend_ValidationError](/api-reference/schemas/backend-validationerror-b5b4376c23.md); Type: object

## Examples

### cURL

```bash
curl -X PUT 'http://localhost:8000/api/v1/runtime-security-config' \
  -H 'Authorization: Bearer YOUR_TOKEN' \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "screenshot_prevention_mode": "strict",
  "root_detection_mode": "strict",
  "biometric_required_mode": "strict",
  "session_timeout_minutes": 0,
  "wifi_only_sync": true,
  "battery_aware_sync": true,
  "battery_low_threshold_percent": 1,
  "block_sync_on_roaming": true,
  "background_sync_enabled": true,
  "crash_reporting_enabled": true,
  "telemetry_enabled": true,
  "global_mode": "strict"
}'
```

### JavaScript

```javascript
const body = `{
  "screenshot_prevention_mode": "strict",
  "root_detection_mode": "strict",
  "biometric_required_mode": "strict",
  "session_timeout_minutes": 0,
  "wifi_only_sync": true,
  "battery_aware_sync": true,
  "battery_low_threshold_percent": 1,
  "block_sync_on_roaming": true,
  "background_sync_enabled": true,
  "crash_reporting_enabled": true,
  "telemetry_enabled": true,
  "global_mode": "strict"
}`;

const response = await fetch('http://localhost:8000/api/v1/runtime-security-config', {
  method: 'PUT',
  headers: {
    'Authorization': 'Bearer YOUR_TOKEN',
    'Content-Type': 'application/json',
  },
  body,
});

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

### Python

```python
import requests

body = '''{
  "screenshot_prevention_mode": "strict",
  "root_detection_mode": "strict",
  "biometric_required_mode": "strict",
  "session_timeout_minutes": 0,
  "wifi_only_sync": true,
  "battery_aware_sync": true,
  "battery_low_threshold_percent": 1,
  "block_sync_on_roaming": true,
  "background_sync_enabled": true,
  "crash_reporting_enabled": true,
  "telemetry_enabled": true,
  "global_mode": "strict"
}'''

response = requests.put(
    'http://localhost:8000/api/v1/runtime-security-config',
    data=body.encode('utf-8'),
    headers={
        'Authorization': 'Bearer YOUR_TOKEN',
        'Content-Type': 'application/json',
    },
)
print(response.text)
```


## Get Tenant Governance

`GET /api/v1/tenant-governance/{tenant_id}`

Authentication (security requirement alternatives):

```json
[
  {
    "OAuth2PasswordBearer": []
  }
]
```

- OAuth2PasswordBearer: oauth2

Parameters:

- `tenant_id` (path, string, required)
  Type: string

Responses:

- 200: Successful Response

Content type: application/json

Type: object

Schema: [Backend_TenantDataGovernanceDto](/api-reference/schemas/backend-tenantdatagovernancedto-180efcbf5f.md)

- `id` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `tenant_id` (required)
  Type: string

- `max_offline_duration_hours` (optional)
  Type: integer
  
  default: 0

- `force_revalidation_hours` (optional)
  Type: integer
  
  default: 0

- `media_upload_max_size_mb` (optional)
  Type: integer
  
  default: 50

- `media_upload_allowed_types` (optional)
  Type: unknown
  
  anyOf:
    Type: array
    
    Items:
      Type: unknown
  
    Type: null

- `local_retention_days` (optional)
  Type: integer
  
  default: 0

- `remote_wipe_enabled` (optional)
  Type: boolean
  
  default: false

- `version_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- 422: Validation Error

Content type: application/json

Type: object

Schema: [Backend_HTTPValidationError](/api-reference/schemas/backend-httpvalidationerror-b82f7839b1.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [Backend_ValidationError](/api-reference/schemas/backend-validationerror-b5b4376c23.md); Type: object

## Examples

### cURL

```bash
curl -X GET 'http://localhost:8000/api/v1/tenant-governance/string' \
  -H 'Authorization: Bearer YOUR_TOKEN'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8000/api/v1/tenant-governance/string', {
  method: 'GET',
  headers: {
    'Authorization': 'Bearer YOUR_TOKEN',
  },
});

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

### Python

```python
import requests

response = requests.get(
    'http://localhost:8000/api/v1/tenant-governance/string',
    headers={
        'Authorization': 'Bearer YOUR_TOKEN',
    },
)
print(response.text)
```


## Update Tenant Governance

`PUT /api/v1/tenant-governance/{tenant_id}`

Authentication (security requirement alternatives):

```json
[
  {
    "OAuth2PasswordBearer": []
  }
]
```

- OAuth2PasswordBearer: oauth2

Parameters:

- `tenant_id` (path, string, required)
  Type: string

Request body: application/json (required)

Type: object

Schema: [Backend_UpdateTenantDataGovernanceDto](/api-reference/schemas/backend-updatetenantdatagovernancedto-54fa3b7f30.md)

- `max_offline_duration_hours` (optional)
  Type: unknown
  
  anyOf:
    Type: integer
    
    minimum: 0
  
    Type: null

- `force_revalidation_hours` (optional)
  Type: unknown
  
  anyOf:
    Type: integer
    
    minimum: 0
  
    Type: null

- `media_upload_max_size_mb` (optional)
  Type: unknown
  
  anyOf:
    Type: integer
    
    minimum: 1
    
    maximum: 500
  
    Type: null

- `media_upload_allowed_types` (optional)
  Type: unknown
  
  anyOf:
    Type: array
    
    Items:
      Type: unknown
  
    Type: null

- `local_retention_days` (optional)
  Type: unknown
  
  anyOf:
    Type: integer
    
    minimum: 0
  
    Type: null

- `remote_wipe_enabled` (optional)
  Type: unknown
  
  anyOf:
    Type: boolean
  
    Type: null

Responses:

- 200: Successful Response

Content type: application/json

Type: object

Schema: [Backend_TenantDataGovernanceResponseDto](/api-reference/schemas/backend-tenantdatagovernanceresponsedto-d90a8842aa.md)

- `message` (required)
  Type: string

- `governance` (optional)
  Type: unknown
  
  anyOf:
    Reference: [Backend_TenantDataGovernanceDto](/api-reference/schemas/backend-tenantdatagovernancedto-180efcbf5f.md); Type: object
  
    Type: null

- 422: Validation Error

Content type: application/json

Type: object

Schema: [Backend_HTTPValidationError](/api-reference/schemas/backend-httpvalidationerror-b82f7839b1.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [Backend_ValidationError](/api-reference/schemas/backend-validationerror-b5b4376c23.md); Type: object

## Examples

### cURL

```bash
curl -X PUT 'http://localhost:8000/api/v1/tenant-governance/string' \
  -H 'Authorization: Bearer YOUR_TOKEN' \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "max_offline_duration_hours": 0,
  "force_revalidation_hours": 0,
  "media_upload_max_size_mb": 1,
  "media_upload_allowed_types": [],
  "local_retention_days": 0,
  "remote_wipe_enabled": true
}'
```

### JavaScript

```javascript
const body = `{
  "max_offline_duration_hours": 0,
  "force_revalidation_hours": 0,
  "media_upload_max_size_mb": 1,
  "media_upload_allowed_types": [],
  "local_retention_days": 0,
  "remote_wipe_enabled": true
}`;

const response = await fetch('http://localhost:8000/api/v1/tenant-governance/string', {
  method: 'PUT',
  headers: {
    'Authorization': 'Bearer YOUR_TOKEN',
    'Content-Type': 'application/json',
  },
  body,
});

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

### Python

```python
import requests

body = '''{
  "max_offline_duration_hours": 0,
  "force_revalidation_hours": 0,
  "media_upload_max_size_mb": 1,
  "media_upload_allowed_types": [],
  "local_retention_days": 0,
  "remote_wipe_enabled": true
}'''

response = requests.put(
    'http://localhost:8000/api/v1/tenant-governance/string',
    data=body.encode('utf-8'),
    headers={
        'Authorization': 'Bearer YOUR_TOKEN',
        'Content-Type': 'application/json',
    },
)
print(response.text)
```


## Delete Tenant Governance

`DELETE /api/v1/tenant-governance/{tenant_id}`

Authentication (security requirement alternatives):

```json
[
  {
    "OAuth2PasswordBearer": []
  }
]
```

- OAuth2PasswordBearer: oauth2

Parameters:

- `tenant_id` (path, string, required)
  Type: string

Responses:

- 200: Successful Response

Content type: application/json

Type: object

Schema: [Backend_TenantDataGovernanceResponseDto](/api-reference/schemas/backend-tenantdatagovernanceresponsedto-d90a8842aa.md)

- `message` (required)
  Type: string

- `governance` (optional)
  Type: unknown
  
  anyOf:
    Reference: [Backend_TenantDataGovernanceDto](/api-reference/schemas/backend-tenantdatagovernancedto-180efcbf5f.md); Type: object
  
    Type: null

- 422: Validation Error

Content type: application/json

Type: object

Schema: [Backend_HTTPValidationError](/api-reference/schemas/backend-httpvalidationerror-b82f7839b1.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [Backend_ValidationError](/api-reference/schemas/backend-validationerror-b5b4376c23.md); Type: object

## Examples

### cURL

```bash
curl -X DELETE 'http://localhost:8000/api/v1/tenant-governance/string' \
  -H 'Authorization: Bearer YOUR_TOKEN'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8000/api/v1/tenant-governance/string', {
  method: 'DELETE',
  headers: {
    'Authorization': 'Bearer YOUR_TOKEN',
  },
});

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

### Python

```python
import requests

response = requests.delete(
    'http://localhost:8000/api/v1/tenant-governance/string',
    headers={
        'Authorization': 'Bearer YOUR_TOKEN',
    },
)
print(response.text)
```


## Create Tenant Governance

`POST /api/v1/tenant-governance`

Authentication (security requirement alternatives):

```json
[
  {
    "OAuth2PasswordBearer": []
  }
]
```

- OAuth2PasswordBearer: oauth2

Request body: application/json (required)

Type: object

Schema: [Backend_CreateTenantDataGovernanceDto](/api-reference/schemas/backend-createtenantdatagovernancedto-c53f3be484.md)

- `tenant_id` (required)
  Type: string

- `max_offline_duration_hours` (optional)
  Type: integer
  
  default: 0
  
  minimum: 0

- `force_revalidation_hours` (optional)
  Type: integer
  
  default: 0
  
  minimum: 0

- `media_upload_max_size_mb` (optional)
  Type: integer
  
  default: 50
  
  minimum: 1
  
  maximum: 500

- `media_upload_allowed_types` (optional)
  Type: unknown
  
  anyOf:
    Type: array
    
    Items:
      Type: unknown
  
    Type: null

- `local_retention_days` (optional)
  Type: integer
  
  default: 0
  
  minimum: 0

- `remote_wipe_enabled` (optional)
  Type: boolean
  
  default: false

Responses:

- 201: Successful Response

Content type: application/json

Type: object

Schema: [Backend_TenantDataGovernanceResponseDto](/api-reference/schemas/backend-tenantdatagovernanceresponsedto-d90a8842aa.md)

- `message` (required)
  Type: string

- `governance` (optional)
  Type: unknown
  
  anyOf:
    Reference: [Backend_TenantDataGovernanceDto](/api-reference/schemas/backend-tenantdatagovernancedto-180efcbf5f.md); Type: object
  
    Type: null

- 422: Validation Error

Content type: application/json

Type: object

Schema: [Backend_HTTPValidationError](/api-reference/schemas/backend-httpvalidationerror-b82f7839b1.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [Backend_ValidationError](/api-reference/schemas/backend-validationerror-b5b4376c23.md); Type: object

## Examples

### cURL

```bash
curl -X POST 'http://localhost:8000/api/v1/tenant-governance' \
  -H 'Authorization: Bearer YOUR_TOKEN' \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "tenant_id": "string",
  "max_offline_duration_hours": 0,
  "force_revalidation_hours": 0,
  "media_upload_max_size_mb": 50,
  "media_upload_allowed_types": [],
  "local_retention_days": 0,
  "remote_wipe_enabled": false
}'
```

### JavaScript

```javascript
const body = `{
  "tenant_id": "string",
  "max_offline_duration_hours": 0,
  "force_revalidation_hours": 0,
  "media_upload_max_size_mb": 50,
  "media_upload_allowed_types": [],
  "local_retention_days": 0,
  "remote_wipe_enabled": false
}`;

const response = await fetch('http://localhost:8000/api/v1/tenant-governance', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer YOUR_TOKEN',
    'Content-Type': 'application/json',
  },
  body,
});

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

### Python

```python
import requests

body = '''{
  "tenant_id": "string",
  "max_offline_duration_hours": 0,
  "force_revalidation_hours": 0,
  "media_upload_max_size_mb": 50,
  "media_upload_allowed_types": [],
  "local_retention_days": 0,
  "remote_wipe_enabled": false
}'''

response = requests.post(
    'http://localhost:8000/api/v1/tenant-governance',
    data=body.encode('utf-8'),
    headers={
        'Authorization': 'Bearer YOUR_TOKEN',
        'Content-Type': 'application/json',
    },
)
print(response.text)
```


## Issue Remote Wipe

`POST /api/v1/tenant-governance/{tenant_id}/remote-wipe`

Authentication (security requirement alternatives):

```json
[
  {
    "OAuth2PasswordBearer": []
  }
]
```

- OAuth2PasswordBearer: oauth2

Parameters:

- `tenant_id` (path, string, required)
  Type: string

Request body: application/json (required)

Type: object

Schema: [Backend_RemoteWipeCommandDto](/api-reference/schemas/backend-remotewipecommanddto-4077d15808.md)

- `target_user_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `reason` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

Responses:

- 200: Successful Response

Content type: application/json

Type: object

Additional properties: true

- 422: Validation Error

Content type: application/json

Type: object

Schema: [Backend_HTTPValidationError](/api-reference/schemas/backend-httpvalidationerror-b82f7839b1.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [Backend_ValidationError](/api-reference/schemas/backend-validationerror-b5b4376c23.md); Type: object

## Examples

### cURL

```bash
curl -X POST 'http://localhost:8000/api/v1/tenant-governance/string/remote-wipe' \
  -H 'Authorization: Bearer YOUR_TOKEN' \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "target_user_id": "string",
  "reason": "string"
}'
```

### JavaScript

```javascript
const body = `{
  "target_user_id": "string",
  "reason": "string"
}`;

const response = await fetch('http://localhost:8000/api/v1/tenant-governance/string/remote-wipe', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer YOUR_TOKEN',
    'Content-Type': 'application/json',
  },
  body,
});

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

### Python

```python
import requests

body = '''{
  "target_user_id": "string",
  "reason": "string"
}'''

response = requests.post(
    'http://localhost:8000/api/v1/tenant-governance/string/remote-wipe',
    data=body.encode('utf-8'),
    headers={
        'Authorization': 'Bearer YOUR_TOKEN',
        'Content-Type': 'application/json',
    },
)
print(response.text)
```


## Get App Version

`GET /api/v1/app/version`

Authentication: no security requirement declared for this operation.

Responses:

- 200: Successful Response

Content type: application/json

Type: object

Schema: [Backend_AppVersionCheckResponseDto](/api-reference/schemas/backend-appversioncheckresponsedto-6c72b8eade.md)

- `latest_version` (required)
  Type: string
  
  Example:
  
  ```json
  "2.1.0"
  ```

- `download_url` (optional)
  Type: unknown
  
  Example:
  
  ```json
  "https://releases.mquad.local/v2.1.0/mquad.apk"
  ```
  
  anyOf:
    Type: string
  
    Type: null

- `checksum_sha256` (optional)
  Type: unknown
  
  Example:
  
  ```json
  "a1b2c3d4e5f6..."
  ```
  
  anyOf:
    Type: string
  
    Type: null

- `min_version` (optional)
  Type: unknown
  
  Example:
  
  ```json
  "1.5.0"
  ```
  
  anyOf:
    Type: string
  
    Type: null

- `release_notes` (optional)
  Type: unknown
  
  Example:
  
  ```json
  "Fixed sync conflicts, improved offline stability"
  ```
  
  anyOf:
    Type: string
  
    Type: null

## Examples

### cURL

```bash
curl -X GET 'http://localhost:8000/api/v1/app/version'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8000/api/v1/app/version', {
  method: 'GET',
});

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

### Python

```python
import requests

response = requests.get('http://localhost:8000/api/v1/app/version')
print(response.text)
```


## List Tags

`GET /api/v1/surveys/tags`

List all tags for the tenant.

Authentication: no security requirement declared for this operation.

Parameters:

- `search` (query, unknown, optional) - Search tags by name
  Type: unknown
  
  Search tags by name
  
  anyOf:
    Type: string
  
    Type: null

Responses:

- 200: Successful Response

Content type: application/json

Type: object

Schema: [SurveyService_TagListResponse](/api-reference/schemas/surveyservice-taglistresponse-d30ebd816a.md)

- `items` (required)
  Type: array
  
  Items:
    Reference: [SurveyService_TagResponse](/api-reference/schemas/surveyservice-tagresponse-1b11fe3a5a.md); Type: object

- `total` (required)
  Type: integer

- 422: Validation Error

Content type: application/json

Type: object

Schema: [SurveyService_HTTPValidationError](/api-reference/schemas/surveyservice-httpvalidationerror-6237d5d2de.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [SurveyService_ValidationError](/api-reference/schemas/surveyservice-validationerror-21d2a3258e.md); Type: object

## Examples

### cURL

```bash
curl -X GET 'http://localhost:8001/api/v1/surveys/tags'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8001/api/v1/surveys/tags', {
  method: 'GET',
});

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

### Python

```python
import requests

response = requests.get('http://localhost:8001/api/v1/surveys/tags')
print(response.text)
```


## Create Tag

`POST /api/v1/surveys/tags`

Create a new tag.

Authentication: no security requirement declared for this operation.

Request body: application/json (required)

Type: object

Schema: [SurveyService_TagCreate](/api-reference/schemas/surveyservice-tagcreate-17544066f2.md)

- `name` (required)
  Type: string
  
  minLength: 1
  
  maxLength: 100

- `color` (optional)
  Type: unknown
  
  anyOf:
    Type: string
    
    pattern: "^#[0-9A-Fa-f]{6}$"
  
    Type: null

Responses:

- 201: Successful Response

Content type: application/json

Type: object

Schema: [SurveyService_TagResponse](/api-reference/schemas/surveyservice-tagresponse-1b11fe3a5a.md)

- `id` (required)
  Type: string, uuid

- `tenant_id` (required)
  Type: string, uuid

- `name` (required)
  Type: string

- `color` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `created_at` (required)
  Type: string, date-time

- `updated_at` (required)
  Type: string, date-time

- `created_by` (required)
  Type: string, uuid

- 422: Validation Error

Content type: application/json

Type: object

Schema: [SurveyService_HTTPValidationError](/api-reference/schemas/surveyservice-httpvalidationerror-6237d5d2de.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [SurveyService_ValidationError](/api-reference/schemas/surveyservice-validationerror-21d2a3258e.md); Type: object

## Examples

### cURL

```bash
curl -X POST 'http://localhost:8001/api/v1/surveys/tags' \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "name": "string",
  "color": "string"
}'
```

### JavaScript

```javascript
const body = `{
  "name": "string",
  "color": "string"
}`;

const response = await fetch('http://localhost:8001/api/v1/surveys/tags', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
  },
  body,
});

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

### Python

```python
import requests

body = '''{
  "name": "string",
  "color": "string"
}'''

response = requests.post(
    'http://localhost:8001/api/v1/surveys/tags',
    data=body.encode('utf-8'),
    headers={
        'Content-Type': 'application/json',
    },
)
print(response.text)
```


## Update Tag

`PUT /api/v1/surveys/tags/{tag_id}`

Update a tag.

Authentication: no security requirement declared for this operation.

Parameters:

- `tag_id` (path, string, uuid, required)
  Type: string, uuid

Request body: application/json (required)

Type: object

Schema: [SurveyService_TagUpdate](/api-reference/schemas/surveyservice-tagupdate-526f8f866a.md)

- `name` (optional)
  Type: unknown
  
  anyOf:
    Type: string
    
    minLength: 1
    
    maxLength: 100
  
    Type: null

- `color` (optional)
  Type: unknown
  
  anyOf:
    Type: string
    
    pattern: "^#[0-9A-Fa-f]{6}$"
  
    Type: null

Responses:

- 200: Successful Response

Content type: application/json

Type: object

Schema: [SurveyService_TagResponse](/api-reference/schemas/surveyservice-tagresponse-1b11fe3a5a.md)

- `id` (required)
  Type: string, uuid

- `tenant_id` (required)
  Type: string, uuid

- `name` (required)
  Type: string

- `color` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `created_at` (required)
  Type: string, date-time

- `updated_at` (required)
  Type: string, date-time

- `created_by` (required)
  Type: string, uuid

- 422: Validation Error

Content type: application/json

Type: object

Schema: [SurveyService_HTTPValidationError](/api-reference/schemas/surveyservice-httpvalidationerror-6237d5d2de.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [SurveyService_ValidationError](/api-reference/schemas/surveyservice-validationerror-21d2a3258e.md); Type: object

## Examples

### cURL

```bash
curl -X PUT 'http://localhost:8001/api/v1/surveys/tags/550e8400-e29b-41d4-a716-446655440000' \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "name": "string",
  "color": "string"
}'
```

### JavaScript

```javascript
const body = `{
  "name": "string",
  "color": "string"
}`;

const response = await fetch('http://localhost:8001/api/v1/surveys/tags/550e8400-e29b-41d4-a716-446655440000', {
  method: 'PUT',
  headers: {
    'Content-Type': 'application/json',
  },
  body,
});

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

### Python

```python
import requests

body = '''{
  "name": "string",
  "color": "string"
}'''

response = requests.put(
    'http://localhost:8001/api/v1/surveys/tags/550e8400-e29b-41d4-a716-446655440000',
    data=body.encode('utf-8'),
    headers={
        'Content-Type': 'application/json',
    },
)
print(response.text)
```


## Delete Tag

`DELETE /api/v1/surveys/tags/{tag_id}`

Delete a tag and remove all associations.

Authentication: no security requirement declared for this operation.

Parameters:

- `tag_id` (path, string, uuid, required)
  Type: string, uuid

Responses:

- 204: Successful Response

- 422: Validation Error

Content type: application/json

Type: object

Schema: [SurveyService_HTTPValidationError](/api-reference/schemas/surveyservice-httpvalidationerror-6237d5d2de.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [SurveyService_ValidationError](/api-reference/schemas/surveyservice-validationerror-21d2a3258e.md); Type: object

## Examples

### cURL

```bash
curl -X DELETE 'http://localhost:8001/api/v1/surveys/tags/550e8400-e29b-41d4-a716-446655440000'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8001/api/v1/surveys/tags/550e8400-e29b-41d4-a716-446655440000', {
  method: 'DELETE',
});

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

### Python

```python
import requests

response = requests.delete('http://localhost:8001/api/v1/surveys/tags/550e8400-e29b-41d4-a716-446655440000')
print(response.text)
```


## Get Survey Tags

`GET /api/v1/surveys/{survey_id}/tags`

Get all tags assigned to a survey.

Authentication: no security requirement declared for this operation.

Parameters:

- `survey_id` (path, string, uuid, required)
  Type: string, uuid

Responses:

- 200: Successful Response

Content type: application/json

Type: array

Items:
  Reference: [SurveyService_TagResponse](/api-reference/schemas/surveyservice-tagresponse-1b11fe3a5a.md); Type: object

- 422: Validation Error

Content type: application/json

Type: object

Schema: [SurveyService_HTTPValidationError](/api-reference/schemas/surveyservice-httpvalidationerror-6237d5d2de.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [SurveyService_ValidationError](/api-reference/schemas/surveyservice-validationerror-21d2a3258e.md); Type: object

## Examples

### cURL

```bash
curl -X GET 'http://localhost:8001/api/v1/surveys/550e8400-e29b-41d4-a716-446655440000/tags'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8001/api/v1/surveys/550e8400-e29b-41d4-a716-446655440000/tags', {
  method: 'GET',
});

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

### Python

```python
import requests

response = requests.get('http://localhost:8001/api/v1/surveys/550e8400-e29b-41d4-a716-446655440000/tags')
print(response.text)
```


## Assign Tags To Survey

`POST /api/v1/surveys/{survey_id}/tags`

Assign tags to a survey (replaces all existing tag assignments).

Authentication: no security requirement declared for this operation.

Parameters:

- `survey_id` (path, string, uuid, required)
  Type: string, uuid

Request body: application/json (required)

Type: object

Schema: [SurveyService_SurveyTagAssignment](/api-reference/schemas/surveyservice-surveytagassignment-054cc82606.md)

- `tag_ids` (required)
  Type: array
  
  Items:
    Type: string, uuid

Responses:

- 200: Successful Response

Content type: application/json

Type: array

Items:
  Reference: [SurveyService_TagResponse](/api-reference/schemas/surveyservice-tagresponse-1b11fe3a5a.md); Type: object

- 422: Validation Error

Content type: application/json

Type: object

Schema: [SurveyService_HTTPValidationError](/api-reference/schemas/surveyservice-httpvalidationerror-6237d5d2de.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [SurveyService_ValidationError](/api-reference/schemas/surveyservice-validationerror-21d2a3258e.md); Type: object

## Examples

### cURL

```bash
curl -X POST 'http://localhost:8001/api/v1/surveys/550e8400-e29b-41d4-a716-446655440000/tags' \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "tag_ids": [
    "550e8400-e29b-41d4-a716-446655440000"
  ]
}'
```

### JavaScript

```javascript
const body = `{
  "tag_ids": [
    "550e8400-e29b-41d4-a716-446655440000"
  ]
}`;

const response = await fetch('http://localhost:8001/api/v1/surveys/550e8400-e29b-41d4-a716-446655440000/tags', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
  },
  body,
});

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

### Python

```python
import requests

body = '''{
  "tag_ids": [
    "550e8400-e29b-41d4-a716-446655440000"
  ]
}'''

response = requests.post(
    'http://localhost:8001/api/v1/surveys/550e8400-e29b-41d4-a716-446655440000/tags',
    data=body.encode('utf-8'),
    headers={
        'Content-Type': 'application/json',
    },
)
print(response.text)
```


## List Languages

`GET /api/v1/surveys/languages`

List all languages for the tenant.

Authentication: no security requirement declared for this operation.

Parameters:

- `include_inactive` (query, boolean, optional) - Include inactive languages in the response
  Type: boolean
  
  Include inactive languages in the response
  
  default: false

Responses:

- 200: Successful Response

Content type: application/json

Type: object

Schema: [SurveyService_LanguageListResponse](/api-reference/schemas/surveyservice-languagelistresponse-419045d5e5.md)

- `languages` (required)
  Type: array
  
  Items:
    Reference: [SurveyService_LanguageResponse](/api-reference/schemas/surveyservice-languageresponse-316a38ba73.md); Type: object

- `total` (required)
  Type: integer

- 422: Validation Error

Content type: application/json

Type: object

Schema: [SurveyService_HTTPValidationError](/api-reference/schemas/surveyservice-httpvalidationerror-6237d5d2de.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [SurveyService_ValidationError](/api-reference/schemas/surveyservice-validationerror-21d2a3258e.md); Type: object

## Examples

### cURL

```bash
curl -X GET 'http://localhost:8001/api/v1/surveys/languages?include_inactive=false'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8001/api/v1/surveys/languages?include_inactive=false', {
  method: 'GET',
});

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

### Python

```python
import requests

response = requests.get('http://localhost:8001/api/v1/surveys/languages?include_inactive=false')
print(response.text)
```


## Create Language

`POST /api/v1/surveys/languages`

Create a new language for the tenant.

Authentication: no security requirement declared for this operation.

Request body: application/json (required)

Type: object

Schema: [SurveyService_LanguageCreate](/api-reference/schemas/surveyservice-languagecreate-4380c928f6.md)

- `code` (required)
  Type: string
  
  Language code (e.g., 'en', 'hi')
  
  maxLength: 10

- `name` (required)
  Type: string
  
  Language name (e.g., 'English', 'Hindi')
  
  maxLength: 100

- `flag_emoji` (optional)
  Type: unknown
  
  Flag emoji (e.g., '🇺🇸')
  
  anyOf:
    Type: string
    
    maxLength: 10
  
    Type: null

- `is_active` (optional)
  Type: boolean
  
  Whether language is active
  
  default: true

- `display_order` (optional)
  Type: integer
  
  Display order for sorting
  
  default: 0

Responses:

- 201: Successful Response

Content type: application/json

Type: object

Schema: [SurveyService_LanguageResponse](/api-reference/schemas/surveyservice-languageresponse-316a38ba73.md)

- `id` (required)
  Type: string, uuid

- `tenant_id` (required)
  Type: string, uuid

- `code` (required)
  Type: string

- `name` (required)
  Type: string

- `flag_emoji` (required)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `is_active` (required)
  Type: boolean

- `display_order` (required)
  Type: integer

- 422: Validation Error

Content type: application/json

Type: object

Schema: [SurveyService_HTTPValidationError](/api-reference/schemas/surveyservice-httpvalidationerror-6237d5d2de.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [SurveyService_ValidationError](/api-reference/schemas/surveyservice-validationerror-21d2a3258e.md); Type: object

## Examples

### cURL

```bash
curl -X POST 'http://localhost:8001/api/v1/surveys/languages' \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "code": "string",
  "name": "string",
  "flag_emoji": "string",
  "is_active": true,
  "display_order": 0
}'
```

### JavaScript

```javascript
const body = `{
  "code": "string",
  "name": "string",
  "flag_emoji": "string",
  "is_active": true,
  "display_order": 0
}`;

const response = await fetch('http://localhost:8001/api/v1/surveys/languages', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
  },
  body,
});

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

### Python

```python
import requests

body = '''{
  "code": "string",
  "name": "string",
  "flag_emoji": "string",
  "is_active": true,
  "display_order": 0
}'''

response = requests.post(
    'http://localhost:8001/api/v1/surveys/languages',
    data=body.encode('utf-8'),
    headers={
        'Content-Type': 'application/json',
    },
)
print(response.text)
```


## Reorder Languages

`PUT /api/v1/surveys/languages/reorder`

Reorder languages by updating display_order based on array position.

Authentication: no security requirement declared for this operation.

Request body: application/json (required)

Type: object

Schema: [SurveyService_LanguageReorderRequest](/api-reference/schemas/surveyservice-languagereorderrequest-0f3187190c.md)

- `language_ids` (required)
  Type: array
  
  List of language codes in desired order
  
  Items:
    Type: string

Responses:

- 200: Successful Response

Content type: application/json

Type: object

Schema: [SurveyService_LanguageListResponse](/api-reference/schemas/surveyservice-languagelistresponse-419045d5e5.md)

- `languages` (required)
  Type: array
  
  Items:
    Reference: [SurveyService_LanguageResponse](/api-reference/schemas/surveyservice-languageresponse-316a38ba73.md); Type: object

- `total` (required)
  Type: integer

- 422: Validation Error

Content type: application/json

Type: object

Schema: [SurveyService_HTTPValidationError](/api-reference/schemas/surveyservice-httpvalidationerror-6237d5d2de.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [SurveyService_ValidationError](/api-reference/schemas/surveyservice-validationerror-21d2a3258e.md); Type: object

## Examples

### cURL

```bash
curl -X PUT 'http://localhost:8001/api/v1/surveys/languages/reorder' \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "language_ids": [
    "string"
  ]
}'
```

### JavaScript

```javascript
const body = `{
  "language_ids": [
    "string"
  ]
}`;

const response = await fetch('http://localhost:8001/api/v1/surveys/languages/reorder', {
  method: 'PUT',
  headers: {
    'Content-Type': 'application/json',
  },
  body,
});

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

### Python

```python
import requests

body = '''{
  "language_ids": [
    "string"
  ]
}'''

response = requests.put(
    'http://localhost:8001/api/v1/surveys/languages/reorder',
    data=body.encode('utf-8'),
    headers={
        'Content-Type': 'application/json',
    },
)
print(response.text)
```


## Update Language

`PUT /api/v1/surveys/languages/{language_id}`

Update an existing language.

Authentication: no security requirement declared for this operation.

Parameters:

- `language_id` (path, string, uuid, required)
  Type: string, uuid

Request body: application/json (required)

Type: object

Schema: [SurveyService_LanguageUpdate](/api-reference/schemas/surveyservice-languageupdate-90b58bfe7e.md)

- `code` (optional)
  Type: unknown
  
  anyOf:
    Type: string
    
    maxLength: 10
  
    Type: null

- `name` (optional)
  Type: unknown
  
  anyOf:
    Type: string
    
    maxLength: 100
  
    Type: null

- `flag_emoji` (optional)
  Type: unknown
  
  anyOf:
    Type: string
    
    maxLength: 10
  
    Type: null

- `is_active` (optional)
  Type: unknown
  
  anyOf:
    Type: boolean
  
    Type: null

- `display_order` (optional)
  Type: unknown
  
  anyOf:
    Type: integer
  
    Type: null

Responses:

- 200: Successful Response

Content type: application/json

Type: object

Schema: [SurveyService_LanguageResponse](/api-reference/schemas/surveyservice-languageresponse-316a38ba73.md)

- `id` (required)
  Type: string, uuid

- `tenant_id` (required)
  Type: string, uuid

- `code` (required)
  Type: string

- `name` (required)
  Type: string

- `flag_emoji` (required)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `is_active` (required)
  Type: boolean

- `display_order` (required)
  Type: integer

- 422: Validation Error

Content type: application/json

Type: object

Schema: [SurveyService_HTTPValidationError](/api-reference/schemas/surveyservice-httpvalidationerror-6237d5d2de.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [SurveyService_ValidationError](/api-reference/schemas/surveyservice-validationerror-21d2a3258e.md); Type: object

## Examples

### cURL

```bash
curl -X PUT 'http://localhost:8001/api/v1/surveys/languages/550e8400-e29b-41d4-a716-446655440000' \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "code": "string",
  "name": "string",
  "flag_emoji": "string",
  "is_active": true,
  "display_order": 0
}'
```

### JavaScript

```javascript
const body = `{
  "code": "string",
  "name": "string",
  "flag_emoji": "string",
  "is_active": true,
  "display_order": 0
}`;

const response = await fetch('http://localhost:8001/api/v1/surveys/languages/550e8400-e29b-41d4-a716-446655440000', {
  method: 'PUT',
  headers: {
    'Content-Type': 'application/json',
  },
  body,
});

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

### Python

```python
import requests

body = '''{
  "code": "string",
  "name": "string",
  "flag_emoji": "string",
  "is_active": true,
  "display_order": 0
}'''

response = requests.put(
    'http://localhost:8001/api/v1/surveys/languages/550e8400-e29b-41d4-a716-446655440000',
    data=body.encode('utf-8'),
    headers={
        'Content-Type': 'application/json',
    },
)
print(response.text)
```


## Delete Language

`DELETE /api/v1/surveys/languages/{language_id}`

Hard delete a language (remove from database).

Authentication: no security requirement declared for this operation.

Parameters:

- `language_id` (path, string, uuid, required)
  Type: string, uuid

Responses:

- 204: Successful Response

- 422: Validation Error

Content type: application/json

Type: object

Schema: [SurveyService_HTTPValidationError](/api-reference/schemas/surveyservice-httpvalidationerror-6237d5d2de.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [SurveyService_ValidationError](/api-reference/schemas/surveyservice-validationerror-21d2a3258e.md); Type: object

## Examples

### cURL

```bash
curl -X DELETE 'http://localhost:8001/api/v1/surveys/languages/550e8400-e29b-41d4-a716-446655440000'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8001/api/v1/surveys/languages/550e8400-e29b-41d4-a716-446655440000', {
  method: 'DELETE',
});

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

### Python

```python
import requests

response = requests.delete('http://localhost:8001/api/v1/surveys/languages/550e8400-e29b-41d4-a716-446655440000')
print(response.text)
```


## Seed Default Languages

`POST /api/v1/surveys/languages/seed`

Seed default languages for the tenant (if none exist).

Authentication: no security requirement declared for this operation.

Responses:

- 200: Successful Response

Content type: application/json

Type: object

Schema: [SurveyService_LanguageListResponse](/api-reference/schemas/surveyservice-languagelistresponse-419045d5e5.md)

- `languages` (required)
  Type: array
  
  Items:
    Reference: [SurveyService_LanguageResponse](/api-reference/schemas/surveyservice-languageresponse-316a38ba73.md); Type: object

- `total` (required)
  Type: integer

## Examples

### cURL

```bash
curl -X POST 'http://localhost:8001/api/v1/surveys/languages/seed'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8001/api/v1/surveys/languages/seed', {
  method: 'POST',
});

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

### Python

```python
import requests

response = requests.post('http://localhost:8001/api/v1/surveys/languages/seed')
print(response.text)
```


## Resolve lookup values

`POST /api/v1/surveys/lookups/{survey_id}/resolve`

Resolve dependent field values based on a trigger question and value

Authentication: no security requirement declared for this operation.

Parameters:

- `survey_id` (path, string, uuid, required)
  Type: string, uuid

Request body: application/json (required)

Type: object

Request model for lookup resolution.

Schema: [SurveyService_LookupResolveRequest](/api-reference/schemas/surveyservice-lookupresolverequest-c77eea897e.md)

- `trigger_question` (required)
  Type: string
  
  Name of the trigger question

- `trigger_value` (required)
  Type: string
  
  Selected value for the trigger question

- `current_values` (optional)
  Type: unknown
  
  Current values of all questions (for change detection)
  
  anyOf:
    Type: object
    
    Additional properties: true
  
    Type: null

Responses:

- 200: Successful Response

Content type: application/json

Type: object

Response model for lookup resolution.

Schema: [SurveyService_LookupResolveResponse](/api-reference/schemas/surveyservice-lookupresolveresponse-6588d37db2.md)

- `trigger_question` (required)
  Type: string

- `trigger_value` (required)
  Type: string

- `resolved_values` (required)
  Type: object
  
  Additional properties: true

- `fields_to_clear` (optional)
  Type: array
  
  Items:
    Type: string

- `is_valid` (optional)
  Type: boolean
  
  default: true

- `error_message` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- 422: Validation Error

Content type: application/json

Type: object

Schema: [SurveyService_HTTPValidationError](/api-reference/schemas/surveyservice-httpvalidationerror-6237d5d2de.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [SurveyService_ValidationError](/api-reference/schemas/surveyservice-validationerror-21d2a3258e.md); Type: object

## Examples

### cURL

```bash
curl -X POST 'http://localhost:8001/api/v1/surveys/lookups/550e8400-e29b-41d4-a716-446655440000/resolve' \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "trigger_question": "string",
  "trigger_value": "string",
  "current_values": {}
}'
```

### JavaScript

```javascript
const body = `{
  "trigger_question": "string",
  "trigger_value": "string",
  "current_values": {}
}`;

const response = await fetch('http://localhost:8001/api/v1/surveys/lookups/550e8400-e29b-41d4-a716-446655440000/resolve', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
  },
  body,
});

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

### Python

```python
import requests

body = '''{
  "trigger_question": "string",
  "trigger_value": "string",
  "current_values": {}
}'''

response = requests.post(
    'http://localhost:8001/api/v1/surveys/lookups/550e8400-e29b-41d4-a716-446655440000/resolve',
    data=body.encode('utf-8'),
    headers={
        'Content-Type': 'application/json',
    },
)
print(response.text)
```


## Validate lookup value

`POST /api/v1/surveys/lookups/{survey_id}/validate`

Validate that a lookup value exists in the lookup data

Authentication: no security requirement declared for this operation.

Parameters:

- `survey_id` (path, string, uuid, required)
  Type: string, uuid

Request body: application/json (required)

Type: object

Request model for lookup validation.

Schema: [SurveyService_LookupValidateRequest](/api-reference/schemas/surveyservice-lookupvalidaterequest-b7d8c64a9f.md)

- `trigger_question` (required)
  Type: string
  
  Name of the trigger question

- `trigger_value` (required)
  Type: string
  
  Value to validate

Responses:

- 200: Successful Response

Content type: application/json

Type: object

Response model for lookup validation.

Schema: [SurveyService_LookupValidateResponse](/api-reference/schemas/surveyservice-lookupvalidateresponse-e2ef2d9f28.md)

- `is_valid` (required)
  Type: boolean

- `trigger_question` (required)
  Type: string

- `trigger_value` (required)
  Type: string

- `error_message` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `available_values` (optional)
  Type: unknown
  
  anyOf:
    Type: array
    
    Items:
      Type: string
  
    Type: null

- 422: Validation Error

Content type: application/json

Type: object

Schema: [SurveyService_HTTPValidationError](/api-reference/schemas/surveyservice-httpvalidationerror-6237d5d2de.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [SurveyService_ValidationError](/api-reference/schemas/surveyservice-validationerror-21d2a3258e.md); Type: object

## Examples

### cURL

```bash
curl -X POST 'http://localhost:8001/api/v1/surveys/lookups/550e8400-e29b-41d4-a716-446655440000/validate' \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "trigger_question": "string",
  "trigger_value": "string"
}'
```

### JavaScript

```javascript
const body = `{
  "trigger_question": "string",
  "trigger_value": "string"
}`;

const response = await fetch('http://localhost:8001/api/v1/surveys/lookups/550e8400-e29b-41d4-a716-446655440000/validate', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
  },
  body,
});

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

### Python

```python
import requests

body = '''{
  "trigger_question": "string",
  "trigger_value": "string"
}'''

response = requests.post(
    'http://localhost:8001/api/v1/surveys/lookups/550e8400-e29b-41d4-a716-446655440000/validate',
    data=body.encode('utf-8'),
    headers={
        'Content-Type': 'application/json',
    },
)
print(response.text)
```


## Get lookup configuration

`GET /api/v1/surveys/lookups/{survey_id}/config`

Get structured lookup configuration for a survey

Authentication: no security requirement declared for this operation.

Parameters:

- `survey_id` (path, string, uuid, required)
  Type: string, uuid

Responses:

- 200: Successful Response

Content type: application/json

Type: object

Response model for lookup configuration.

Schema: [SurveyService_LookupConfigResponse](/api-reference/schemas/surveyservice-lookupconfigresponse-3484eec57a.md)

- `has_lookups` (required)
  Type: boolean

- `lookup_keys` (required)
  Type: array
  
  Items:
    Type: object
    
    Additional properties: true

- `trigger_questions` (required)
  Type: array
  
  Items:
    Type: string

- `referee_questions` (required)
  Type: object
  
  Additional properties: 
    Type: array
    
    Items:
      Type: string

- 422: Validation Error

Content type: application/json

Type: object

Schema: [SurveyService_HTTPValidationError](/api-reference/schemas/surveyservice-httpvalidationerror-6237d5d2de.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [SurveyService_ValidationError](/api-reference/schemas/surveyservice-validationerror-21d2a3258e.md); Type: object

## Examples

### cURL

```bash
curl -X GET 'http://localhost:8001/api/v1/surveys/lookups/550e8400-e29b-41d4-a716-446655440000/config'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8001/api/v1/surveys/lookups/550e8400-e29b-41d4-a716-446655440000/config', {
  method: 'GET',
});

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

### Python

```python
import requests

response = requests.get('http://localhost:8001/api/v1/surveys/lookups/550e8400-e29b-41d4-a716-446655440000/config')
print(response.text)
```


## Get all lookup values

`GET /api/v1/surveys/lookups/{survey_id}/values/{trigger_question}`

Get all valid values for a trigger question

Authentication: no security requirement declared for this operation.

Parameters:

- `survey_id` (path, string, uuid, required)
  Type: string, uuid

- `trigger_question` (path, string, required)
  Type: string

Responses:

- 200: Successful Response

Content type: application/json

Type: array

Items:
  Type: string

- 422: Validation Error

Content type: application/json

Type: object

Schema: [SurveyService_HTTPValidationError](/api-reference/schemas/surveyservice-httpvalidationerror-6237d5d2de.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [SurveyService_ValidationError](/api-reference/schemas/surveyservice-validationerror-21d2a3258e.md); Type: object

## Examples

### cURL

```bash
curl -X GET 'http://localhost:8001/api/v1/surveys/lookups/550e8400-e29b-41d4-a716-446655440000/values/string'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8001/api/v1/surveys/lookups/550e8400-e29b-41d4-a716-446655440000/values/string', {
  method: 'GET',
});

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

### Python

```python
import requests

response = requests.get('http://localhost:8001/api/v1/surveys/lookups/550e8400-e29b-41d4-a716-446655440000/values/string')
print(response.text)
```


## Get lookup statistics

`GET /api/v1/surveys/lookups/{survey_id}/statistics`

Get statistics about lookup data

Authentication: no security requirement declared for this operation.

Parameters:

- `survey_id` (path, string, uuid, required)
  Type: string, uuid

Responses:

- 200: Successful Response

Content type: application/json

Type: object

Response model for lookup statistics.

Schema: [SurveyService_LookupStatisticsResponse](/api-reference/schemas/surveyservice-lookupstatisticsresponse-8e3d62556a.md)

- `trigger_questions` (required)
  Type: integer

- `total_values` (required)
  Type: integer

- `trigger_details` (required)
  Type: object
  
  Additional properties: 
    Type: object
    
    Additional properties: true

- 422: Validation Error

Content type: application/json

Type: object

Schema: [SurveyService_HTTPValidationError](/api-reference/schemas/surveyservice-httpvalidationerror-6237d5d2de.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [SurveyService_ValidationError](/api-reference/schemas/surveyservice-validationerror-21d2a3258e.md); Type: object

## Examples

### cURL

```bash
curl -X GET 'http://localhost:8001/api/v1/surveys/lookups/550e8400-e29b-41d4-a716-446655440000/statistics'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8001/api/v1/surveys/lookups/550e8400-e29b-41d4-a716-446655440000/statistics', {
  method: 'GET',
});

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

### Python

```python
import requests

response = requests.get('http://localhost:8001/api/v1/surveys/lookups/550e8400-e29b-41d4-a716-446655440000/statistics')
print(response.text)
```


## Get available trigger values

`GET /api/v1/surveys/lookups/{survey_id}/available-triggers`

Get trigger values with availability status for assignment UI

Authentication: no security requirement declared for this operation.

Parameters:

- `survey_id` (path, string, uuid, required)
  Type: string, uuid

Responses:

- 200: Successful Response

Content type: application/json

Type: object

Response model for available trigger values with assignment info.

Schema: [SurveyService_AvailableTriggersResponse](/api-reference/schemas/surveyservice-availabletriggersresponse-4eb9e05311.md)

- `trigger_questions` (required)
  Type: array
  
  Items:
    Type: string

- `available_values` (required)
  Type: object
  
  Additional properties: 
    Type: array
    
    Items:
      Type: string

- `assigned_values` (required)
  Type: object
  
  Additional properties: 
    Type: object
    
    Additional properties: 
      Type: unknown
      
      anyOf:
        Type: string
      
        Type: null

- 422: Validation Error

Content type: application/json

Type: object

Schema: [SurveyService_HTTPValidationError](/api-reference/schemas/surveyservice-httpvalidationerror-6237d5d2de.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [SurveyService_ValidationError](/api-reference/schemas/surveyservice-validationerror-21d2a3258e.md); Type: object

## Examples

### cURL

```bash
curl -X GET 'http://localhost:8001/api/v1/surveys/lookups/550e8400-e29b-41d4-a716-446655440000/available-triggers'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8001/api/v1/surveys/lookups/550e8400-e29b-41d4-a716-446655440000/available-triggers', {
  method: 'GET',
});

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

### Python

```python
import requests

response = requests.get('http://localhost:8001/api/v1/surveys/lookups/550e8400-e29b-41d4-a716-446655440000/available-triggers')
print(response.text)
```


## List Categories

`GET /api/v1/surveys/question-bank/categories`

List question bank categories. Permission: template:read or template:manage

Authentication: no security requirement declared for this operation.

Parameters:

- `skip` (query, integer, optional)
  Type: integer
  
  default: 0
  
  minimum: 0

- `limit` (query, integer, optional)
  Type: integer
  
  default: 20
  
  minimum: 1
  
  maximum: 100

- `search` (query, unknown, optional) - Search categories by name or description
  Type: unknown
  
  Search categories by name or description
  
  anyOf:
    Type: string
  
    Type: null

Responses:

- 200: Successful Response

Content type: application/json

Type: object

Schema: [SurveyService_QuestionBankCategoryListResponse](/api-reference/schemas/surveyservice-questionbankcategorylistresponse-d9de2693ac.md)

- `items` (required)
  Type: array
  
  Items:
    Reference: [SurveyService_QuestionBankCategoryResponse](/api-reference/schemas/surveyservice-questionbankcategoryresponse-a375c670a2.md); Type: object

- `total` (required)
  Type: integer

- `limit` (required)
  Type: integer

- `skip` (required)
  Type: integer

- `has_next` (required)
  Type: boolean

- `has_previous` (required)
  Type: boolean

- 422: Validation Error

Content type: application/json

Type: object

Schema: [SurveyService_HTTPValidationError](/api-reference/schemas/surveyservice-httpvalidationerror-6237d5d2de.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [SurveyService_ValidationError](/api-reference/schemas/surveyservice-validationerror-21d2a3258e.md); Type: object

## Examples

### cURL

```bash
curl -X GET 'http://localhost:8001/api/v1/surveys/question-bank/categories?skip=0&limit=20'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8001/api/v1/surveys/question-bank/categories?skip=0&limit=20', {
  method: 'GET',
});

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

### Python

```python
import requests

response = requests.get('http://localhost:8001/api/v1/surveys/question-bank/categories?skip=0&limit=20')
print(response.text)
```


## Create Category

`POST /api/v1/surveys/question-bank/categories`

Create category. Permission: template:create or template:manage

Authentication: no security requirement declared for this operation.

Request body: application/json (required)

Type: object

Schema: [SurveyService_QuestionBankCategoryCreate](/api-reference/schemas/surveyservice-questionbankcategorycreate-66976dcde6.md)

- `name` (required)
  Type: string
  
  minLength: 1
  
  maxLength: 255

- `description` (optional)
  Type: unknown
  
  anyOf:
    Type: string
    
    maxLength: 2000
  
    Type: null

- `color` (optional)
  Type: unknown
  
  anyOf:
    Type: string
    
    maxLength: 50
  
    Type: null

Responses:

- 201: Successful Response

Content type: application/json

Type: object

Schema: [SurveyService_QuestionBankCategoryResponse](/api-reference/schemas/surveyservice-questionbankcategoryresponse-a375c670a2.md)

- `id` (required)
  Type: string

- `tenant_id` (required)
  Type: string

- `name` (required)
  Type: string

- `description` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `color` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `question_count` (optional)
  Type: integer
  
  default: 0

- `created_at` (required)
  Type: string, date-time

- `updated_at` (required)
  Type: string, date-time

- 422: Validation Error

Content type: application/json

Type: object

Schema: [SurveyService_HTTPValidationError](/api-reference/schemas/surveyservice-httpvalidationerror-6237d5d2de.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [SurveyService_ValidationError](/api-reference/schemas/surveyservice-validationerror-21d2a3258e.md); Type: object

## Examples

### cURL

```bash
curl -X POST 'http://localhost:8001/api/v1/surveys/question-bank/categories' \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "name": "string",
  "description": "string",
  "color": "string"
}'
```

### JavaScript

```javascript
const body = `{
  "name": "string",
  "description": "string",
  "color": "string"
}`;

const response = await fetch('http://localhost:8001/api/v1/surveys/question-bank/categories', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
  },
  body,
});

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

### Python

```python
import requests

body = '''{
  "name": "string",
  "description": "string",
  "color": "string"
}'''

response = requests.post(
    'http://localhost:8001/api/v1/surveys/question-bank/categories',
    data=body.encode('utf-8'),
    headers={
        'Content-Type': 'application/json',
    },
)
print(response.text)
```


## Update Category

`PUT /api/v1/surveys/question-bank/categories/{category_id}`

Update category. Permission: template:update or template:manage

Authentication: no security requirement declared for this operation.

Parameters:

- `category_id` (path, string, required)
  Type: string

Request body: application/json (required)

Type: object

Schema: [SurveyService_QuestionBankCategoryUpdate](/api-reference/schemas/surveyservice-questionbankcategoryupdate-bdc6997037.md)

- `name` (optional)
  Type: unknown
  
  anyOf:
    Type: string
    
    minLength: 1
    
    maxLength: 255
  
    Type: null

- `description` (optional)
  Type: unknown
  
  anyOf:
    Type: string
    
    maxLength: 2000
  
    Type: null

- `color` (optional)
  Type: unknown
  
  anyOf:
    Type: string
    
    maxLength: 50
  
    Type: null

Responses:

- 200: Successful Response

Content type: application/json

Type: object

Schema: [SurveyService_QuestionBankCategoryResponse](/api-reference/schemas/surveyservice-questionbankcategoryresponse-a375c670a2.md)

- `id` (required)
  Type: string

- `tenant_id` (required)
  Type: string

- `name` (required)
  Type: string

- `description` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `color` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `question_count` (optional)
  Type: integer
  
  default: 0

- `created_at` (required)
  Type: string, date-time

- `updated_at` (required)
  Type: string, date-time

- 422: Validation Error

Content type: application/json

Type: object

Schema: [SurveyService_HTTPValidationError](/api-reference/schemas/surveyservice-httpvalidationerror-6237d5d2de.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [SurveyService_ValidationError](/api-reference/schemas/surveyservice-validationerror-21d2a3258e.md); Type: object

## Examples

### cURL

```bash
curl -X PUT 'http://localhost:8001/api/v1/surveys/question-bank/categories/string' \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "name": "string",
  "description": "string",
  "color": "string"
}'
```

### JavaScript

```javascript
const body = `{
  "name": "string",
  "description": "string",
  "color": "string"
}`;

const response = await fetch('http://localhost:8001/api/v1/surveys/question-bank/categories/string', {
  method: 'PUT',
  headers: {
    'Content-Type': 'application/json',
  },
  body,
});

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

### Python

```python
import requests

body = '''{
  "name": "string",
  "description": "string",
  "color": "string"
}'''

response = requests.put(
    'http://localhost:8001/api/v1/surveys/question-bank/categories/string',
    data=body.encode('utf-8'),
    headers={
        'Content-Type': 'application/json',
    },
)
print(response.text)
```


## Delete Category

`DELETE /api/v1/surveys/question-bank/categories/{category_id}`

Delete category. Permission: template:delete or template:manage

Authentication: no security requirement declared for this operation.

Parameters:

- `category_id` (path, string, required)
  Type: string

Responses:

- 204: Successful Response

- 422: Validation Error

Content type: application/json

Type: object

Schema: [SurveyService_HTTPValidationError](/api-reference/schemas/surveyservice-httpvalidationerror-6237d5d2de.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [SurveyService_ValidationError](/api-reference/schemas/surveyservice-validationerror-21d2a3258e.md); Type: object

## Examples

### cURL

```bash
curl -X DELETE 'http://localhost:8001/api/v1/surveys/question-bank/categories/string'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8001/api/v1/surveys/question-bank/categories/string', {
  method: 'DELETE',
});

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

### Python

```python
import requests

response = requests.delete('http://localhost:8001/api/v1/surveys/question-bank/categories/string')
print(response.text)
```


## List Questions

`GET /api/v1/surveys/question-bank/questions`

List/search reusable questions.
Permission: template:create or survey:create or template:manage or survey:manage

Authentication: no security requirement declared for this operation.

Parameters:

- `skip` (query, integer, optional)
  Type: integer
  
  default: 0
  
  minimum: 0

- `limit` (query, integer, optional)
  Type: integer
  
  default: 20
  
  minimum: 1
  
  maximum: 100

- `category_id` (query, unknown, optional) - Filter questions by category
  Type: unknown
  
  Filter questions by category
  
  anyOf:
    Type: string
  
    Type: null

- `question_type` (query, unknown, optional) - Filter questions by type
  Type: unknown
  
  Filter questions by type
  
  anyOf:
    Type: string
  
    Type: null

- `search` (query, unknown, optional) - Search questions by name or label
  Type: unknown
  
  Search questions by name or label
  
  anyOf:
    Type: string
  
    Type: null

- `tags` (query, unknown, optional) - Filter questions by tags
  Type: unknown
  
  Filter questions by tags
  
  anyOf:
    Type: string
  
    Type: null

Responses:

- 200: Successful Response

Content type: application/json

Type: object

Schema: [SurveyService_QuestionListResponse](/api-reference/schemas/surveyservice-questionlistresponse-76d583c41c.md)

- `items` (required)
  Type: array
  
  Items:
    Reference: [SurveyService_QuestionResponse](/api-reference/schemas/surveyservice-questionresponse-4b0eed1568.md); Type: object

- `total` (required)
  Type: integer

- `limit` (required)
  Type: integer

- `skip` (required)
  Type: integer

- `has_next` (required)
  Type: boolean

- `has_previous` (required)
  Type: boolean

- 422: Validation Error

Content type: application/json

Type: object

Schema: [SurveyService_HTTPValidationError](/api-reference/schemas/surveyservice-httpvalidationerror-6237d5d2de.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [SurveyService_ValidationError](/api-reference/schemas/surveyservice-validationerror-21d2a3258e.md); Type: object

## Examples

### cURL

```bash
curl -X GET 'http://localhost:8001/api/v1/surveys/question-bank/questions?skip=0&limit=20'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8001/api/v1/surveys/question-bank/questions?skip=0&limit=20', {
  method: 'GET',
});

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

### Python

```python
import requests

response = requests.get('http://localhost:8001/api/v1/surveys/question-bank/questions?skip=0&limit=20')
print(response.text)
```


## Create Question

`POST /api/v1/surveys/question-bank/questions`

Create a reusable question.
Permission: template:create or template:manage

Authentication: no security requirement declared for this operation.

Request body: application/json (required)

Type: object

Schema: [SurveyService_QuestionCreate](/api-reference/schemas/surveyservice-questioncreate-32d6fe24cf.md)

- `category_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `question_type` (required)
  Type: string
  
  minLength: 1
  
  maxLength: 50

- `name` (required)
  Type: string
  
  minLength: 1
  
  maxLength: 100

- `label` (optional)
  Type: string
  
  default: ""
  
  maxLength: 5000

- `label_translations` (optional)
  Type: object
  
  Additional properties: 
    Type: string

- `hint` (optional)
  Type: unknown
  
  anyOf:
    Type: string
    
    maxLength: 5000
  
    Type: null

- `hint_translations` (optional)
  Type: object
  
  Additional properties: 
    Type: string

- `required` (optional)
  Type: boolean
  
  default: false

- `question_config` (optional)
  Type: object
  
  Additional properties: true

- `tags` (optional)
  Type: array
  
  Items:
    Type: string

- `is_public` (optional)
  Type: boolean
  
  default: false

Responses:

- 201: Successful Response

Content type: application/json

Type: object

Schema: [SurveyService_QuestionResponse](/api-reference/schemas/surveyservice-questionresponse-4b0eed1568.md)

- `id` (required)
  Type: string

- `tenant_id` (required)
  Type: string

- `category_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `question_type` (required)
  Type: string

- `name` (required)
  Type: string

- `label` (required)
  Type: string

- `label_translations` (required)
  Type: object
  
  Additional properties: 
    Type: string

- `hint` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `hint_translations` (required)
  Type: object
  
  Additional properties: 
    Type: string

- `required` (required)
  Type: boolean

- `question_config` (required)
  Type: object
  
  Additional properties: true

- `tags` (required)
  Type: array
  
  Items:
    Type: string

- `usage_count` (required)
  Type: integer

- `is_public` (required)
  Type: boolean

- `created_by` (required)
  Type: string

- `updated_by` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `created_at` (required)
  Type: string, date-time

- `updated_at` (required)
  Type: string, date-time

- `category` (optional)
  Type: unknown
  
  anyOf:
    Reference: [SurveyService_QuestionBankCategoryResponse](/api-reference/schemas/surveyservice-questionbankcategoryresponse-a375c670a2.md); Type: object
  
    Type: null

- 422: Validation Error

Content type: application/json

Type: object

Schema: [SurveyService_HTTPValidationError](/api-reference/schemas/surveyservice-httpvalidationerror-6237d5d2de.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [SurveyService_ValidationError](/api-reference/schemas/surveyservice-validationerror-21d2a3258e.md); Type: object

## Examples

### cURL

```bash
curl -X POST 'http://localhost:8001/api/v1/surveys/question-bank/questions' \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "category_id": "string",
  "question_type": "string",
  "name": "string",
  "label": "",
  "label_translations": {},
  "hint": "string",
  "hint_translations": {},
  "required": false,
  "question_config": {},
  "tags": [
    "string"
  ],
  "is_public": false
}'
```

### JavaScript

```javascript
const body = `{
  "category_id": "string",
  "question_type": "string",
  "name": "string",
  "label": "",
  "label_translations": {},
  "hint": "string",
  "hint_translations": {},
  "required": false,
  "question_config": {},
  "tags": [
    "string"
  ],
  "is_public": false
}`;

const response = await fetch('http://localhost:8001/api/v1/surveys/question-bank/questions', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
  },
  body,
});

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

### Python

```python
import requests

body = '''{
  "category_id": "string",
  "question_type": "string",
  "name": "string",
  "label": "",
  "label_translations": {},
  "hint": "string",
  "hint_translations": {},
  "required": false,
  "question_config": {},
  "tags": [
    "string"
  ],
  "is_public": false
}'''

response = requests.post(
    'http://localhost:8001/api/v1/surveys/question-bank/questions',
    data=body.encode('utf-8'),
    headers={
        'Content-Type': 'application/json',
    },
)
print(response.text)
```


## Get Question

`GET /api/v1/surveys/question-bank/questions/{question_id}`

Get question details.
Permission: template:create or survey:create or template:manage or survey:manage

Authentication: no security requirement declared for this operation.

Parameters:

- `question_id` (path, string, required)
  Type: string

Responses:

- 200: Successful Response

Content type: application/json

Type: object

Schema: [SurveyService_QuestionResponse](/api-reference/schemas/surveyservice-questionresponse-4b0eed1568.md)

- `id` (required)
  Type: string

- `tenant_id` (required)
  Type: string

- `category_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `question_type` (required)
  Type: string

- `name` (required)
  Type: string

- `label` (required)
  Type: string

- `label_translations` (required)
  Type: object
  
  Additional properties: 
    Type: string

- `hint` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `hint_translations` (required)
  Type: object
  
  Additional properties: 
    Type: string

- `required` (required)
  Type: boolean

- `question_config` (required)
  Type: object
  
  Additional properties: true

- `tags` (required)
  Type: array
  
  Items:
    Type: string

- `usage_count` (required)
  Type: integer

- `is_public` (required)
  Type: boolean

- `created_by` (required)
  Type: string

- `updated_by` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `created_at` (required)
  Type: string, date-time

- `updated_at` (required)
  Type: string, date-time

- `category` (optional)
  Type: unknown
  
  anyOf:
    Reference: [SurveyService_QuestionBankCategoryResponse](/api-reference/schemas/surveyservice-questionbankcategoryresponse-a375c670a2.md); Type: object
  
    Type: null

- 422: Validation Error

Content type: application/json

Type: object

Schema: [SurveyService_HTTPValidationError](/api-reference/schemas/surveyservice-httpvalidationerror-6237d5d2de.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [SurveyService_ValidationError](/api-reference/schemas/surveyservice-validationerror-21d2a3258e.md); Type: object

## Examples

### cURL

```bash
curl -X GET 'http://localhost:8001/api/v1/surveys/question-bank/questions/string'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8001/api/v1/surveys/question-bank/questions/string', {
  method: 'GET',
});

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

### Python

```python
import requests

response = requests.get('http://localhost:8001/api/v1/surveys/question-bank/questions/string')
print(response.text)
```


## Update Question

`PUT /api/v1/surveys/question-bank/questions/{question_id}`

Update a reusable question.
Permission: template:update or template:manage

Authentication: no security requirement declared for this operation.

Parameters:

- `question_id` (path, string, required)
  Type: string

Request body: application/json (required)

Type: object

Schema: [SurveyService_QuestionUpdate](/api-reference/schemas/surveyservice-questionupdate-77879266e2.md)

- `category_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `label` (optional)
  Type: unknown
  
  anyOf:
    Type: string
    
    maxLength: 5000
  
    Type: null

- `label_translations` (optional)
  Type: unknown
  
  anyOf:
    Type: object
    
    Additional properties: 
      Type: string
  
    Type: null

- `hint` (optional)
  Type: unknown
  
  anyOf:
    Type: string
    
    maxLength: 5000
  
    Type: null

- `hint_translations` (optional)
  Type: unknown
  
  anyOf:
    Type: object
    
    Additional properties: 
      Type: string
  
    Type: null

- `required` (optional)
  Type: unknown
  
  anyOf:
    Type: boolean
  
    Type: null

- `question_config` (optional)
  Type: unknown
  
  anyOf:
    Type: object
    
    Additional properties: true
  
    Type: null

- `tags` (optional)
  Type: unknown
  
  anyOf:
    Type: array
    
    Items:
      Type: string
  
    Type: null

- `is_public` (optional)
  Type: unknown
  
  anyOf:
    Type: boolean
  
    Type: null

Responses:

- 200: Successful Response

Content type: application/json

Type: object

Schema: [SurveyService_QuestionResponse](/api-reference/schemas/surveyservice-questionresponse-4b0eed1568.md)

- `id` (required)
  Type: string

- `tenant_id` (required)
  Type: string

- `category_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `question_type` (required)
  Type: string

- `name` (required)
  Type: string

- `label` (required)
  Type: string

- `label_translations` (required)
  Type: object
  
  Additional properties: 
    Type: string

- `hint` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `hint_translations` (required)
  Type: object
  
  Additional properties: 
    Type: string

- `required` (required)
  Type: boolean

- `question_config` (required)
  Type: object
  
  Additional properties: true

- `tags` (required)
  Type: array
  
  Items:
    Type: string

- `usage_count` (required)
  Type: integer

- `is_public` (required)
  Type: boolean

- `created_by` (required)
  Type: string

- `updated_by` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `created_at` (required)
  Type: string, date-time

- `updated_at` (required)
  Type: string, date-time

- `category` (optional)
  Type: unknown
  
  anyOf:
    Reference: [SurveyService_QuestionBankCategoryResponse](/api-reference/schemas/surveyservice-questionbankcategoryresponse-a375c670a2.md); Type: object
  
    Type: null

- 422: Validation Error

Content type: application/json

Type: object

Schema: [SurveyService_HTTPValidationError](/api-reference/schemas/surveyservice-httpvalidationerror-6237d5d2de.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [SurveyService_ValidationError](/api-reference/schemas/surveyservice-validationerror-21d2a3258e.md); Type: object

## Examples

### cURL

```bash
curl -X PUT 'http://localhost:8001/api/v1/surveys/question-bank/questions/string' \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "category_id": "string",
  "label": "string",
  "label_translations": {},
  "hint": "string",
  "hint_translations": {},
  "required": true,
  "question_config": {},
  "tags": [
    "string"
  ],
  "is_public": true
}'
```

### JavaScript

```javascript
const body = `{
  "category_id": "string",
  "label": "string",
  "label_translations": {},
  "hint": "string",
  "hint_translations": {},
  "required": true,
  "question_config": {},
  "tags": [
    "string"
  ],
  "is_public": true
}`;

const response = await fetch('http://localhost:8001/api/v1/surveys/question-bank/questions/string', {
  method: 'PUT',
  headers: {
    'Content-Type': 'application/json',
  },
  body,
});

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

### Python

```python
import requests

body = '''{
  "category_id": "string",
  "label": "string",
  "label_translations": {},
  "hint": "string",
  "hint_translations": {},
  "required": true,
  "question_config": {},
  "tags": [
    "string"
  ],
  "is_public": true
}'''

response = requests.put(
    'http://localhost:8001/api/v1/surveys/question-bank/questions/string',
    data=body.encode('utf-8'),
    headers={
        'Content-Type': 'application/json',
    },
)
print(response.text)
```


## Delete Question

`DELETE /api/v1/surveys/question-bank/questions/{question_id}`

Delete a reusable question.
Permission: template:delete or template:manage

Authentication: no security requirement declared for this operation.

Parameters:

- `question_id` (path, string, required)
  Type: string

Responses:

- 204: Successful Response

- 422: Validation Error

Content type: application/json

Type: object

Schema: [SurveyService_HTTPValidationError](/api-reference/schemas/surveyservice-httpvalidationerror-6237d5d2de.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [SurveyService_ValidationError](/api-reference/schemas/surveyservice-validationerror-21d2a3258e.md); Type: object

## Examples

### cURL

```bash
curl -X DELETE 'http://localhost:8001/api/v1/surveys/question-bank/questions/string'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8001/api/v1/surveys/question-bank/questions/string', {
  method: 'DELETE',
});

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

### Python

```python
import requests

response = requests.delete('http://localhost:8001/api/v1/surveys/question-bank/questions/string')
print(response.text)
```


## Import Questions

`POST /api/v1/surveys/question-bank/questions/import`

Import multiple questions from a CSV file.

Expected header: ``type,name,label,hint,required,tags``. Valid rows are
created and invalid rows are skipped with per-row errors (partial success).
Permission: template:create or template:manage

Authentication: no security requirement declared for this operation.

Request body: multipart/form-data (required)

Type: object

Schema: [SurveyService_Body_import_questions_api_v1_surveys_question_bank_questions_import_post](/api-reference/schemas/surveyservice-body-import-questions-api-v1-surveys-question-bank-questions-import-post-60ac611716.md)

- `file` (required)
  Type: string

- `category_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

Responses:

- 200: Successful Response

Content type: application/json

Type: object

Schema: [SurveyService_QuestionBulkImportResponse](/api-reference/schemas/surveyservice-questionbulkimportresponse-ccd59c5458.md)

- `total` (required)
  Type: integer

- `created` (required)
  Type: integer

- `failed` (required)
  Type: integer

- `errors` (optional)
  Type: array
  
  Items:
    Reference: [SurveyService_QuestionImportRowError](/api-reference/schemas/surveyservice-questionimportrowerror-f05a21fb87.md); Type: object

- 422: Validation Error

Content type: application/json

Type: object

Schema: [SurveyService_HTTPValidationError](/api-reference/schemas/surveyservice-httpvalidationerror-6237d5d2de.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [SurveyService_ValidationError](/api-reference/schemas/surveyservice-validationerror-21d2a3258e.md); Type: object

## Examples

### cURL

```bash
curl -X POST 'http://localhost:8001/api/v1/surveys/question-bank/questions/import' \
  --form-string 'file=string' \
  --form-string 'category_id=string'
```

### JavaScript

```javascript
const form = new FormData();
form.append('file', 'string');
form.append('category_id', 'string');
const response = await fetch('http://localhost:8001/api/v1/surveys/question-bank/questions/import', {
  method: 'POST',
  headers: {},
  body: form,
});
console.log(await response.text());
```

### Python

```python
import requests
from contextlib import ExitStack

with ExitStack() as stack:
    files = [
        ('file', (None, 'string')),
        ('category_id', (None, 'string')),
    ]
    response = requests.request('POST', 'http://localhost:8001/api/v1/surveys/question-bank/questions/import', headers={}, files=files)
    print(response.text)
```


## Add Question To Survey

`POST /api/v1/surveys/question-bank/add-to-survey`

Add a bank question to a survey's schema.
Permission: survey:create or survey:manage

Returns the full question JSON object that the frontend
can directly insert into the survey schema.

Authentication: no security requirement declared for this operation.

Request body: application/json (required)

Type: object

Schema: [SurveyService_AddQuestionToSurveyRequest](/api-reference/schemas/surveyservice-addquestiontosurveyrequest-77e3a6e34e.md)

- `question_id` (required)
  Type: string
  
  minLength: 1

- `survey_id` (required)
  Type: string
  
  minLength: 1

Responses:

- 200: Successful Response

Content type: application/json

Type: object

Schema: [SurveyService_AddQuestionToSurveyResponse](/api-reference/schemas/surveyservice-addquestiontosurveyresponse-ae78e0a89a.md)

- `survey_id` (required)
  Type: string

- `question_id` (required)
  Type: string

- `question_name` (required)
  Type: string

- `question` (required)
  Type: object
  
  Additional properties: true

- 422: Validation Error

Content type: application/json

Type: object

Schema: [SurveyService_HTTPValidationError](/api-reference/schemas/surveyservice-httpvalidationerror-6237d5d2de.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [SurveyService_ValidationError](/api-reference/schemas/surveyservice-validationerror-21d2a3258e.md); Type: object

## Examples

### cURL

```bash
curl -X POST 'http://localhost:8001/api/v1/surveys/question-bank/add-to-survey' \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "question_id": "string",
  "survey_id": "string"
}'
```

### JavaScript

```javascript
const body = `{
  "question_id": "string",
  "survey_id": "string"
}`;

const response = await fetch('http://localhost:8001/api/v1/surveys/question-bank/add-to-survey', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
  },
  body,
});

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

### Python

```python
import requests

body = '''{
  "question_id": "string",
  "survey_id": "string"
}'''

response = requests.post(
    'http://localhost:8001/api/v1/surveys/question-bank/add-to-survey',
    data=body.encode('utf-8'),
    headers={
        'Content-Type': 'application/json',
    },
)
print(response.text)
```


## List Surveys

`GET /api/v1/surveys`

List surveys for the tenant.

- Admin users (with survey:manage/survey:read) see all surveys in the tenant
- Non-admin users only see surveys they have explicit access to via form_access table
- Internal callers (sync-service) can pass filter_user_id to force form_access filtering
  for a specific user, regardless of caller permissions

Authentication: no security requirement declared for this operation.

Parameters:

- `skip` (query, integer, optional)
  Type: integer
  
  default: 0
  
  minimum: 0

- `limit` (query, integer, optional)
  Type: integer
  
  default: 20
  
  minimum: 1
  
  maximum: 100

- `status_filter` (query, unknown, optional)
  Type: unknown
  
  anyOf:
    Reference: [SurveyService_SurveyStatus](/api-reference/schemas/surveyservice-surveystatus-aecdb8324e.md); Type: string
    
    enum: ["draft","published","archived"]
  
    Type: null

- `project_id` (query, unknown, optional) - Filter surveys by project
  Type: unknown
  
  Filter surveys by project
  
  anyOf:
    Type: string, uuid
  
    Type: null

- `search` (query, unknown, optional) - Search surveys by name or description
  Type: unknown
  
  Search surveys by name or description
  
  anyOf:
    Type: string
  
    Type: null

- `tag_id` (query, unknown, optional) - Filter surveys by tag
  Type: unknown
  
  Filter surveys by tag
  
  anyOf:
    Type: string, uuid
  
    Type: null

- `workspace_id` (query, unknown, optional) - Filter surveys by workspace
  Type: unknown
  
  Filter surveys by workspace
  
  anyOf:
    Type: string, uuid
  
    Type: null

- `updated_after` (query, unknown, optional) - Only surveys updated after this timezone-aware instant
  Type: unknown
  
  Only surveys updated after this timezone-aware instant
  
  anyOf:
    Type: string, date-time
  
    Type: null

- `filter_user_id` (query, unknown, optional) - Filter by user ID (forced form_access check for internal callers like sync-service)
  Type: unknown
  
  Filter by user ID (forced form_access check for internal callers like sync-service)
  
  anyOf:
    Type: string, uuid
  
    Type: null

Responses:

- 200: Successful Response

Content type: application/json

Type: object

Schema: [SurveyService_SurveyListResponse](/api-reference/schemas/surveyservice-surveylistresponse-6f76aa4818.md)

- `items` (required)
  Type: array
  
  Items:
    Reference: [SurveyService_SurveyResponse](/api-reference/schemas/surveyservice-surveyresponse-acaa084535.md); Type: object

- `total` (required)
  Type: integer

- `limit` (required)
  Type: integer

- `skip` (required)
  Type: integer

- `has_next` (required)
  Type: boolean

- `has_previous` (required)
  Type: boolean

- 422: Validation Error

Content type: application/json

Type: object

Schema: [SurveyService_HTTPValidationError](/api-reference/schemas/surveyservice-httpvalidationerror-6237d5d2de.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [SurveyService_ValidationError](/api-reference/schemas/surveyservice-validationerror-21d2a3258e.md); Type: object

## Examples

### cURL

```bash
curl -X GET 'http://localhost:8001/api/v1/surveys?skip=0&limit=20'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8001/api/v1/surveys?skip=0&limit=20', {
  method: 'GET',
});

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

### Python

```python
import requests

response = requests.get('http://localhost:8001/api/v1/surveys?skip=0&limit=20')
print(response.text)
```


## Create Survey

`POST /api/v1/surveys`

Create a new survey.

Requires project_id which must be verified against workspace-service.
Enforces survey.max_surveys limit via plan-enforcement-sdk.

Authentication: no security requirement declared for this operation.

Request body: application/json (required)

Type: object

Schema: [SurveyService_SurveyCreate](/api-reference/schemas/surveyservice-surveycreate-f6b9b7b4ee.md)

- `name` (required)
  Type: string
  
  minLength: 1
  
  maxLength: 255

- `description` (optional)
  Type: unknown
  
  anyOf:
    Type: string
    
    maxLength: 5000
  
    Type: null

- `workspace_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string, uuid
  
    Type: null

- `project_id` (required)
  Type: string, uuid

- `is_anonymous` (optional)
  Type: boolean
  
  default: false

- `allow_multiple_responses` (optional)
  Type: boolean
  
  default: false

- `schema` (optional)
  Type: unknown
  
  anyOf:
    Reference: [SurveyService_SurveySchema](/api-reference/schemas/surveyservice-surveyschema-bf82311926.md); Type: object
    
    Complete XLSForm-compatible survey schema.
    Stored in JSONB column in survey_versions table.
    Includes support for custom lookups worksheet for cascading selects.
    
    Note: 'title', 'version', 'description' and 'id' fields are accepted for
    backwards compatibility with frontend schema transformations but are not
    required for storage (they're derived from the survey/version metadata).
  
    Type: null

- `open_at` (optional)
  Type: unknown
  
  anyOf:
    Type: string, date-time
  
    Type: null

- `close_at` (optional)
  Type: unknown
  
  anyOf:
    Type: string, date-time
  
    Type: null

- `scheduling_enabled` (optional)
  Type: boolean
  
  default: false

Responses:

- 201: Successful Response

Content type: application/json

Type: object

Schema: [SurveyService_SurveyResponse](/api-reference/schemas/surveyservice-surveyresponse-acaa084535.md)

- `id` (required)
  Type: string, uuid

- `tenant_id` (required)
  Type: string, uuid

- `workspace_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string, uuid
  
    Type: null

- `project_id` (required)
  Type: string, uuid

- `name` (required)
  Type: string

- `description` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `status` (required)
  Type: string

- `is_anonymous` (required)
  Type: boolean

- `allow_multiple_responses` (required)
  Type: boolean

- `survey_code` (optional)
  Type: unknown
  
  anyOf:
    Type: integer
  
    Type: null

- `tags` (optional)
  Type: array
  
  Items:
    Reference: [SurveyService_TagResponse](/api-reference/schemas/surveyservice-tagresponse-1b11fe3a5a.md); Type: object

- `created_at` (required)
  Type: string, date-time

- `updated_at` (required)
  Type: string, date-time

- `created_by` (required)
  Type: string, uuid

- `closed_at` (optional)
  Type: unknown
  
  anyOf:
    Type: string, date-time
  
    Type: null

- `open_at` (optional)
  Type: unknown
  
  anyOf:
    Type: string, date-time
  
    Type: null

- `close_at` (optional)
  Type: unknown
  
  anyOf:
    Type: string, date-time
  
    Type: null

- `scheduling_enabled` (optional)
  Type: boolean
  
  default: false

- `is_open` (optional)
  Type: boolean
  
  default: false

- `schema` (optional)
  Type: unknown
  
  anyOf:
    Reference: [SurveyService_SurveySchemaResponse](/api-reference/schemas/surveyservice-surveyschemaresponse-5750fea8e8.md); Type: object
    
    Response model for survey schema
  
    Type: null

- `project_status` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `project_has_production_activity` (optional)
  Type: unknown
  
  anyOf:
    Type: boolean
  
    Type: null

- `project_production_activity_at` (optional)
  Type: unknown
  
  anyOf:
    Type: string, date-time
  
    Type: null

- 422: Validation Error

Content type: application/json

Type: object

Schema: [SurveyService_HTTPValidationError](/api-reference/schemas/surveyservice-httpvalidationerror-6237d5d2de.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [SurveyService_ValidationError](/api-reference/schemas/surveyservice-validationerror-21d2a3258e.md); Type: object

## Examples

### cURL

```bash
curl -X POST 'http://localhost:8001/api/v1/surveys' \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "name": "string",
  "description": "string",
  "workspace_id": "550e8400-e29b-41d4-a716-446655440000",
  "project_id": "550e8400-e29b-41d4-a716-446655440000",
  "is_anonymous": false,
  "allow_multiple_responses": false,
  "schema": {
    "settings": {
      "form_title": "string",
      "form_id": "string",
      "version": "string",
      "defaultLanguage": "en",
      "languages": [
        "string"
      ],
      "availableLanguages": [
        "string"
      ],
      "instanceName": "string",
      "submissionUrl": "string"
    },
    "choices": [
      {
        "list_name": "string",
        "name": "string",
        "label": "string",
        "labelTranslations": {},
        "media_file": "string",
        "constraint": "string"
      }
    ],
    "questions": [
      {
        "type": "text",
        "name": "string",
        "label": "",
        "required": false,
        "hint": "string",
        "labelTranslations": {},
        "hintTranslations": {},
        "default": "string",
        "order_index": 0,
        "additional_values": [
          "string"
        ],
        "read_only": false,
        "appearance": "string",
        "relevant": "string",
        "constraint": "string",
        "constraint_message": "string",
        "constraintMessageTranslations": {},
        "calculation": "string",
        "choices": "string",
        "choice_filter": "string",
        "choice_relation": "string",
        "repeat_count": "string",
        "questions": [],
        "calendar_config": {
          "mode": "monthly",
          "months_back": 12,
          "start_from": "today",
          "allow_future": false
        },
        "calendar_rules": [
          {
            "id": "string",
            "trigger_question": "string",
            "target_column": "string",
            "value_source": "constant",
            "source_value": "string",
            "backfill_months": 1,
            "backfill_anchor": "current_month",
            "map_values": {},
            "xpath_expression": "string",
            "enabled": true,
            "conditions": [
              {}
            ],
            "months_scope": {}
          }
        ],
        "columns": [
          {
            "key": "string",
            "type": "select_one",
            "label": "",
            "label_translations": {},
            "choices": [
              {}
            ],
            "relevant": "string"
          }
        ],
        "limit": {
          "min": 0,
          "max": 0
        },
        "paradata": [
          "string"
        ],
        "media_file": "string",
        "mediaAudio": "string",
        "mediaAudioSchema": {},
        "mediaAudioUrl": "string",
        "mediaAudioAssetId": "string",
        "mediaAudioUrlSchema": {},
        "mediaAudioAssetIdSchema": {},
        "deidentify": false,
        "unique_id": false,
        "lookups": "string"
      }
    ],
    "lookups": [
      {
        "lookup_name": "string",
        "key": "string",
        "value": "string",
        "parent_key": "string",
        "extra_data": {}
      }
    ],
    "lookup_data": [
      {}
    ]
  },
  "open_at": "2024-01-15T09:30:00Z",
  "close_at": "2024-01-15T09:30:00Z",
  "scheduling_enabled": false
}'
```

### JavaScript

```javascript
const body = `{
  "name": "string",
  "description": "string",
  "workspace_id": "550e8400-e29b-41d4-a716-446655440000",
  "project_id": "550e8400-e29b-41d4-a716-446655440000",
  "is_anonymous": false,
  "allow_multiple_responses": false,
  "schema": {
    "settings": {
      "form_title": "string",
      "form_id": "string",
      "version": "string",
      "defaultLanguage": "en",
      "languages": [
        "string"
      ],
      "availableLanguages": [
        "string"
      ],
      "instanceName": "string",
      "submissionUrl": "string"
    },
    "choices": [
      {
        "list_name": "string",
        "name": "string",
        "label": "string",
        "labelTranslations": {},
        "media_file": "string",
        "constraint": "string"
      }
    ],
    "questions": [
      {
        "type": "text",
        "name": "string",
        "label": "",
        "required": false,
        "hint": "string",
        "labelTranslations": {},
        "hintTranslations": {},
        "default": "string",
        "order_index": 0,
        "additional_values": [
          "string"
        ],
        "read_only": false,
        "appearance": "string",
        "relevant": "string",
        "constraint": "string",
        "constraint_message": "string",
        "constraintMessageTranslations": {},
        "calculation": "string",
        "choices": "string",
        "choice_filter": "string",
        "choice_relation": "string",
        "repeat_count": "string",
        "questions": [],
        "calendar_config": {
          "mode": "monthly",
          "months_back": 12,
          "start_from": "today",
          "allow_future": false
        },
        "calendar_rules": [
          {
            "id": "string",
            "trigger_question": "string",
            "target_column": "string",
            "value_source": "constant",
            "source_value": "string",
            "backfill_months": 1,
            "backfill_anchor": "current_month",
            "map_values": {},
            "xpath_expression": "string",
            "enabled": true,
            "conditions": [
              {}
            ],
            "months_scope": {}
          }
        ],
        "columns": [
          {
            "key": "string",
            "type": "select_one",
            "label": "",
            "label_translations": {},
            "choices": [
              {}
            ],
            "relevant": "string"
          }
        ],
        "limit": {
          "min": 0,
          "max": 0
        },
        "paradata": [
          "string"
        ],
        "media_file": "string",
        "mediaAudio": "string",
        "mediaAudioSchema": {},
        "mediaAudioUrl": "string",
        "mediaAudioAssetId": "string",
        "mediaAudioUrlSchema": {},
        "mediaAudioAssetIdSchema": {},
        "deidentify": false,
        "unique_id": false,
        "lookups": "string"
      }
    ],
    "lookups": [
      {
        "lookup_name": "string",
        "key": "string",
        "value": "string",
        "parent_key": "string",
        "extra_data": {}
      }
    ],
    "lookup_data": [
      {}
    ]
  },
  "open_at": "2024-01-15T09:30:00Z",
  "close_at": "2024-01-15T09:30:00Z",
  "scheduling_enabled": false
}`;

const response = await fetch('http://localhost:8001/api/v1/surveys', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
  },
  body,
});

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

### Python

```python
import requests

body = '''{
  "name": "string",
  "description": "string",
  "workspace_id": "550e8400-e29b-41d4-a716-446655440000",
  "project_id": "550e8400-e29b-41d4-a716-446655440000",
  "is_anonymous": false,
  "allow_multiple_responses": false,
  "schema": {
    "settings": {
      "form_title": "string",
      "form_id": "string",
      "version": "string",
      "defaultLanguage": "en",
      "languages": [
        "string"
      ],
      "availableLanguages": [
        "string"
      ],
      "instanceName": "string",
      "submissionUrl": "string"
    },
    "choices": [
      {
        "list_name": "string",
        "name": "string",
        "label": "string",
        "labelTranslations": {},
        "media_file": "string",
        "constraint": "string"
      }
    ],
    "questions": [
      {
        "type": "text",
        "name": "string",
        "label": "",
        "required": false,
        "hint": "string",
        "labelTranslations": {},
        "hintTranslations": {},
        "default": "string",
        "order_index": 0,
        "additional_values": [
          "string"
        ],
        "read_only": false,
        "appearance": "string",
        "relevant": "string",
        "constraint": "string",
        "constraint_message": "string",
        "constraintMessageTranslations": {},
        "calculation": "string",
        "choices": "string",
        "choice_filter": "string",
        "choice_relation": "string",
        "repeat_count": "string",
        "questions": [],
        "calendar_config": {
          "mode": "monthly",
          "months_back": 12,
          "start_from": "today",
          "allow_future": false
        },
        "calendar_rules": [
          {
            "id": "string",
            "trigger_question": "string",
            "target_column": "string",
            "value_source": "constant",
            "source_value": "string",
            "backfill_months": 1,
            "backfill_anchor": "current_month",
            "map_values": {},
            "xpath_expression": "string",
            "enabled": true,
            "conditions": [
              {}
            ],
            "months_scope": {}
          }
        ],
        "columns": [
          {
            "key": "string",
            "type": "select_one",
            "label": "",
            "label_translations": {},
            "choices": [
              {}
            ],
            "relevant": "string"
          }
        ],
        "limit": {
          "min": 0,
          "max": 0
        },
        "paradata": [
          "string"
        ],
        "media_file": "string",
        "mediaAudio": "string",
        "mediaAudioSchema": {},
        "mediaAudioUrl": "string",
        "mediaAudioAssetId": "string",
        "mediaAudioUrlSchema": {},
        "mediaAudioAssetIdSchema": {},
        "deidentify": false,
        "unique_id": false,
        "lookups": "string"
      }
    ],
    "lookups": [
      {
        "lookup_name": "string",
        "key": "string",
        "value": "string",
        "parent_key": "string",
        "extra_data": {}
      }
    ],
    "lookup_data": [
      {}
    ]
  },
  "open_at": "2024-01-15T09:30:00Z",
  "close_at": "2024-01-15T09:30:00Z",
  "scheduling_enabled": false
}'''

response = requests.post(
    'http://localhost:8001/api/v1/surveys',
    data=body.encode('utf-8'),
    headers={
        'Content-Type': 'application/json',
    },
)
print(response.text)
```


## Get Survey

`GET /api/v1/surveys/{survey_id}`

Get a specific survey by ID.

Authentication: no security requirement declared for this operation.

Parameters:

- `survey_id` (path, string, uuid, required)
  Type: string, uuid

Responses:

- 200: Successful Response

Content type: application/json

Type: object

Schema: [SurveyService_SurveyResponse](/api-reference/schemas/surveyservice-surveyresponse-acaa084535.md)

- `id` (required)
  Type: string, uuid

- `tenant_id` (required)
  Type: string, uuid

- `workspace_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string, uuid
  
    Type: null

- `project_id` (required)
  Type: string, uuid

- `name` (required)
  Type: string

- `description` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `status` (required)
  Type: string

- `is_anonymous` (required)
  Type: boolean

- `allow_multiple_responses` (required)
  Type: boolean

- `survey_code` (optional)
  Type: unknown
  
  anyOf:
    Type: integer
  
    Type: null

- `tags` (optional)
  Type: array
  
  Items:
    Reference: [SurveyService_TagResponse](/api-reference/schemas/surveyservice-tagresponse-1b11fe3a5a.md); Type: object

- `created_at` (required)
  Type: string, date-time

- `updated_at` (required)
  Type: string, date-time

- `created_by` (required)
  Type: string, uuid

- `closed_at` (optional)
  Type: unknown
  
  anyOf:
    Type: string, date-time
  
    Type: null

- `open_at` (optional)
  Type: unknown
  
  anyOf:
    Type: string, date-time
  
    Type: null

- `close_at` (optional)
  Type: unknown
  
  anyOf:
    Type: string, date-time
  
    Type: null

- `scheduling_enabled` (optional)
  Type: boolean
  
  default: false

- `is_open` (optional)
  Type: boolean
  
  default: false

- `schema` (optional)
  Type: unknown
  
  anyOf:
    Reference: [SurveyService_SurveySchemaResponse](/api-reference/schemas/surveyservice-surveyschemaresponse-5750fea8e8.md); Type: object
    
    Response model for survey schema
  
    Type: null

- `project_status` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `project_has_production_activity` (optional)
  Type: unknown
  
  anyOf:
    Type: boolean
  
    Type: null

- `project_production_activity_at` (optional)
  Type: unknown
  
  anyOf:
    Type: string, date-time
  
    Type: null

- 422: Validation Error

Content type: application/json

Type: object

Schema: [SurveyService_HTTPValidationError](/api-reference/schemas/surveyservice-httpvalidationerror-6237d5d2de.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [SurveyService_ValidationError](/api-reference/schemas/surveyservice-validationerror-21d2a3258e.md); Type: object

## Examples

### cURL

```bash
curl -X GET 'http://localhost:8001/api/v1/surveys/550e8400-e29b-41d4-a716-446655440000'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8001/api/v1/surveys/550e8400-e29b-41d4-a716-446655440000', {
  method: 'GET',
});

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

### Python

```python
import requests

response = requests.get('http://localhost:8001/api/v1/surveys/550e8400-e29b-41d4-a716-446655440000')
print(response.text)
```


## Update Survey

`PUT /api/v1/surveys/{survey_id}`

Update survey metadata (not the schema).

Authentication: no security requirement declared for this operation.

Parameters:

- `survey_id` (path, string, uuid, required)
  Type: string, uuid

Request body: application/json (required)

Type: object

Schema: [SurveyService_SurveyUpdate](/api-reference/schemas/surveyservice-surveyupdate-54c313a7cc.md)

- `name` (optional)
  Type: unknown
  
  anyOf:
    Type: string
    
    minLength: 1
    
    maxLength: 255
  
    Type: null

- `description` (optional)
  Type: unknown
  
  anyOf:
    Type: string
    
    maxLength: 5000
  
    Type: null

- `is_anonymous` (optional)
  Type: unknown
  
  anyOf:
    Type: boolean
  
    Type: null

- `allow_multiple_responses` (optional)
  Type: unknown
  
  anyOf:
    Type: boolean
  
    Type: null

- `open_at` (optional)
  Type: unknown
  
  anyOf:
    Type: string, date-time
  
    Type: null

- `close_at` (optional)
  Type: unknown
  
  anyOf:
    Type: string, date-time
  
    Type: null

- `scheduling_enabled` (optional)
  Type: unknown
  
  anyOf:
    Type: boolean
  
    Type: null

Responses:

- 200: Successful Response

Content type: application/json

Type: object

Schema: [SurveyService_SurveyResponse](/api-reference/schemas/surveyservice-surveyresponse-acaa084535.md)

- `id` (required)
  Type: string, uuid

- `tenant_id` (required)
  Type: string, uuid

- `workspace_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string, uuid
  
    Type: null

- `project_id` (required)
  Type: string, uuid

- `name` (required)
  Type: string

- `description` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `status` (required)
  Type: string

- `is_anonymous` (required)
  Type: boolean

- `allow_multiple_responses` (required)
  Type: boolean

- `survey_code` (optional)
  Type: unknown
  
  anyOf:
    Type: integer
  
    Type: null

- `tags` (optional)
  Type: array
  
  Items:
    Reference: [SurveyService_TagResponse](/api-reference/schemas/surveyservice-tagresponse-1b11fe3a5a.md); Type: object

- `created_at` (required)
  Type: string, date-time

- `updated_at` (required)
  Type: string, date-time

- `created_by` (required)
  Type: string, uuid

- `closed_at` (optional)
  Type: unknown
  
  anyOf:
    Type: string, date-time
  
    Type: null

- `open_at` (optional)
  Type: unknown
  
  anyOf:
    Type: string, date-time
  
    Type: null

- `close_at` (optional)
  Type: unknown
  
  anyOf:
    Type: string, date-time
  
    Type: null

- `scheduling_enabled` (optional)
  Type: boolean
  
  default: false

- `is_open` (optional)
  Type: boolean
  
  default: false

- `schema` (optional)
  Type: unknown
  
  anyOf:
    Reference: [SurveyService_SurveySchemaResponse](/api-reference/schemas/surveyservice-surveyschemaresponse-5750fea8e8.md); Type: object
    
    Response model for survey schema
  
    Type: null

- `project_status` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `project_has_production_activity` (optional)
  Type: unknown
  
  anyOf:
    Type: boolean
  
    Type: null

- `project_production_activity_at` (optional)
  Type: unknown
  
  anyOf:
    Type: string, date-time
  
    Type: null

- 422: Validation Error

Content type: application/json

Type: object

Schema: [SurveyService_HTTPValidationError](/api-reference/schemas/surveyservice-httpvalidationerror-6237d5d2de.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [SurveyService_ValidationError](/api-reference/schemas/surveyservice-validationerror-21d2a3258e.md); Type: object

## Examples

### cURL

```bash
curl -X PUT 'http://localhost:8001/api/v1/surveys/550e8400-e29b-41d4-a716-446655440000' \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "name": "string",
  "description": "string",
  "is_anonymous": true,
  "allow_multiple_responses": true,
  "open_at": "2024-01-15T09:30:00Z",
  "close_at": "2024-01-15T09:30:00Z",
  "scheduling_enabled": true
}'
```

### JavaScript

```javascript
const body = `{
  "name": "string",
  "description": "string",
  "is_anonymous": true,
  "allow_multiple_responses": true,
  "open_at": "2024-01-15T09:30:00Z",
  "close_at": "2024-01-15T09:30:00Z",
  "scheduling_enabled": true
}`;

const response = await fetch('http://localhost:8001/api/v1/surveys/550e8400-e29b-41d4-a716-446655440000', {
  method: 'PUT',
  headers: {
    'Content-Type': 'application/json',
  },
  body,
});

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

### Python

```python
import requests

body = '''{
  "name": "string",
  "description": "string",
  "is_anonymous": true,
  "allow_multiple_responses": true,
  "open_at": "2024-01-15T09:30:00Z",
  "close_at": "2024-01-15T09:30:00Z",
  "scheduling_enabled": true
}'''

response = requests.put(
    'http://localhost:8001/api/v1/surveys/550e8400-e29b-41d4-a716-446655440000',
    data=body.encode('utf-8'),
    headers={
        'Content-Type': 'application/json',
    },
)
print(response.text)
```


## Delete Survey

`DELETE /api/v1/surveys/{survey_id}`

Soft delete a survey (sets status to DELETED).

Authentication: no security requirement declared for this operation.

Parameters:

- `survey_id` (path, string, uuid, required)
  Type: string, uuid

Responses:

- 202: Successful Response

Content type: application/json

Type: unknown

- 422: Validation Error

Content type: application/json

Type: object

Schema: [SurveyService_HTTPValidationError](/api-reference/schemas/surveyservice-httpvalidationerror-6237d5d2de.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [SurveyService_ValidationError](/api-reference/schemas/surveyservice-validationerror-21d2a3258e.md); Type: object

## Examples

### cURL

```bash
curl -X DELETE 'http://localhost:8001/api/v1/surveys/550e8400-e29b-41d4-a716-446655440000'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8001/api/v1/surveys/550e8400-e29b-41d4-a716-446655440000', {
  method: 'DELETE',
});

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

### Python

```python
import requests

response = requests.delete('http://localhost:8001/api/v1/surveys/550e8400-e29b-41d4-a716-446655440000')
print(response.text)
```


## Update Survey Status

`PATCH /api/v1/surveys/{survey_id}/status`

Update survey status (DRAFT, PUBLISHED, ARCHIVED).

Authentication: no security requirement declared for this operation.

Parameters:

- `survey_id` (path, string, uuid, required)
  Type: string, uuid

Request body: application/json (required)

Type: object

Schema: [SurveyService_SurveyStatusUpdate](/api-reference/schemas/surveyservice-surveystatusupdate-9af9f2648c.md)

- `status` (required)
  Reference: [SurveyService_SurveyStatus](/api-reference/schemas/surveyservice-surveystatus-aecdb8324e.md); Type: string
  
  enum: ["draft","published","archived"]

Responses:

- 200: Successful Response

Content type: application/json

Type: object

Schema: [SurveyService_SurveyResponse](/api-reference/schemas/surveyservice-surveyresponse-acaa084535.md)

- `id` (required)
  Type: string, uuid

- `tenant_id` (required)
  Type: string, uuid

- `workspace_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string, uuid
  
    Type: null

- `project_id` (required)
  Type: string, uuid

- `name` (required)
  Type: string

- `description` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `status` (required)
  Type: string

- `is_anonymous` (required)
  Type: boolean

- `allow_multiple_responses` (required)
  Type: boolean

- `survey_code` (optional)
  Type: unknown
  
  anyOf:
    Type: integer
  
    Type: null

- `tags` (optional)
  Type: array
  
  Items:
    Reference: [SurveyService_TagResponse](/api-reference/schemas/surveyservice-tagresponse-1b11fe3a5a.md); Type: object

- `created_at` (required)
  Type: string, date-time

- `updated_at` (required)
  Type: string, date-time

- `created_by` (required)
  Type: string, uuid

- `closed_at` (optional)
  Type: unknown
  
  anyOf:
    Type: string, date-time
  
    Type: null

- `open_at` (optional)
  Type: unknown
  
  anyOf:
    Type: string, date-time
  
    Type: null

- `close_at` (optional)
  Type: unknown
  
  anyOf:
    Type: string, date-time
  
    Type: null

- `scheduling_enabled` (optional)
  Type: boolean
  
  default: false

- `is_open` (optional)
  Type: boolean
  
  default: false

- `schema` (optional)
  Type: unknown
  
  anyOf:
    Reference: [SurveyService_SurveySchemaResponse](/api-reference/schemas/surveyservice-surveyschemaresponse-5750fea8e8.md); Type: object
    
    Response model for survey schema
  
    Type: null

- `project_status` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `project_has_production_activity` (optional)
  Type: unknown
  
  anyOf:
    Type: boolean
  
    Type: null

- `project_production_activity_at` (optional)
  Type: unknown
  
  anyOf:
    Type: string, date-time
  
    Type: null

- 422: Validation Error

Content type: application/json

Type: object

Schema: [SurveyService_HTTPValidationError](/api-reference/schemas/surveyservice-httpvalidationerror-6237d5d2de.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [SurveyService_ValidationError](/api-reference/schemas/surveyservice-validationerror-21d2a3258e.md); Type: object

## Examples

### cURL

```bash
curl -X PATCH 'http://localhost:8001/api/v1/surveys/550e8400-e29b-41d4-a716-446655440000/status' \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "status": "draft"
}'
```

### JavaScript

```javascript
const body = `{
  "status": "draft"
}`;

const response = await fetch('http://localhost:8001/api/v1/surveys/550e8400-e29b-41d4-a716-446655440000/status', {
  method: 'PATCH',
  headers: {
    'Content-Type': 'application/json',
  },
  body,
});

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

### Python

```python
import requests

body = '''{
  "status": "draft"
}'''

response = requests.patch(
    'http://localhost:8001/api/v1/surveys/550e8400-e29b-41d4-a716-446655440000/status',
    data=body.encode('utf-8'),
    headers={
        'Content-Type': 'application/json',
    },
)
print(response.text)
```


## Duplicate Survey

`POST /api/v1/surveys/{survey_id}/duplicate`

Duplicate an existing survey including schema, settings, and lookups.

- Creates a new survey with copied data (schema, settings, choices, lookups)
- Resets status to DRAFT for duplicated survey
- Generates new survey_code and RID counter
- Optionally copies form access rules if copy_access_settings=True
- Does NOT copy version history (starts fresh)

Authentication: no security requirement declared for this operation.

Parameters:

- `survey_id` (path, string, uuid, required)
  Type: string, uuid

- `new_name` (query, unknown, optional)
  Type: unknown
  
  anyOf:
    Type: string
    
    minLength: 1
    
    maxLength: 255
  
    Type: null

- `copy_access_settings` (query, boolean, optional)
  Type: boolean
  
  default: false

Responses:

- 201: Successful Response

Content type: application/json

Type: unknown

- 422: Validation Error

Content type: application/json

Type: object

Schema: [SurveyService_HTTPValidationError](/api-reference/schemas/surveyservice-httpvalidationerror-6237d5d2de.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [SurveyService_ValidationError](/api-reference/schemas/surveyservice-validationerror-21d2a3258e.md); Type: object

## Examples

### cURL

```bash
curl -X POST 'http://localhost:8001/api/v1/surveys/550e8400-e29b-41d4-a716-446655440000/duplicate?copy_access_settings=false'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8001/api/v1/surveys/550e8400-e29b-41d4-a716-446655440000/duplicate?copy_access_settings=false', {
  method: 'POST',
});

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

### Python

```python
import requests

response = requests.post('http://localhost:8001/api/v1/surveys/550e8400-e29b-41d4-a716-446655440000/duplicate?copy_access_settings=false')
print(response.text)
```


## Update Survey Schedule

`PUT /api/v1/surveys/{survey_id}/schedule`

Update survey open/close schedule.

Authentication: no security requirement declared for this operation.

Parameters:

- `survey_id` (path, string, uuid, required)
  Type: string, uuid

Request body: application/json (required)

Type: object

Schema: [SurveyService_SurveyScheduleRequest](/api-reference/schemas/surveyservice-surveyschedulerequest-a75c775265.md)

- `open_at` (optional)
  Type: unknown
  
  anyOf:
    Type: string, date-time
  
    Type: null

- `close_at` (optional)
  Type: unknown
  
  anyOf:
    Type: string, date-time
  
    Type: null

- `scheduling_enabled` (optional)
  Type: boolean
  
  default: true

Responses:

- 200: Successful Response

Content type: application/json

Type: object

Schema: [SurveyService_SurveyResponse](/api-reference/schemas/surveyservice-surveyresponse-acaa084535.md)

- `id` (required)
  Type: string, uuid

- `tenant_id` (required)
  Type: string, uuid

- `workspace_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string, uuid
  
    Type: null

- `project_id` (required)
  Type: string, uuid

- `name` (required)
  Type: string

- `description` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `status` (required)
  Type: string

- `is_anonymous` (required)
  Type: boolean

- `allow_multiple_responses` (required)
  Type: boolean

- `survey_code` (optional)
  Type: unknown
  
  anyOf:
    Type: integer
  
    Type: null

- `tags` (optional)
  Type: array
  
  Items:
    Reference: [SurveyService_TagResponse](/api-reference/schemas/surveyservice-tagresponse-1b11fe3a5a.md); Type: object

- `created_at` (required)
  Type: string, date-time

- `updated_at` (required)
  Type: string, date-time

- `created_by` (required)
  Type: string, uuid

- `closed_at` (optional)
  Type: unknown
  
  anyOf:
    Type: string, date-time
  
    Type: null

- `open_at` (optional)
  Type: unknown
  
  anyOf:
    Type: string, date-time
  
    Type: null

- `close_at` (optional)
  Type: unknown
  
  anyOf:
    Type: string, date-time
  
    Type: null

- `scheduling_enabled` (optional)
  Type: boolean
  
  default: false

- `is_open` (optional)
  Type: boolean
  
  default: false

- `schema` (optional)
  Type: unknown
  
  anyOf:
    Reference: [SurveyService_SurveySchemaResponse](/api-reference/schemas/surveyservice-surveyschemaresponse-5750fea8e8.md); Type: object
    
    Response model for survey schema
  
    Type: null

- `project_status` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `project_has_production_activity` (optional)
  Type: unknown
  
  anyOf:
    Type: boolean
  
    Type: null

- `project_production_activity_at` (optional)
  Type: unknown
  
  anyOf:
    Type: string, date-time
  
    Type: null

- 422: Validation Error

Content type: application/json

Type: object

Schema: [SurveyService_HTTPValidationError](/api-reference/schemas/surveyservice-httpvalidationerror-6237d5d2de.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [SurveyService_ValidationError](/api-reference/schemas/surveyservice-validationerror-21d2a3258e.md); Type: object

## Examples

### cURL

```bash
curl -X PUT 'http://localhost:8001/api/v1/surveys/550e8400-e29b-41d4-a716-446655440000/schedule' \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "open_at": "2024-01-15T09:30:00Z",
  "close_at": "2024-01-15T09:30:00Z",
  "scheduling_enabled": true
}'
```

### JavaScript

```javascript
const body = `{
  "open_at": "2024-01-15T09:30:00Z",
  "close_at": "2024-01-15T09:30:00Z",
  "scheduling_enabled": true
}`;

const response = await fetch('http://localhost:8001/api/v1/surveys/550e8400-e29b-41d4-a716-446655440000/schedule', {
  method: 'PUT',
  headers: {
    'Content-Type': 'application/json',
  },
  body,
});

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

### Python

```python
import requests

body = '''{
  "open_at": "2024-01-15T09:30:00Z",
  "close_at": "2024-01-15T09:30:00Z",
  "scheduling_enabled": true
}'''

response = requests.put(
    'http://localhost:8001/api/v1/surveys/550e8400-e29b-41d4-a716-446655440000/schedule',
    data=body.encode('utf-8'),
    headers={
        'Content-Type': 'application/json',
    },
)
print(response.text)
```


## Get Survey Schema

`GET /api/v1/surveys/{survey_id}/schema`

Get the survey design schema (form builder data).

Enriched with media audio URLs/asset IDs (deep copy — the stored draft
schema is never mutated) so the mobile fallback sync path
(GET /surveys/{id}/schema) delivers human audio the same way published
versions do.

Authentication: no security requirement declared for this operation.

Parameters:

- `survey_id` (path, string, uuid, required)
  Type: string, uuid

Responses:

- 200: Successful Response

Content type: application/json

Type: unknown

- 422: Validation Error

Content type: application/json

Type: object

Schema: [SurveyService_HTTPValidationError](/api-reference/schemas/surveyservice-httpvalidationerror-6237d5d2de.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [SurveyService_ValidationError](/api-reference/schemas/surveyservice-validationerror-21d2a3258e.md); Type: object

## Examples

### cURL

```bash
curl -X GET 'http://localhost:8001/api/v1/surveys/550e8400-e29b-41d4-a716-446655440000/schema'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8001/api/v1/surveys/550e8400-e29b-41d4-a716-446655440000/schema', {
  method: 'GET',
});

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

### Python

```python
import requests

response = requests.get('http://localhost:8001/api/v1/surveys/550e8400-e29b-41d4-a716-446655440000/schema')
print(response.text)
```


## Update Survey Schema

`PUT /api/v1/surveys/{survey_id}/schema`

Update the survey design schema (form builder data).

Authentication: no security requirement declared for this operation.

Parameters:

- `survey_id` (path, string, uuid, required)
  Type: string, uuid

Request body: application/json (required)

Type: object

Additional properties: true

Responses:

- 200: Successful Response

Content type: application/json

Type: unknown

- 422: Validation Error

Content type: application/json

Type: object

Schema: [SurveyService_HTTPValidationError](/api-reference/schemas/surveyservice-httpvalidationerror-6237d5d2de.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [SurveyService_ValidationError](/api-reference/schemas/surveyservice-validationerror-21d2a3258e.md); Type: object

## Examples

### cURL

```bash
curl -X PUT 'http://localhost:8001/api/v1/surveys/550e8400-e29b-41d4-a716-446655440000/schema' \
  -H 'Content-Type: application/json' \
  --data-raw '{}'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8001/api/v1/surveys/550e8400-e29b-41d4-a716-446655440000/schema', {
  method: 'PUT',
  headers: {
    'Content-Type': 'application/json',
  },
  body: '{}',
});

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

### Python

```python
import requests

response = requests.put(
    'http://localhost:8001/api/v1/surveys/550e8400-e29b-41d4-a716-446655440000/schema',
    data='{}'.encode('utf-8'),
    headers={
        'Content-Type': 'application/json',
    },
)
print(response.text)
```


## Get lookup data for auto-population

`GET /api/v1/surveys/{survey_id}/lookup-data`

Returns lookup data for form auto-population. Used by form-service to cache lookup data.

Authentication: no security requirement declared for this operation.

Parameters:

- `survey_id` (path, string, uuid, required)
  Type: string, uuid

- `version_id` (query, unknown, optional) - Specific version ID (optional)
  Type: unknown
  
  Specific version ID (optional)
  
  anyOf:
    Type: string, uuid
  
    Type: null

- `filter_user_id` (query, unknown, optional) - Filter lookup data for specific user's assigned triggers
  Type: unknown
  
  Filter lookup data for specific user's assigned triggers
  
  anyOf:
    Type: string, uuid
  
    Type: null

Responses:

- 200: Successful Response

Content type: application/json

Type: unknown

- 422: Validation Error

Content type: application/json

Type: object

Schema: [SurveyService_HTTPValidationError](/api-reference/schemas/surveyservice-httpvalidationerror-6237d5d2de.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [SurveyService_ValidationError](/api-reference/schemas/surveyservice-validationerror-21d2a3258e.md); Type: object

## Examples

### cURL

```bash
curl -X GET 'http://localhost:8001/api/v1/surveys/550e8400-e29b-41d4-a716-446655440000/lookup-data'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8001/api/v1/surveys/550e8400-e29b-41d4-a716-446655440000/lookup-data', {
  method: 'GET',
});

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

### Python

```python
import requests

response = requests.get('http://localhost:8001/api/v1/surveys/550e8400-e29b-41d4-a716-446655440000/lookup-data')
print(response.text)
```


## Import Xlsform

`POST /api/v1/surveys/import-xlsform`

Import a survey from an XLSForm Excel file (.xlsx).

The XLSForm file should contain the following worksheets:
- **survey** (required): Question definitions with columns: type, name, label, hint, required, etc.
- **choices** (optional): Choice lists for select_one/select_multiple questions
- **settings** (optional): Form metadata (form_title, form_id, version, etc.)
- **lookups** (optional, custom): External lookup data for cascading selects

Reference: https://xlsform.org/en/

The imported survey will be created in DRAFT status with the parsed schema.

Authentication: no security requirement declared for this operation.

Request body: multipart/form-data (required)

Type: object

Schema: [SurveyService_Body_import_xlsform_api_v1_surveys_import_xlsform_post](/api-reference/schemas/surveyservice-body-import-xlsform-api-v1-surveys-import-xlsform-post-b3f0fa6048.md)

- `file` (required)
  Type: string
  
  XLSForm Excel file (.xlsx)

- `name` (required)
  Type: string
  
  Survey name
  
  minLength: 1
  
  maxLength: 255

- `description` (optional)
  Type: unknown
  
  Survey description
  
  anyOf:
    Type: string
    
    maxLength: 5000
  
    Type: null

- `project_id` (required)
  Type: string, uuid
  
  Project ID from workspace-service

- `workspace_id` (required)
  Type: string, uuid
  
  Workspace ID for the project

- `is_anonymous` (optional)
  Type: boolean
  
  Whether responses are anonymous
  
  default: false

- `allow_multiple_responses` (optional)
  Type: boolean
  
  Allow multiple responses per user
  
  default: false

- `scheduling_enabled` (optional)
  Type: boolean
  
  Enable survey scheduling (auto open/close)
  
  default: false

- `open_at` (optional)
  Type: unknown
  
  Scheduled open timestamp (ISO 8601)
  
  anyOf:
    Type: string, date-time
  
    Type: null

- `close_at` (optional)
  Type: unknown
  
  Scheduled close timestamp (ISO 8601)
  
  anyOf:
    Type: string, date-time
  
    Type: null

Responses:

- 201: Successful Response

Content type: application/json

Type: object

Schema: [SurveyService_SurveyResponse](/api-reference/schemas/surveyservice-surveyresponse-acaa084535.md)

- `id` (required)
  Type: string, uuid

- `tenant_id` (required)
  Type: string, uuid

- `workspace_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string, uuid
  
    Type: null

- `project_id` (required)
  Type: string, uuid

- `name` (required)
  Type: string

- `description` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `status` (required)
  Type: string

- `is_anonymous` (required)
  Type: boolean

- `allow_multiple_responses` (required)
  Type: boolean

- `survey_code` (optional)
  Type: unknown
  
  anyOf:
    Type: integer
  
    Type: null

- `tags` (optional)
  Type: array
  
  Items:
    Reference: [SurveyService_TagResponse](/api-reference/schemas/surveyservice-tagresponse-1b11fe3a5a.md); Type: object

- `created_at` (required)
  Type: string, date-time

- `updated_at` (required)
  Type: string, date-time

- `created_by` (required)
  Type: string, uuid

- `closed_at` (optional)
  Type: unknown
  
  anyOf:
    Type: string, date-time
  
    Type: null

- `open_at` (optional)
  Type: unknown
  
  anyOf:
    Type: string, date-time
  
    Type: null

- `close_at` (optional)
  Type: unknown
  
  anyOf:
    Type: string, date-time
  
    Type: null

- `scheduling_enabled` (optional)
  Type: boolean
  
  default: false

- `is_open` (optional)
  Type: boolean
  
  default: false

- `schema` (optional)
  Type: unknown
  
  anyOf:
    Reference: [SurveyService_SurveySchemaResponse](/api-reference/schemas/surveyservice-surveyschemaresponse-5750fea8e8.md); Type: object
    
    Response model for survey schema
  
    Type: null

- `project_status` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `project_has_production_activity` (optional)
  Type: unknown
  
  anyOf:
    Type: boolean
  
    Type: null

- `project_production_activity_at` (optional)
  Type: unknown
  
  anyOf:
    Type: string, date-time
  
    Type: null

- 422: Validation Error

Content type: application/json

Type: object

Schema: [SurveyService_HTTPValidationError](/api-reference/schemas/surveyservice-httpvalidationerror-6237d5d2de.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [SurveyService_ValidationError](/api-reference/schemas/surveyservice-validationerror-21d2a3258e.md); Type: object

## Examples

### cURL

```bash
curl -X POST 'http://localhost:8001/api/v1/surveys/import-xlsform' \
  --form-string 'file=string' \
  --form-string 'name=string' \
  --form-string 'description=string' \
  --form-string 'project_id=550e8400-e29b-41d4-a716-446655440000' \
  --form-string 'workspace_id=550e8400-e29b-41d4-a716-446655440000' \
  --form-string 'is_anonymous=false' \
  --form-string 'allow_multiple_responses=false' \
  --form-string 'scheduling_enabled=false' \
  --form-string 'open_at=2024-01-15T09:30:00Z' \
  --form-string 'close_at=2024-01-15T09:30:00Z'
```

### JavaScript

```javascript
const form = new FormData();
form.append('file', 'string');
form.append('name', 'string');
form.append('description', 'string');
form.append('project_id', '550e8400-e29b-41d4-a716-446655440000');
form.append('workspace_id', '550e8400-e29b-41d4-a716-446655440000');
form.append('is_anonymous', 'false');
form.append('allow_multiple_responses', 'false');
form.append('scheduling_enabled', 'false');
form.append('open_at', '2024-01-15T09:30:00Z');
form.append('close_at', '2024-01-15T09:30:00Z');
const response = await fetch('http://localhost:8001/api/v1/surveys/import-xlsform', {
  method: 'POST',
  headers: {},
  body: form,
});
console.log(await response.text());
```

### Python

```python
import requests
from contextlib import ExitStack

with ExitStack() as stack:
    files = [
        ('file', (None, 'string')),
        ('name', (None, 'string')),
        ('description', (None, 'string')),
        ('project_id', (None, '550e8400-e29b-41d4-a716-446655440000')),
        ('workspace_id', (None, '550e8400-e29b-41d4-a716-446655440000')),
        ('is_anonymous', (None, 'false')),
        ('allow_multiple_responses', (None, 'false')),
        ('scheduling_enabled', (None, 'false')),
        ('open_at', (None, '2024-01-15T09:30:00Z')),
        ('close_at', (None, '2024-01-15T09:30:00Z')),
    ]
    response = requests.request('POST', 'http://localhost:8001/api/v1/surveys/import-xlsform', headers={}, files=files)
    print(response.text)
```


## Download a starter XLSForm template

`GET /api/v1/surveys/import-xlsform/download`

Download a starter .xlsx XLSForm workbook that can be filled in and re-imported via POST /surveys/import-xlsform.

Authentication: no security requirement declared for this operation.

Responses:

- 200: Successful Response

Content type: application/json

Type: unknown

## Examples

### cURL

```bash
curl -X GET 'http://localhost:8001/api/v1/surveys/import-xlsform/download'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8001/api/v1/surveys/import-xlsform/download', {
  method: 'GET',
});

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

### Python

```python
import requests

response = requests.get('http://localhost:8001/api/v1/surveys/import-xlsform/download')
print(response.text)
```


## Validate a single expression

`POST /api/v1/surveys/expressions/validate`

Validate a skip logic, constraint, or calculation expression against available fields.

Authentication: no security requirement declared for this operation.

Request body: application/json (required)

Type: object

Request body for expression validation endpoint.

Schema: [SurveyService_ExpressionValidationRequest](/api-reference/schemas/surveyservice-expressionvalidationrequest-851259c810.md)

- `expression` (required)
  Type: string
  
  The expression to validate (XPath format with ${field_name} references)

- `expression_type` (optional)
  Type: string
  
  Type of expression being validated
  
  default: "relevant"
  
  pattern: "^(relevant|constraint|calculation|default)$"

- `available_fields` (optional)
  Type: array
  
  List of available question/field names for reference validation
  
  Items:
    Type: string

Responses:

- 200: Successful Response

Content type: application/json

Type: object

Response from expression validation endpoint.

Schema: [SurveyService_ExpressionValidationResponse](/api-reference/schemas/surveyservice-expressionvalidationresponse-25d3eb1ba3.md)

- `is_valid` (required)
  Type: boolean

- `expression` (required)
  Type: string

- `expression_type` (required)
  Type: string

- `errors` (optional)
  Type: array
  
  Items:
    Reference: [SurveyService_ExpressionValidationError](/api-reference/schemas/surveyservice-expressionvalidationerror-d772685b6f.md); Type: object
    
    A single validation error for expression validation.

- 422: Validation Error

Content type: application/json

Type: object

Schema: [SurveyService_HTTPValidationError](/api-reference/schemas/surveyservice-httpvalidationerror-6237d5d2de.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [SurveyService_ValidationError](/api-reference/schemas/surveyservice-validationerror-21d2a3258e.md); Type: object

## Examples

### cURL

```bash
curl -X POST 'http://localhost:8001/api/v1/surveys/expressions/validate' \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "expression": "string",
  "expression_type": "relevant",
  "available_fields": [
    "string"
  ]
}'
```

### JavaScript

```javascript
const body = `{
  "expression": "string",
  "expression_type": "relevant",
  "available_fields": [
    "string"
  ]
}`;

const response = await fetch('http://localhost:8001/api/v1/surveys/expressions/validate', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
  },
  body,
});

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

### Python

```python
import requests

body = '''{
  "expression": "string",
  "expression_type": "relevant",
  "available_fields": [
    "string"
  ]
}'''

response = requests.post(
    'http://localhost:8001/api/v1/surveys/expressions/validate',
    data=body.encode('utf-8'),
    headers={
        'Content-Type': 'application/json',
    },
)
print(response.text)
```


## List Survey Media

`GET /api/v1/surveys/{survey_id}/media`

List all media assets for a survey.

Authentication: no security requirement declared for this operation.

Parameters:

- `survey_id` (path, string, uuid, required)
  Type: string, uuid

Responses:

- 200: Successful Response

Content type: application/json

Type: unknown

- 422: Validation Error

Content type: application/json

Type: object

Schema: [SurveyService_HTTPValidationError](/api-reference/schemas/surveyservice-httpvalidationerror-6237d5d2de.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [SurveyService_ValidationError](/api-reference/schemas/surveyservice-validationerror-21d2a3258e.md); Type: object

## Examples

### cURL

```bash
curl -X GET 'http://localhost:8001/api/v1/surveys/550e8400-e29b-41d4-a716-446655440000/media'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8001/api/v1/surveys/550e8400-e29b-41d4-a716-446655440000/media', {
  method: 'GET',
});

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

### Python

```python
import requests

response = requests.get('http://localhost:8001/api/v1/surveys/550e8400-e29b-41d4-a716-446655440000/media')
print(response.text)
```


## Upload Survey Media

`POST /api/v1/surveys/{survey_id}/media`

Upload media assets (images, videos, audio) for survey questions.

The uploaded file must be a ZIP containing media files referenced
in the survey schema's `media_file` field.

Media files are extracted and uploaded to the tenant's media library
via the media-service.

Returns list of uploaded files and any missing files referenced in schema.

Authentication: no security requirement declared for this operation.

Parameters:

- `survey_id` (path, string, uuid, required)
  Type: string, uuid

Request body: multipart/form-data (required)

Type: object

Schema: [SurveyService_Body_upload_survey_media_api_v1_surveys__survey_id__media_post](/api-reference/schemas/surveyservice-body-upload-survey-media-api-v1-surveys-survey-id-media-post-8a256a406b.md)

- `file` (required)
  Type: string
  
  ZIP file containing media assets

Responses:

- 201: Successful Response

Content type: application/json

Type: unknown

- 422: Validation Error

Content type: application/json

Type: object

Schema: [SurveyService_HTTPValidationError](/api-reference/schemas/surveyservice-httpvalidationerror-6237d5d2de.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [SurveyService_ValidationError](/api-reference/schemas/surveyservice-validationerror-21d2a3258e.md); Type: object

## Examples

### cURL

```bash
curl -X POST 'http://localhost:8001/api/v1/surveys/550e8400-e29b-41d4-a716-446655440000/media' \
  --form-string 'file=string'
```

### JavaScript

```javascript
const form = new FormData();
form.append('file', 'string');
const response = await fetch('http://localhost:8001/api/v1/surveys/550e8400-e29b-41d4-a716-446655440000/media', {
  method: 'POST',
  headers: {},
  body: form,
});
console.log(await response.text());
```

### Python

```python
import requests
from contextlib import ExitStack

with ExitStack() as stack:
    files = [
        ('file', (None, 'string')),
    ]
    response = requests.request('POST', 'http://localhost:8001/api/v1/surveys/550e8400-e29b-41d4-a716-446655440000/media', headers={}, files=files)
    print(response.text)
```


## List Versions

`GET /api/v1/surveys/{survey_id}/versions`

List all versions of a survey.

Authentication: no security requirement declared for this operation.

Parameters:

- `survey_id` (path, string, uuid, required)
  Type: string, uuid

Responses:

- 200: Successful Response

Content type: application/json

Type: array

Items:
  Type: unknown

- 422: Validation Error

Content type: application/json

Type: object

Schema: [SurveyService_HTTPValidationError](/api-reference/schemas/surveyservice-httpvalidationerror-6237d5d2de.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [SurveyService_ValidationError](/api-reference/schemas/surveyservice-validationerror-21d2a3258e.md); Type: object

## Examples

### cURL

```bash
curl -X GET 'http://localhost:8001/api/v1/surveys/550e8400-e29b-41d4-a716-446655440000/versions'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8001/api/v1/surveys/550e8400-e29b-41d4-a716-446655440000/versions', {
  method: 'GET',
});

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

### Python

```python
import requests

response = requests.get('http://localhost:8001/api/v1/surveys/550e8400-e29b-41d4-a716-446655440000/versions')
print(response.text)
```


## Create New Version

`POST /api/v1/surveys/{survey_id}/versions`

Create a new draft version of a survey.

- Clones schema from previous published version (if exists)
- Increments version number using semantic versioning (Major.Minor.Patch)
- Creates in DRAFT status only
- Sets is_immutable=False

Authentication: no security requirement declared for this operation.

Parameters:

- `survey_id` (path, string, uuid, required)
  Type: string, uuid

Request body: application/json

Type: unknown

anyOf:
  Reference: [SurveyService_SurveyVersionCreate](/api-reference/schemas/surveyservice-surveyversioncreate-18628b3dc4.md); Type: object
  
  DTO for creating a new survey version

  Type: null

Responses:

- 201: Successful Response

Content type: application/json

Type: object

Additional properties: true

- 422: Validation Error

Content type: application/json

Type: object

Schema: [SurveyService_HTTPValidationError](/api-reference/schemas/surveyservice-httpvalidationerror-6237d5d2de.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [SurveyService_ValidationError](/api-reference/schemas/surveyservice-validationerror-21d2a3258e.md); Type: object

## Examples

### cURL

```bash
curl -X POST 'http://localhost:8001/api/v1/surveys/550e8400-e29b-41d4-a716-446655440000/versions' \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "survey_id": "550e8400-e29b-41d4-a716-446655440000",
  "schema": {
    "settings": {
      "form_title": "string",
      "form_id": "string",
      "version": "string",
      "defaultLanguage": "en",
      "languages": [
        "string"
      ],
      "availableLanguages": [
        "string"
      ],
      "instanceName": "string",
      "submissionUrl": "string"
    },
    "choices": [
      {
        "list_name": "string",
        "name": "string",
        "label": "string",
        "labelTranslations": {},
        "media_file": "string",
        "constraint": "string"
      }
    ],
    "questions": [
      {
        "type": "text",
        "name": "string",
        "label": "",
        "required": false,
        "hint": "string",
        "labelTranslations": {},
        "hintTranslations": {},
        "default": "string",
        "order_index": 0,
        "additional_values": [
          "string"
        ],
        "read_only": false,
        "appearance": "string",
        "relevant": "string",
        "constraint": "string",
        "constraint_message": "string",
        "constraintMessageTranslations": {},
        "calculation": "string",
        "choices": "string",
        "choice_filter": "string",
        "choice_relation": "string",
        "repeat_count": "string",
        "questions": [],
        "calendar_config": {
          "mode": "monthly",
          "months_back": 12,
          "start_from": "today",
          "allow_future": false
        },
        "calendar_rules": [
          {
            "id": "string",
            "trigger_question": "string",
            "target_column": "string",
            "value_source": "constant",
            "source_value": "string",
            "backfill_months": 1,
            "backfill_anchor": "current_month",
            "map_values": {},
            "xpath_expression": "string",
            "enabled": true,
            "conditions": [
              {}
            ],
            "months_scope": {}
          }
        ],
        "columns": [
          {
            "key": "string",
            "type": "select_one",
            "label": "",
            "label_translations": {},
            "choices": [
              {}
            ],
            "relevant": "string"
          }
        ],
        "limit": {
          "min": 0,
          "max": 0
        },
        "paradata": [
          "string"
        ],
        "media_file": "string",
        "mediaAudio": "string",
        "mediaAudioSchema": {},
        "mediaAudioUrl": "string",
        "mediaAudioAssetId": "string",
        "mediaAudioUrlSchema": {},
        "mediaAudioAssetIdSchema": {},
        "deidentify": false,
        "unique_id": false,
        "lookups": "string"
      }
    ],
    "lookups": [
      {
        "lookup_name": "string",
        "key": "string",
        "value": "string",
        "parent_key": "string",
        "extra_data": {}
      }
    ],
    "lookup_data": [
      {}
    ]
  },
  "version": "string",
  "increment_type": "patch"
}'
```

### JavaScript

```javascript
const body = `{
  "survey_id": "550e8400-e29b-41d4-a716-446655440000",
  "schema": {
    "settings": {
      "form_title": "string",
      "form_id": "string",
      "version": "string",
      "defaultLanguage": "en",
      "languages": [
        "string"
      ],
      "availableLanguages": [
        "string"
      ],
      "instanceName": "string",
      "submissionUrl": "string"
    },
    "choices": [
      {
        "list_name": "string",
        "name": "string",
        "label": "string",
        "labelTranslations": {},
        "media_file": "string",
        "constraint": "string"
      }
    ],
    "questions": [
      {
        "type": "text",
        "name": "string",
        "label": "",
        "required": false,
        "hint": "string",
        "labelTranslations": {},
        "hintTranslations": {},
        "default": "string",
        "order_index": 0,
        "additional_values": [
          "string"
        ],
        "read_only": false,
        "appearance": "string",
        "relevant": "string",
        "constraint": "string",
        "constraint_message": "string",
        "constraintMessageTranslations": {},
        "calculation": "string",
        "choices": "string",
        "choice_filter": "string",
        "choice_relation": "string",
        "repeat_count": "string",
        "questions": [],
        "calendar_config": {
          "mode": "monthly",
          "months_back": 12,
          "start_from": "today",
          "allow_future": false
        },
        "calendar_rules": [
          {
            "id": "string",
            "trigger_question": "string",
            "target_column": "string",
            "value_source": "constant",
            "source_value": "string",
            "backfill_months": 1,
            "backfill_anchor": "current_month",
            "map_values": {},
            "xpath_expression": "string",
            "enabled": true,
            "conditions": [
              {}
            ],
            "months_scope": {}
          }
        ],
        "columns": [
          {
            "key": "string",
            "type": "select_one",
            "label": "",
            "label_translations": {},
            "choices": [
              {}
            ],
            "relevant": "string"
          }
        ],
        "limit": {
          "min": 0,
          "max": 0
        },
        "paradata": [
          "string"
        ],
        "media_file": "string",
        "mediaAudio": "string",
        "mediaAudioSchema": {},
        "mediaAudioUrl": "string",
        "mediaAudioAssetId": "string",
        "mediaAudioUrlSchema": {},
        "mediaAudioAssetIdSchema": {},
        "deidentify": false,
        "unique_id": false,
        "lookups": "string"
      }
    ],
    "lookups": [
      {
        "lookup_name": "string",
        "key": "string",
        "value": "string",
        "parent_key": "string",
        "extra_data": {}
      }
    ],
    "lookup_data": [
      {}
    ]
  },
  "version": "string",
  "increment_type": "patch"
}`;

const response = await fetch('http://localhost:8001/api/v1/surveys/550e8400-e29b-41d4-a716-446655440000/versions', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
  },
  body,
});

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

### Python

```python
import requests

body = '''{
  "survey_id": "550e8400-e29b-41d4-a716-446655440000",
  "schema": {
    "settings": {
      "form_title": "string",
      "form_id": "string",
      "version": "string",
      "defaultLanguage": "en",
      "languages": [
        "string"
      ],
      "availableLanguages": [
        "string"
      ],
      "instanceName": "string",
      "submissionUrl": "string"
    },
    "choices": [
      {
        "list_name": "string",
        "name": "string",
        "label": "string",
        "labelTranslations": {},
        "media_file": "string",
        "constraint": "string"
      }
    ],
    "questions": [
      {
        "type": "text",
        "name": "string",
        "label": "",
        "required": false,
        "hint": "string",
        "labelTranslations": {},
        "hintTranslations": {},
        "default": "string",
        "order_index": 0,
        "additional_values": [
          "string"
        ],
        "read_only": false,
        "appearance": "string",
        "relevant": "string",
        "constraint": "string",
        "constraint_message": "string",
        "constraintMessageTranslations": {},
        "calculation": "string",
        "choices": "string",
        "choice_filter": "string",
        "choice_relation": "string",
        "repeat_count": "string",
        "questions": [],
        "calendar_config": {
          "mode": "monthly",
          "months_back": 12,
          "start_from": "today",
          "allow_future": false
        },
        "calendar_rules": [
          {
            "id": "string",
            "trigger_question": "string",
            "target_column": "string",
            "value_source": "constant",
            "source_value": "string",
            "backfill_months": 1,
            "backfill_anchor": "current_month",
            "map_values": {},
            "xpath_expression": "string",
            "enabled": true,
            "conditions": [
              {}
            ],
            "months_scope": {}
          }
        ],
        "columns": [
          {
            "key": "string",
            "type": "select_one",
            "label": "",
            "label_translations": {},
            "choices": [
              {}
            ],
            "relevant": "string"
          }
        ],
        "limit": {
          "min": 0,
          "max": 0
        },
        "paradata": [
          "string"
        ],
        "media_file": "string",
        "mediaAudio": "string",
        "mediaAudioSchema": {},
        "mediaAudioUrl": "string",
        "mediaAudioAssetId": "string",
        "mediaAudioUrlSchema": {},
        "mediaAudioAssetIdSchema": {},
        "deidentify": false,
        "unique_id": false,
        "lookups": "string"
      }
    ],
    "lookups": [
      {
        "lookup_name": "string",
        "key": "string",
        "value": "string",
        "parent_key": "string",
        "extra_data": {}
      }
    ],
    "lookup_data": [
      {}
    ]
  },
  "version": "string",
  "increment_type": "patch"
}'''

response = requests.post(
    'http://localhost:8001/api/v1/surveys/550e8400-e29b-41d4-a716-446655440000/versions',
    data=body.encode('utf-8'),
    headers={
        'Content-Type': 'application/json',
    },
)
print(response.text)
```


## Get Version

`GET /api/v1/surveys/{survey_id}/versions/{version_id}`

Get a specific version of a survey.

Authentication: no security requirement declared for this operation.

Parameters:

- `survey_id` (path, string, uuid, required)
  Type: string, uuid

- `version_id` (path, string, uuid, required)
  Type: string, uuid

Responses:

- 200: Successful Response

Content type: application/json

Type: object

Additional properties: true

- 422: Validation Error

Content type: application/json

Type: object

Schema: [SurveyService_HTTPValidationError](/api-reference/schemas/surveyservice-httpvalidationerror-6237d5d2de.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [SurveyService_ValidationError](/api-reference/schemas/surveyservice-validationerror-21d2a3258e.md); Type: object

## Examples

### cURL

```bash
curl -X GET 'http://localhost:8001/api/v1/surveys/550e8400-e29b-41d4-a716-446655440000/versions/550e8400-e29b-41d4-a716-446655440000'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8001/api/v1/surveys/550e8400-e29b-41d4-a716-446655440000/versions/550e8400-e29b-41d4-a716-446655440000', {
  method: 'GET',
});

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

### Python

```python
import requests

response = requests.get('http://localhost:8001/api/v1/surveys/550e8400-e29b-41d4-a716-446655440000/versions/550e8400-e29b-41d4-a716-446655440000')
print(response.text)
```


## Update Version Schema

`PUT /api/v1/surveys/{survey_id}/versions/{version_id}`

Update schema for a draft version.

- Only allowed for DRAFT versions
- Version must be immutable=False

Accepts schema in two formats:
1. Direct format: { settings, choices, questions, ... }
2. Wrapped format: { schema: { settings, choices, questions, ... } }

Authentication: no security requirement declared for this operation.

Parameters:

- `survey_id` (path, string, uuid, required)
  Type: string, uuid

- `version_id` (path, string, uuid, required)
  Type: string, uuid

Request body: application/json (required)

Type: object

DTO for updating a draft survey version (cannot update published).

Accepts schema in two formats:
1. Direct format: { settings, choices, questions, ... }
2. Wrapped format: { schema: { settings, choices, questions, ... } }

The 'schema' field (when present) may include additional metadata like
'title' and 'version' which are stripped during parsing.

Schema: [SurveyService_SurveyVersionUpdate](/api-reference/schemas/surveyservice-surveyversionupdate-730f183650.md)

- `schema` (optional)
  Type: unknown
  
  anyOf:
    Type: object
    
    Additional properties: true
  
    Type: null

- `settings` (optional)
  Type: unknown
  
  anyOf:
    Type: unknown
  
    Type: null

- `choices` (optional)
  Type: unknown
  
  anyOf:
    Type: unknown
  
    Type: null

- `questions` (optional)
  Type: unknown
  
  anyOf:
    Type: unknown
  
    Type: null

- `lookups` (optional)
  Type: unknown
  
  anyOf:
    Type: unknown
  
    Type: null

- `lookup_data` (optional)
  Type: unknown
  
  anyOf:
    Type: unknown
  
    Type: null

Additional properties: true

Responses:

- 200: Successful Response

Content type: application/json

Type: object

Additional properties: true

- 422: Validation Error

Content type: application/json

Type: object

Schema: [SurveyService_HTTPValidationError](/api-reference/schemas/surveyservice-httpvalidationerror-6237d5d2de.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [SurveyService_ValidationError](/api-reference/schemas/surveyservice-validationerror-21d2a3258e.md); Type: object

## Examples

### cURL

```bash
curl -X PUT 'http://localhost:8001/api/v1/surveys/550e8400-e29b-41d4-a716-446655440000/versions/550e8400-e29b-41d4-a716-446655440000' \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "schema": {}
}'
```

### JavaScript

```javascript
const body = `{
  "schema": {}
}`;

const response = await fetch('http://localhost:8001/api/v1/surveys/550e8400-e29b-41d4-a716-446655440000/versions/550e8400-e29b-41d4-a716-446655440000', {
  method: 'PUT',
  headers: {
    'Content-Type': 'application/json',
  },
  body,
});

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

### Python

```python
import requests

body = '''{
  "schema": {}
}'''

response = requests.put(
    'http://localhost:8001/api/v1/surveys/550e8400-e29b-41d4-a716-446655440000/versions/550e8400-e29b-41d4-a716-446655440000',
    data=body.encode('utf-8'),
    headers={
        'Content-Type': 'application/json',
    },
)
print(response.text)
```


## Discard Version

`DELETE /api/v1/surveys/{survey_id}/versions/{version_id}`

Discard a draft version.

- Only allowed for DRAFT versions
- Published versions cannot be deleted (for audit trail)

Authentication: no security requirement declared for this operation.

Parameters:

- `survey_id` (path, string, uuid, required)
  Type: string, uuid

- `version_id` (path, string, uuid, required)
  Type: string, uuid

Responses:

- 200: Successful Response

Content type: application/json

Type: unknown

- 422: Validation Error

Content type: application/json

Type: object

Schema: [SurveyService_HTTPValidationError](/api-reference/schemas/surveyservice-httpvalidationerror-6237d5d2de.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [SurveyService_ValidationError](/api-reference/schemas/surveyservice-validationerror-21d2a3258e.md); Type: object

## Examples

### cURL

```bash
curl -X DELETE 'http://localhost:8001/api/v1/surveys/550e8400-e29b-41d4-a716-446655440000/versions/550e8400-e29b-41d4-a716-446655440000'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8001/api/v1/surveys/550e8400-e29b-41d4-a716-446655440000/versions/550e8400-e29b-41d4-a716-446655440000', {
  method: 'DELETE',
});

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

### Python

```python
import requests

response = requests.delete('http://localhost:8001/api/v1/surveys/550e8400-e29b-41d4-a716-446655440000/versions/550e8400-e29b-41d4-a716-446655440000')
print(response.text)
```


## Clone Version To New Draft

`POST /api/v1/surveys/{survey_id}/versions/{version_id}/clone`

Clone an existing version to a new draft.

- Creates a new version with incremented number using semantic versioning
- Copies schema from source version
- New version is in DRAFT status

Authentication: no security requirement declared for this operation.

Parameters:

- `survey_id` (path, string, uuid, required)
  Type: string, uuid

- `version_id` (path, string, uuid, required)
  Type: string, uuid

- `increment_type` (query, unknown, optional) - major, minor, patch
  Type: unknown
  
  major, minor, patch
  
  default: "patch"
  
  anyOf:
    Type: string
  
    Type: null

Responses:

- 201: Successful Response

Content type: application/json

Type: object

Additional properties: true

- 422: Validation Error

Content type: application/json

Type: object

Schema: [SurveyService_HTTPValidationError](/api-reference/schemas/surveyservice-httpvalidationerror-6237d5d2de.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [SurveyService_ValidationError](/api-reference/schemas/surveyservice-validationerror-21d2a3258e.md); Type: object

## Examples

### cURL

```bash
curl -X POST 'http://localhost:8001/api/v1/surveys/550e8400-e29b-41d4-a716-446655440000/versions/550e8400-e29b-41d4-a716-446655440000/clone?increment_type=patch'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8001/api/v1/surveys/550e8400-e29b-41d4-a716-446655440000/versions/550e8400-e29b-41d4-a716-446655440000/clone?increment_type=patch', {
  method: 'POST',
});

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

### Python

```python
import requests

response = requests.post('http://localhost:8001/api/v1/surveys/550e8400-e29b-41d4-a716-446655440000/versions/550e8400-e29b-41d4-a716-446655440000/clone?increment_type=patch')
print(response.text)
```


## Get Latest Version

`GET /api/v1/surveys/{survey_id}/versions/latest`

Get the latest version of a survey.

Returns the most recently created version (highest version number).
Used by other services (form-service, data-service) to fetch current schema.

Authentication: no security requirement declared for this operation.

Parameters:

- `survey_id` (path, string, uuid, required)
  Type: string, uuid

Responses:

- 200: Successful Response

Content type: application/json

Type: object

Additional properties: true

- 422: Validation Error

Content type: application/json

Type: object

Schema: [SurveyService_HTTPValidationError](/api-reference/schemas/surveyservice-httpvalidationerror-6237d5d2de.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [SurveyService_ValidationError](/api-reference/schemas/surveyservice-validationerror-21d2a3258e.md); Type: object

## Examples

### cURL

```bash
curl -X GET 'http://localhost:8001/api/v1/surveys/550e8400-e29b-41d4-a716-446655440000/versions/latest'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8001/api/v1/surveys/550e8400-e29b-41d4-a716-446655440000/versions/latest', {
  method: 'GET',
});

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

### Python

```python
import requests

response = requests.get('http://localhost:8001/api/v1/surveys/550e8400-e29b-41d4-a716-446655440000/versions/latest')
print(response.text)
```


## Fetch the content-addressed schema artifact for a version

`GET /api/v1/surveys/{survey_id}/versions/{version_id}/schema-artifact`

Returns the governing schema artifact for a survey version: `canonical_schema` is the exact string whose UTF-8 bytes hash to `schema_sha256`. Unlike the render endpoints this performs no media-audio enrichment, so the served bytes and the declared digest always agree. A client verifies by hashing `canonical_schema` and comparing to `schema_sha256`; it must not re-serialize a parsed copy.

Authentication: no security requirement declared for this operation.

Parameters:

- `survey_id` (path, string, uuid, required)
  Type: string, uuid

- `version_id` (path, string, uuid, required)
  Type: string, uuid

Responses:

- 200: Successful Response

Content type: application/json

Type: object

Additional properties: true

- 422: Validation Error

Content type: application/json

Type: object

Schema: [SurveyService_HTTPValidationError](/api-reference/schemas/surveyservice-httpvalidationerror-6237d5d2de.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [SurveyService_ValidationError](/api-reference/schemas/surveyservice-validationerror-21d2a3258e.md); Type: object

## Examples

### cURL

```bash
curl -X GET 'http://localhost:8001/api/v1/surveys/550e8400-e29b-41d4-a716-446655440000/versions/550e8400-e29b-41d4-a716-446655440000/schema-artifact'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8001/api/v1/surveys/550e8400-e29b-41d4-a716-446655440000/versions/550e8400-e29b-41d4-a716-446655440000/schema-artifact', {
  method: 'GET',
});

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

### Python

```python
import requests

response = requests.get('http://localhost:8001/api/v1/surveys/550e8400-e29b-41d4-a716-446655440000/versions/550e8400-e29b-41d4-a716-446655440000/schema-artifact')
print(response.text)
```


## Export survey version as XLSForm

`GET /api/v1/surveys/{survey_id}/versions/{version_id}/export-xlsform`

Download a survey version as an XLSForm .xlsx file with optional language selection.

Authentication: no security requirement declared for this operation.

Parameters:

- `survey_id` (path, string, uuid, required)
  Type: string, uuid

- `version_id` (path, string, uuid, required)
  Type: string, uuid

- `survey_name` (query, unknown, optional) - Override filename prefix
  Type: unknown
  
  Override filename prefix
  
  anyOf:
    Type: string
  
    Type: null

- `languages` (query, unknown, optional) - Comma-separated list of language codes to export (e.g., 'en,es,fr'). If not specified, exports all available languages from the schema.
  Type: unknown
  
  Comma-separated list of language codes to export (e.g., 'en,es,fr'). If not specified, exports all available languages from the schema.
  
  anyOf:
    Type: string
  
    Type: null

Responses:

- 200: Successful Response

Content type: application/json

Type: unknown

- 422: Validation Error

Content type: application/json

Type: object

Schema: [SurveyService_HTTPValidationError](/api-reference/schemas/surveyservice-httpvalidationerror-6237d5d2de.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [SurveyService_ValidationError](/api-reference/schemas/surveyservice-validationerror-21d2a3258e.md); Type: object

## Examples

### cURL

```bash
curl -X GET 'http://localhost:8001/api/v1/surveys/550e8400-e29b-41d4-a716-446655440000/versions/550e8400-e29b-41d4-a716-446655440000/export-xlsform'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8001/api/v1/surveys/550e8400-e29b-41d4-a716-446655440000/versions/550e8400-e29b-41d4-a716-446655440000/export-xlsform', {
  method: 'GET',
});

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

### Python

```python
import requests

response = requests.get('http://localhost:8001/api/v1/surveys/550e8400-e29b-41d4-a716-446655440000/versions/550e8400-e29b-41d4-a716-446655440000/export-xlsform')
print(response.text)
```


## Publish Check

`GET /api/v1/surveys/{survey_id}/publish-check`

Check whether publishing a new version of this survey is safe.

Returns warnings if the survey has active data collection in progress.
This is a pre-publish check — it does NOT block publishing, only warns.

Authentication: no security requirement declared for this operation.

Parameters:

- `survey_id` (path, string, uuid, required)
  Type: string, uuid

Responses:

- 200: Successful Response

Content type: application/json

Type: unknown

- 422: Validation Error

Content type: application/json

Type: object

Schema: [SurveyService_HTTPValidationError](/api-reference/schemas/surveyservice-httpvalidationerror-6237d5d2de.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [SurveyService_ValidationError](/api-reference/schemas/surveyservice-validationerror-21d2a3258e.md); Type: object

## Examples

### cURL

```bash
curl -X GET 'http://localhost:8001/api/v1/surveys/550e8400-e29b-41d4-a716-446655440000/publish-check'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8001/api/v1/surveys/550e8400-e29b-41d4-a716-446655440000/publish-check', {
  method: 'GET',
});

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

### Python

```python
import requests

response = requests.get('http://localhost:8001/api/v1/surveys/550e8400-e29b-41d4-a716-446655440000/publish-check')
print(response.text)
```


## Publish Survey

`POST /api/v1/surveys/{survey_id}/publish`

Publish a survey.

- Optional `version_id` query param to publish a specific version (e.g. republish an old one).
- When omitted, the latest version is used.
- Validates schema using validation engine (first-time publishes only).
- Marks version as immutable and sets published_at timestamp.
- Updates survey status to PUBLISHED.

Authentication: no security requirement declared for this operation.

Parameters:

- `survey_id` (path, string, uuid, required)
  Type: string, uuid

- `version_id` (query, unknown, optional)
  Type: unknown
  
  anyOf:
    Type: string, uuid
  
    Type: null

Responses:

- 200: Successful Response

Content type: application/json

Type: object

Schema: [SurveyService_SurveyResponse](/api-reference/schemas/surveyservice-surveyresponse-acaa084535.md)

- `id` (required)
  Type: string, uuid

- `tenant_id` (required)
  Type: string, uuid

- `workspace_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string, uuid
  
    Type: null

- `project_id` (required)
  Type: string, uuid

- `name` (required)
  Type: string

- `description` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `status` (required)
  Type: string

- `is_anonymous` (required)
  Type: boolean

- `allow_multiple_responses` (required)
  Type: boolean

- `survey_code` (optional)
  Type: unknown
  
  anyOf:
    Type: integer
  
    Type: null

- `tags` (optional)
  Type: array
  
  Items:
    Reference: [SurveyService_TagResponse](/api-reference/schemas/surveyservice-tagresponse-1b11fe3a5a.md); Type: object

- `created_at` (required)
  Type: string, date-time

- `updated_at` (required)
  Type: string, date-time

- `created_by` (required)
  Type: string, uuid

- `closed_at` (optional)
  Type: unknown
  
  anyOf:
    Type: string, date-time
  
    Type: null

- `open_at` (optional)
  Type: unknown
  
  anyOf:
    Type: string, date-time
  
    Type: null

- `close_at` (optional)
  Type: unknown
  
  anyOf:
    Type: string, date-time
  
    Type: null

- `scheduling_enabled` (optional)
  Type: boolean
  
  default: false

- `is_open` (optional)
  Type: boolean
  
  default: false

- `schema` (optional)
  Type: unknown
  
  anyOf:
    Reference: [SurveyService_SurveySchemaResponse](/api-reference/schemas/surveyservice-surveyschemaresponse-5750fea8e8.md); Type: object
    
    Response model for survey schema
  
    Type: null

- `project_status` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `project_has_production_activity` (optional)
  Type: unknown
  
  anyOf:
    Type: boolean
  
    Type: null

- `project_production_activity_at` (optional)
  Type: unknown
  
  anyOf:
    Type: string, date-time
  
    Type: null

- 422: Validation Error

Content type: application/json

Type: object

Schema: [SurveyService_HTTPValidationError](/api-reference/schemas/surveyservice-httpvalidationerror-6237d5d2de.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [SurveyService_ValidationError](/api-reference/schemas/surveyservice-validationerror-21d2a3258e.md); Type: object

## Examples

### cURL

```bash
curl -X POST 'http://localhost:8001/api/v1/surveys/550e8400-e29b-41d4-a716-446655440000/publish'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8001/api/v1/surveys/550e8400-e29b-41d4-a716-446655440000/publish', {
  method: 'POST',
});

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

### Python

```python
import requests

response = requests.post('http://localhost:8001/api/v1/surveys/550e8400-e29b-41d4-a716-446655440000/publish')
print(response.text)
```


## Unpublish Survey

`POST /api/v1/surveys/{survey_id}/unpublish`

Unpublish a survey (set back to draft).

- Only allows unpublishing if survey is published
- Does NOT modify version (remains immutable for audit)
- Sets survey status back to DRAFT

Authentication: no security requirement declared for this operation.

Parameters:

- `survey_id` (path, string, uuid, required)
  Type: string, uuid

Responses:

- 200: Successful Response

Content type: application/json

Type: object

Schema: [SurveyService_SurveyResponse](/api-reference/schemas/surveyservice-surveyresponse-acaa084535.md)

- `id` (required)
  Type: string, uuid

- `tenant_id` (required)
  Type: string, uuid

- `workspace_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string, uuid
  
    Type: null

- `project_id` (required)
  Type: string, uuid

- `name` (required)
  Type: string

- `description` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `status` (required)
  Type: string

- `is_anonymous` (required)
  Type: boolean

- `allow_multiple_responses` (required)
  Type: boolean

- `survey_code` (optional)
  Type: unknown
  
  anyOf:
    Type: integer
  
    Type: null

- `tags` (optional)
  Type: array
  
  Items:
    Reference: [SurveyService_TagResponse](/api-reference/schemas/surveyservice-tagresponse-1b11fe3a5a.md); Type: object

- `created_at` (required)
  Type: string, date-time

- `updated_at` (required)
  Type: string, date-time

- `created_by` (required)
  Type: string, uuid

- `closed_at` (optional)
  Type: unknown
  
  anyOf:
    Type: string, date-time
  
    Type: null

- `open_at` (optional)
  Type: unknown
  
  anyOf:
    Type: string, date-time
  
    Type: null

- `close_at` (optional)
  Type: unknown
  
  anyOf:
    Type: string, date-time
  
    Type: null

- `scheduling_enabled` (optional)
  Type: boolean
  
  default: false

- `is_open` (optional)
  Type: boolean
  
  default: false

- `schema` (optional)
  Type: unknown
  
  anyOf:
    Reference: [SurveyService_SurveySchemaResponse](/api-reference/schemas/surveyservice-surveyschemaresponse-5750fea8e8.md); Type: object
    
    Response model for survey schema
  
    Type: null

- `project_status` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `project_has_production_activity` (optional)
  Type: unknown
  
  anyOf:
    Type: boolean
  
    Type: null

- `project_production_activity_at` (optional)
  Type: unknown
  
  anyOf:
    Type: string, date-time
  
    Type: null

- 422: Validation Error

Content type: application/json

Type: object

Schema: [SurveyService_HTTPValidationError](/api-reference/schemas/surveyservice-httpvalidationerror-6237d5d2de.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [SurveyService_ValidationError](/api-reference/schemas/surveyservice-validationerror-21d2a3258e.md); Type: object

## Examples

### cURL

```bash
curl -X POST 'http://localhost:8001/api/v1/surveys/550e8400-e29b-41d4-a716-446655440000/unpublish'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8001/api/v1/surveys/550e8400-e29b-41d4-a716-446655440000/unpublish', {
  method: 'POST',
});

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

### Python

```python
import requests

response = requests.post('http://localhost:8001/api/v1/surveys/550e8400-e29b-41d4-a716-446655440000/unpublish')
print(response.text)
```


## Archive Survey

`POST /api/v1/surveys/{survey_id}/archive`

Archive a survey permanently.

- Archived surveys cannot be unarchived or reactivated
- Form filling is blocked for archived surveys
- Data viewing and analytics remain functional
- Duplication is still allowed (creates a new DRAFT survey)

Authentication: no security requirement declared for this operation.

Parameters:

- `survey_id` (path, string, uuid, required)
  Type: string, uuid

Responses:

- 200: Successful Response

Content type: application/json

Type: object

Schema: [SurveyService_SurveyResponse](/api-reference/schemas/surveyservice-surveyresponse-acaa084535.md)

- `id` (required)
  Type: string, uuid

- `tenant_id` (required)
  Type: string, uuid

- `workspace_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string, uuid
  
    Type: null

- `project_id` (required)
  Type: string, uuid

- `name` (required)
  Type: string

- `description` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `status` (required)
  Type: string

- `is_anonymous` (required)
  Type: boolean

- `allow_multiple_responses` (required)
  Type: boolean

- `survey_code` (optional)
  Type: unknown
  
  anyOf:
    Type: integer
  
    Type: null

- `tags` (optional)
  Type: array
  
  Items:
    Reference: [SurveyService_TagResponse](/api-reference/schemas/surveyservice-tagresponse-1b11fe3a5a.md); Type: object

- `created_at` (required)
  Type: string, date-time

- `updated_at` (required)
  Type: string, date-time

- `created_by` (required)
  Type: string, uuid

- `closed_at` (optional)
  Type: unknown
  
  anyOf:
    Type: string, date-time
  
    Type: null

- `open_at` (optional)
  Type: unknown
  
  anyOf:
    Type: string, date-time
  
    Type: null

- `close_at` (optional)
  Type: unknown
  
  anyOf:
    Type: string, date-time
  
    Type: null

- `scheduling_enabled` (optional)
  Type: boolean
  
  default: false

- `is_open` (optional)
  Type: boolean
  
  default: false

- `schema` (optional)
  Type: unknown
  
  anyOf:
    Reference: [SurveyService_SurveySchemaResponse](/api-reference/schemas/surveyservice-surveyschemaresponse-5750fea8e8.md); Type: object
    
    Response model for survey schema
  
    Type: null

- `project_status` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `project_has_production_activity` (optional)
  Type: unknown
  
  anyOf:
    Type: boolean
  
    Type: null

- `project_production_activity_at` (optional)
  Type: unknown
  
  anyOf:
    Type: string, date-time
  
    Type: null

- 422: Validation Error

Content type: application/json

Type: object

Schema: [SurveyService_HTTPValidationError](/api-reference/schemas/surveyservice-httpvalidationerror-6237d5d2de.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [SurveyService_ValidationError](/api-reference/schemas/surveyservice-validationerror-21d2a3258e.md); Type: object

## Examples

### cURL

```bash
curl -X POST 'http://localhost:8001/api/v1/surveys/550e8400-e29b-41d4-a716-446655440000/archive'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8001/api/v1/surveys/550e8400-e29b-41d4-a716-446655440000/archive', {
  method: 'POST',
});

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

### Python

```python
import requests

response = requests.post('http://localhost:8001/api/v1/surveys/550e8400-e29b-41d4-a716-446655440000/archive')
print(response.text)
```


## Get Published Version

`GET /api/v1/surveys/{survey_id}/published`

Get the currently published version of a survey.

Authentication: no security requirement declared for this operation.

Parameters:

- `survey_id` (path, string, uuid, required)
  Type: string, uuid

Responses:

- 200: Successful Response

Content type: application/json

Type: object

Additional properties: true

- 422: Validation Error

Content type: application/json

Type: object

Schema: [SurveyService_HTTPValidationError](/api-reference/schemas/surveyservice-httpvalidationerror-6237d5d2de.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [SurveyService_ValidationError](/api-reference/schemas/surveyservice-validationerror-21d2a3258e.md); Type: object

## Examples

### cURL

```bash
curl -X GET 'http://localhost:8001/api/v1/surveys/550e8400-e29b-41d4-a716-446655440000/published'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8001/api/v1/surveys/550e8400-e29b-41d4-a716-446655440000/published', {
  method: 'GET',
});

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

### Python

```python
import requests

response = requests.get('http://localhost:8001/api/v1/surveys/550e8400-e29b-41d4-a716-446655440000/published')
print(response.text)
```


## List Published Versions

`GET /api/v1/surveys/{survey_id}/versions/published`

List all published versions of a survey (for audit trail).

Authentication: no security requirement declared for this operation.

Parameters:

- `survey_id` (path, string, uuid, required)
  Type: string, uuid

Responses:

- 200: Successful Response

Content type: application/json

Type: array

Items:
  Type: unknown

- 422: Validation Error

Content type: application/json

Type: object

Schema: [SurveyService_HTTPValidationError](/api-reference/schemas/surveyservice-httpvalidationerror-6237d5d2de.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [SurveyService_ValidationError](/api-reference/schemas/surveyservice-validationerror-21d2a3258e.md); Type: object

## Examples

### cURL

```bash
curl -X GET 'http://localhost:8001/api/v1/surveys/550e8400-e29b-41d4-a716-446655440000/versions/published'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8001/api/v1/surveys/550e8400-e29b-41d4-a716-446655440000/versions/published', {
  method: 'GET',
});

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

### Python

```python
import requests

response = requests.get('http://localhost:8001/api/v1/surveys/550e8400-e29b-41d4-a716-446655440000/versions/published')
print(response.text)
```


## Archive Version

`POST /api/v1/surveys/{survey_id}/versions/{version_id}/archive`

Archive a published version.

- Only published versions can be archived
- Archived versions remain immutable for audit trail

Authentication: no security requirement declared for this operation.

Parameters:

- `survey_id` (path, string, uuid, required)
  Type: string, uuid

- `version_id` (path, string, uuid, required)
  Type: string, uuid

Responses:

- 200: Successful Response

Content type: application/json

Type: object

Additional properties: true

- 422: Validation Error

Content type: application/json

Type: object

Schema: [SurveyService_HTTPValidationError](/api-reference/schemas/surveyservice-httpvalidationerror-6237d5d2de.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [SurveyService_ValidationError](/api-reference/schemas/surveyservice-validationerror-21d2a3258e.md); Type: object

## Examples

### cURL

```bash
curl -X POST 'http://localhost:8001/api/v1/surveys/550e8400-e29b-41d4-a716-446655440000/versions/550e8400-e29b-41d4-a716-446655440000/archive'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8001/api/v1/surveys/550e8400-e29b-41d4-a716-446655440000/versions/550e8400-e29b-41d4-a716-446655440000/archive', {
  method: 'POST',
});

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

### Python

```python
import requests

response = requests.post('http://localhost:8001/api/v1/surveys/550e8400-e29b-41d4-a716-446655440000/versions/550e8400-e29b-41d4-a716-446655440000/archive')
print(response.text)
```


## Get Survey Version

`GET /api/v1/surveys/{survey_id}/version/{version_id}`

Get a specific version of a survey by ID.

Authentication: no security requirement declared for this operation.

Parameters:

- `survey_id` (path, string, uuid, required)
  Type: string, uuid

- `version_id` (path, string, uuid, required)
  Type: string, uuid

Responses:

- 200: Successful Response

Content type: application/json

Type: object

Additional properties: true

- 422: Validation Error

Content type: application/json

Type: object

Schema: [SurveyService_HTTPValidationError](/api-reference/schemas/surveyservice-httpvalidationerror-6237d5d2de.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [SurveyService_ValidationError](/api-reference/schemas/surveyservice-validationerror-21d2a3258e.md); Type: object

## Examples

### cURL

```bash
curl -X GET 'http://localhost:8001/api/v1/surveys/550e8400-e29b-41d4-a716-446655440000/version/550e8400-e29b-41d4-a716-446655440000'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8001/api/v1/surveys/550e8400-e29b-41d4-a716-446655440000/version/550e8400-e29b-41d4-a716-446655440000', {
  method: 'GET',
});

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

### Python

```python
import requests

response = requests.get('http://localhost:8001/api/v1/surveys/550e8400-e29b-41d4-a716-446655440000/version/550e8400-e29b-41d4-a716-446655440000')
print(response.text)
```


## List Form Access

`GET /api/v1/surveys/{survey_id}/access`

List all users who have access to a specific survey form.

Requires survey:grant_access or survey:manage permission.

Authentication: no security requirement declared for this operation.

Parameters:

- `survey_id` (path, string, uuid, required)
  Type: string, uuid

- `skip` (query, integer, optional)
  Type: integer
  
  default: 0
  
  minimum: 0

- `limit` (query, integer, optional)
  Type: integer
  
  default: 20
  
  minimum: 1
  
  maximum: 100

- `search` (query, unknown, optional) - Search by user name or email
  Type: unknown
  
  Search by user name or email
  
  anyOf:
    Type: string
  
    Type: null

- `include_revoked` (query, boolean, optional) - Include soft-deleted tombstone assignments
  Type: boolean
  
  Include soft-deleted tombstone assignments
  
  default: false

Responses:

- 200: Successful Response

Content type: application/json

Type: object

Schema: [SurveyService_FormAccessListResponse](/api-reference/schemas/surveyservice-formaccesslistresponse-a2fac70f14.md)

- `items` (required)
  Type: array
  
  Items:
    Reference: [SurveyService_FormAccessWithUserResponse](/api-reference/schemas/surveyservice-formaccesswithuserresponse-e26bd799f9.md); Type: object

- `total` (required)
  Type: integer

- `skip` (required)
  Type: integer

- `limit` (required)
  Type: integer

- `has_next` (required)
  Type: boolean

- `has_previous` (required)
  Type: boolean

- 422: Validation Error

Content type: application/json

Type: object

Schema: [SurveyService_HTTPValidationError](/api-reference/schemas/surveyservice-httpvalidationerror-6237d5d2de.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [SurveyService_ValidationError](/api-reference/schemas/surveyservice-validationerror-21d2a3258e.md); Type: object

## Examples

### cURL

```bash
curl -X GET 'http://localhost:8001/api/v1/surveys/550e8400-e29b-41d4-a716-446655440000/access?skip=0&limit=20&include_revoked=false'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8001/api/v1/surveys/550e8400-e29b-41d4-a716-446655440000/access?skip=0&limit=20&include_revoked=false', {
  method: 'GET',
});

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

### Python

```python
import requests

response = requests.get('http://localhost:8001/api/v1/surveys/550e8400-e29b-41d4-a716-446655440000/access?skip=0&limit=20&include_revoked=false')
print(response.text)
```


## Grant Form Access

`POST /api/v1/surveys/{survey_id}/access`

Grant a user access to fill a specific survey form.

Requires survey:grant_access or survey:manage permission.

Authentication: no security requirement declared for this operation.

Parameters:

- `survey_id` (path, string, uuid, required)
  Type: string, uuid

Request body: application/json (required)

Type: object

Schema: [SurveyService_FormAccessCreate](/api-reference/schemas/surveyservice-formaccesscreate-5aca3154b7.md)

- `user_id` (required)
  Type: string, uuid

- `access_level` (optional)
  Reference: [SurveyService_FormAccessLevel](/api-reference/schemas/surveyservice-formaccesslevel-a40adf7632.md); Type: string
  
  default: "fill"
  
  enum: ["fill","view_only","approver"]

- `expires_at` (optional)
  Type: unknown
  
  anyOf:
    Type: string, date-time
  
    Type: null

- `assigned_triggers` (optional)
  Type: unknown
  
  anyOf:
    Type: array
    
    Items:
      Reference: [SurveyService_LookupTriggerAssignment](/api-reference/schemas/surveyservice-lookuptriggerassignment-6b6e025c79.md); Type: object
      
      A single trigger value assignment for an enumerator.
  
    Type: null

Responses:

- 201: Successful Response

Content type: application/json

Type: object

Schema: [SurveyService_FormAccessResponse](/api-reference/schemas/surveyservice-formaccessresponse-0bba74834e.md)

- `id` (required)
  Type: string, uuid

- `tenant_id` (required)
  Type: string, uuid

- `survey_id` (required)
  Type: string, uuid

- `user_id` (required)
  Type: string, uuid

- `granted_by` (required)
  Type: string, uuid

- `access_level` (required)
  Type: string

- `expires_at` (optional)
  Type: unknown
  
  anyOf:
    Type: string, date-time
  
    Type: null

- `created_at` (required)
  Type: string, date-time

- `updated_at` (required)
  Type: string, date-time

- `revoked_at` (optional)
  Type: unknown
  
  anyOf:
    Type: string, date-time
  
    Type: null

- `revoked_by` (optional)
  Type: unknown
  
  anyOf:
    Type: string, uuid
  
    Type: null

- `revocation_reason` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- 422: Validation Error

Content type: application/json

Type: object

Schema: [SurveyService_HTTPValidationError](/api-reference/schemas/surveyservice-httpvalidationerror-6237d5d2de.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [SurveyService_ValidationError](/api-reference/schemas/surveyservice-validationerror-21d2a3258e.md); Type: object

## Examples

### cURL

```bash
curl -X POST 'http://localhost:8001/api/v1/surveys/550e8400-e29b-41d4-a716-446655440000/access' \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "user_id": "550e8400-e29b-41d4-a716-446655440000",
  "access_level": "fill",
  "expires_at": "2024-01-15T09:30:00Z",
  "assigned_triggers": [
    {
      "trigger_question": "string",
      "trigger_value": "string"
    }
  ]
}'
```

### JavaScript

```javascript
const body = `{
  "user_id": "550e8400-e29b-41d4-a716-446655440000",
  "access_level": "fill",
  "expires_at": "2024-01-15T09:30:00Z",
  "assigned_triggers": [
    {
      "trigger_question": "string",
      "trigger_value": "string"
    }
  ]
}`;

const response = await fetch('http://localhost:8001/api/v1/surveys/550e8400-e29b-41d4-a716-446655440000/access', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
  },
  body,
});

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

### Python

```python
import requests

body = '''{
  "user_id": "550e8400-e29b-41d4-a716-446655440000",
  "access_level": "fill",
  "expires_at": "2024-01-15T09:30:00Z",
  "assigned_triggers": [
    {
      "trigger_question": "string",
      "trigger_value": "string"
    }
  ]
}'''

response = requests.post(
    'http://localhost:8001/api/v1/surveys/550e8400-e29b-41d4-a716-446655440000/access',
    data=body.encode('utf-8'),
    headers={
        'Content-Type': 'application/json',
    },
)
print(response.text)
```


## Bulk Grant Form Access

`POST /api/v1/surveys/{survey_id}/access/bulk`

Grant multiple users access to fill a specific survey form.

Requires survey:grant_access or survey:manage permission.

Authentication: no security requirement declared for this operation.

Parameters:

- `survey_id` (path, string, uuid, required)
  Type: string, uuid

Request body: application/json (required)

Type: object

Schema: [SurveyService_FormAccessBulkCreate](/api-reference/schemas/surveyservice-formaccessbulkcreate-737da3f2db.md)

- `user_ids` (required)
  Type: array
  
  minItems: 1
  
  Items:
    Type: string, uuid

- `access_level` (optional)
  Reference: [SurveyService_FormAccessLevel](/api-reference/schemas/surveyservice-formaccesslevel-a40adf7632.md); Type: string
  
  default: "fill"
  
  enum: ["fill","view_only","approver"]

- `expires_at` (optional)
  Type: unknown
  
  anyOf:
    Type: string, date-time
  
    Type: null

- `assigned_triggers` (optional)
  Type: unknown
  
  anyOf:
    Type: array
    
    Items:
      Reference: [SurveyService_LookupTriggerAssignment](/api-reference/schemas/surveyservice-lookuptriggerassignment-6b6e025c79.md); Type: object
      
      A single trigger value assignment for an enumerator.
  
    Type: null

Responses:

- 201: Successful Response

Content type: application/json

Type: unknown

- 422: Validation Error

Content type: application/json

Type: object

Schema: [SurveyService_HTTPValidationError](/api-reference/schemas/surveyservice-httpvalidationerror-6237d5d2de.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [SurveyService_ValidationError](/api-reference/schemas/surveyservice-validationerror-21d2a3258e.md); Type: object

## Examples

### cURL

```bash
curl -X POST 'http://localhost:8001/api/v1/surveys/550e8400-e29b-41d4-a716-446655440000/access/bulk' \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "user_ids": [
    "550e8400-e29b-41d4-a716-446655440000"
  ],
  "access_level": "fill",
  "expires_at": "2024-01-15T09:30:00Z",
  "assigned_triggers": [
    {
      "trigger_question": "string",
      "trigger_value": "string"
    }
  ]
}'
```

### JavaScript

```javascript
const body = `{
  "user_ids": [
    "550e8400-e29b-41d4-a716-446655440000"
  ],
  "access_level": "fill",
  "expires_at": "2024-01-15T09:30:00Z",
  "assigned_triggers": [
    {
      "trigger_question": "string",
      "trigger_value": "string"
    }
  ]
}`;

const response = await fetch('http://localhost:8001/api/v1/surveys/550e8400-e29b-41d4-a716-446655440000/access/bulk', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
  },
  body,
});

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

### Python

```python
import requests

body = '''{
  "user_ids": [
    "550e8400-e29b-41d4-a716-446655440000"
  ],
  "access_level": "fill",
  "expires_at": "2024-01-15T09:30:00Z",
  "assigned_triggers": [
    {
      "trigger_question": "string",
      "trigger_value": "string"
    }
  ]
}'''

response = requests.post(
    'http://localhost:8001/api/v1/surveys/550e8400-e29b-41d4-a716-446655440000/access/bulk',
    data=body.encode('utf-8'),
    headers={
        'Content-Type': 'application/json',
    },
)
print(response.text)
```


## List User Form Access

`GET /api/v1/surveys/users/{user_id}/access`

List all surveys a specific user currently has access to within the
authenticated tenant.

This is the admin-facing counterpart to /surveys/access/my: instead of
resolving the requesting user, it resolves an arbitrary tenant member.

- tenant_id is always derived from the authenticated request; it is never
  accepted from the client, so cross-tenant assignments are never exposed.
- The target user must be a member of the current tenant (same check used
  by grant_form_access). A non-member is rejected with 403 before any
  assignment data is read.

Requires survey:manage_access, survey:grant_access, or survey:manage.

Authentication: no security requirement declared for this operation.

Parameters:

- `user_id` (path, string, uuid, required)
  Type: string, uuid

- `skip` (query, integer, optional)
  Type: integer
  
  default: 0
  
  minimum: 0

- `limit` (query, integer, optional)
  Type: integer
  
  default: 20
  
  minimum: 1
  
  maximum: 100

Responses:

- 200: Successful Response

Content type: application/json

Type: object

Schema: [SurveyService_SurveyAccessListResponse](/api-reference/schemas/surveyservice-surveyaccesslistresponse-2da76e8ef7.md)

- `items` (required)
  Type: array
  
  Items:
    Reference: [SurveyService_SurveyWithAccessResponse](/api-reference/schemas/surveyservice-surveywithaccessresponse-13910afbb0.md); Type: object

- `total` (required)
  Type: integer

- `skip` (required)
  Type: integer

- `limit` (required)
  Type: integer

- `has_next` (required)
  Type: boolean

- `has_previous` (required)
  Type: boolean

- 422: Validation Error

Content type: application/json

Type: object

Schema: [SurveyService_HTTPValidationError](/api-reference/schemas/surveyservice-httpvalidationerror-6237d5d2de.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [SurveyService_ValidationError](/api-reference/schemas/surveyservice-validationerror-21d2a3258e.md); Type: object

## Examples

### cURL

```bash
curl -X GET 'http://localhost:8001/api/v1/surveys/users/550e8400-e29b-41d4-a716-446655440000/access?skip=0&limit=20'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8001/api/v1/surveys/users/550e8400-e29b-41d4-a716-446655440000/access?skip=0&limit=20', {
  method: 'GET',
});

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

### Python

```python
import requests

response = requests.get('http://localhost:8001/api/v1/surveys/users/550e8400-e29b-41d4-a716-446655440000/access?skip=0&limit=20')
print(response.text)
```


## Revoke Form Access

`DELETE /api/v1/surveys/{survey_id}/access/{target_user_id}`

Revoke a user's access to a specific survey form as an auditable soft-delete tombstone (R17).

Requires survey:grant_access or survey:manage permission.

Authentication: no security requirement declared for this operation.

Parameters:

- `survey_id` (path, string, uuid, required)
  Type: string, uuid

- `target_user_id` (path, string, uuid, required)
  Type: string, uuid

Request body: application/json

Type: unknown

anyOf:
  Reference: [SurveyService_FormAccessRevokeRequest](/api-reference/schemas/surveyservice-formaccessrevokerequest-5db2d7647c.md); Type: object

  Type: null

Responses:

- 200: Successful Response

Content type: application/json

Type: object

Schema: [SurveyService_FormAccessRevokeResponse](/api-reference/schemas/surveyservice-formaccessrevokeresponse-75f7697705.md)

- `message` (required)
  Type: string

- `user_id` (required)
  Type: string, uuid

- `survey_id` (required)
  Type: string, uuid

- `grant_id` (required)
  Type: string, uuid

- `revoked_at` (required)
  Type: string, date-time

- `revoked_by` (required)
  Type: string, uuid

- `revocation_reason` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- 422: Validation Error

Content type: application/json

Type: object

Schema: [SurveyService_HTTPValidationError](/api-reference/schemas/surveyservice-httpvalidationerror-6237d5d2de.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [SurveyService_ValidationError](/api-reference/schemas/surveyservice-validationerror-21d2a3258e.md); Type: object

## Examples

### cURL

```bash
curl -X DELETE 'http://localhost:8001/api/v1/surveys/550e8400-e29b-41d4-a716-446655440000/access/550e8400-e29b-41d4-a716-446655440000' \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "reason": "string"
}'
```

### JavaScript

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

const response = await fetch('http://localhost:8001/api/v1/surveys/550e8400-e29b-41d4-a716-446655440000/access/550e8400-e29b-41d4-a716-446655440000', {
  method: 'DELETE',
  headers: {
    'Content-Type': 'application/json',
  },
  body,
});

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

### Python

```python
import requests

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

response = requests.delete(
    'http://localhost:8001/api/v1/surveys/550e8400-e29b-41d4-a716-446655440000/access/550e8400-e29b-41d4-a716-446655440000',
    data=body.encode('utf-8'),
    headers={
        'Content-Type': 'application/json',
    },
)
print(response.text)
```


## Update Form Access

`PATCH /api/v1/surveys/{survey_id}/access/{target_user_id}`

Update a user's access level or expiry for a specific survey form.

Requires survey:grant_access or survey:manage permission.

Authentication: no security requirement declared for this operation.

Parameters:

- `survey_id` (path, string, uuid, required)
  Type: string, uuid

- `target_user_id` (path, string, uuid, required)
  Type: string, uuid

Request body: application/json (required)

Type: object

Schema: [SurveyService_FormAccessUpdate](/api-reference/schemas/surveyservice-formaccessupdate-aeac9deb5f.md)

- `access_level` (optional)
  Type: unknown
  
  anyOf:
    Reference: [SurveyService_FormAccessLevel](/api-reference/schemas/surveyservice-formaccesslevel-a40adf7632.md); Type: string
    
    enum: ["fill","view_only","approver"]
  
    Type: null

- `expires_at` (optional)
  Type: unknown
  
  anyOf:
    Type: string, date-time
  
    Type: null

- `assigned_triggers` (optional)
  Type: unknown
  
  anyOf:
    Type: array
    
    Items:
      Reference: [SurveyService_LookupTriggerAssignment](/api-reference/schemas/surveyservice-lookuptriggerassignment-6b6e025c79.md); Type: object
      
      A single trigger value assignment for an enumerator.
  
    Type: null

Responses:

- 200: Successful Response

Content type: application/json

Type: object

Schema: [SurveyService_FormAccessResponse](/api-reference/schemas/surveyservice-formaccessresponse-0bba74834e.md)

- `id` (required)
  Type: string, uuid

- `tenant_id` (required)
  Type: string, uuid

- `survey_id` (required)
  Type: string, uuid

- `user_id` (required)
  Type: string, uuid

- `granted_by` (required)
  Type: string, uuid

- `access_level` (required)
  Type: string

- `expires_at` (optional)
  Type: unknown
  
  anyOf:
    Type: string, date-time
  
    Type: null

- `created_at` (required)
  Type: string, date-time

- `updated_at` (required)
  Type: string, date-time

- `revoked_at` (optional)
  Type: unknown
  
  anyOf:
    Type: string, date-time
  
    Type: null

- `revoked_by` (optional)
  Type: unknown
  
  anyOf:
    Type: string, uuid
  
    Type: null

- `revocation_reason` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- 422: Validation Error

Content type: application/json

Type: object

Schema: [SurveyService_HTTPValidationError](/api-reference/schemas/surveyservice-httpvalidationerror-6237d5d2de.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [SurveyService_ValidationError](/api-reference/schemas/surveyservice-validationerror-21d2a3258e.md); Type: object

## Examples

### cURL

```bash
curl -X PATCH 'http://localhost:8001/api/v1/surveys/550e8400-e29b-41d4-a716-446655440000/access/550e8400-e29b-41d4-a716-446655440000' \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "access_level": "fill",
  "expires_at": "2024-01-15T09:30:00Z",
  "assigned_triggers": [
    {
      "trigger_question": "string",
      "trigger_value": "string"
    }
  ]
}'
```

### JavaScript

```javascript
const body = `{
  "access_level": "fill",
  "expires_at": "2024-01-15T09:30:00Z",
  "assigned_triggers": [
    {
      "trigger_question": "string",
      "trigger_value": "string"
    }
  ]
}`;

const response = await fetch('http://localhost:8001/api/v1/surveys/550e8400-e29b-41d4-a716-446655440000/access/550e8400-e29b-41d4-a716-446655440000', {
  method: 'PATCH',
  headers: {
    'Content-Type': 'application/json',
  },
  body,
});

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

### Python

```python
import requests

body = '''{
  "access_level": "fill",
  "expires_at": "2024-01-15T09:30:00Z",
  "assigned_triggers": [
    {
      "trigger_question": "string",
      "trigger_value": "string"
    }
  ]
}'''

response = requests.patch(
    'http://localhost:8001/api/v1/surveys/550e8400-e29b-41d4-a716-446655440000/access/550e8400-e29b-41d4-a716-446655440000',
    data=body.encode('utf-8'),
    headers={
        'Content-Type': 'application/json',
    },
)
print(response.text)
```


## Check Form Access

`GET /api/v1/surveys/{survey_id}/access/check`

Check if the current user has access to a specific survey form.

This endpoint is public and doesn't require special permissions.

Authentication: no security requirement declared for this operation.

Parameters:

- `survey_id` (path, string, uuid, required)
  Type: string, uuid

Responses:

- 200: Successful Response

Content type: application/json

Type: object

Schema: [SurveyService_FormAccessCheckResponse](/api-reference/schemas/surveyservice-formaccesscheckresponse-3c494d433e.md)

- `has_access` (required)
  Type: boolean

- `access_level` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `can_fill` (optional)
  Type: boolean
  
  default: false

- `can_view` (optional)
  Type: boolean
  
  default: false

- `can_approve` (optional)
  Type: boolean
  
  default: false

- `expires_at` (optional)
  Type: unknown
  
  anyOf:
    Type: string, date-time
  
    Type: null

- `is_open` (optional)
  Type: boolean
  
  default: true

- `open_at` (optional)
  Type: unknown
  
  anyOf:
    Type: string, date-time
  
    Type: null

- `close_at` (optional)
  Type: unknown
  
  anyOf:
    Type: string, date-time
  
    Type: null

- `scheduling_blocked_reason` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- 422: Validation Error

Content type: application/json

Type: object

Schema: [SurveyService_HTTPValidationError](/api-reference/schemas/surveyservice-httpvalidationerror-6237d5d2de.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [SurveyService_ValidationError](/api-reference/schemas/surveyservice-validationerror-21d2a3258e.md); Type: object

## Examples

### cURL

```bash
curl -X GET 'http://localhost:8001/api/v1/surveys/550e8400-e29b-41d4-a716-446655440000/access/check'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8001/api/v1/surveys/550e8400-e29b-41d4-a716-446655440000/access/check', {
  method: 'GET',
});

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

### Python

```python
import requests

response = requests.get('http://localhost:8001/api/v1/surveys/550e8400-e29b-41d4-a716-446655440000/access/check')
print(response.text)
```


## Check Historical Form Access

`GET /api/v1/surveys/{survey_id}/access/historical`

Check if a user was authorized to collect/fill a survey at a specific historical point in time (R17 & R22).

Used by data-service / sync-service to validate that offline responses collected prior to revocation
are eligible for governed reconciliation.

Authentication: no security requirement declared for this operation.

Parameters:

- `survey_id` (path, string, uuid, required)
  Type: string, uuid

- `user_id` (query, string, uuid, required) - User ID to check historical authorization for
  Type: string, uuid
  
  User ID to check historical authorization for

- `at_time` (query, string, date-time, required) - ISO datetime at which access must have been valid
  Type: string, date-time
  
  ISO datetime at which access must have been valid

Responses:

- 200: Successful Response

Content type: application/json

Type: object

Schema: [SurveyService_HistoricalAccessCheckResponse](/api-reference/schemas/surveyservice-historicalaccesscheckresponse-cb621d4684.md)

- `has_access` (required)
  Type: boolean

- `grant_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string, uuid
  
    Type: null

- `access_level` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `created_at` (optional)
  Type: unknown
  
  anyOf:
    Type: string, date-time
  
    Type: null

- `revoked_at` (optional)
  Type: unknown
  
  anyOf:
    Type: string, date-time
  
    Type: null

- `revocation_reason` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `is_revoked` (optional)
  Type: boolean
  
  default: false

- 422: Validation Error

Content type: application/json

Type: object

Schema: [SurveyService_HTTPValidationError](/api-reference/schemas/surveyservice-httpvalidationerror-6237d5d2de.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [SurveyService_ValidationError](/api-reference/schemas/surveyservice-validationerror-21d2a3258e.md); Type: object

## Examples

### cURL

```bash
curl -X GET 'http://localhost:8001/api/v1/surveys/550e8400-e29b-41d4-a716-446655440000/access/historical?user_id=550e8400-e29b-41d4-a716-446655440000&at_time=2024-01-15T09%3A30%3A00Z'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8001/api/v1/surveys/550e8400-e29b-41d4-a716-446655440000/access/historical?user_id=550e8400-e29b-41d4-a716-446655440000&at_time=2024-01-15T09%3A30%3A00Z', {
  method: 'GET',
});

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

### Python

```python
import requests

response = requests.get('http://localhost:8001/api/v1/surveys/550e8400-e29b-41d4-a716-446655440000/access/historical?user_id=550e8400-e29b-41d4-a716-446655440000&at_time=2024-01-15T09%3A30%3A00Z')
print(response.text)
```


## Get My Accessible Surveys

`GET /api/v1/surveys/access/my`

Get all surveys that the current user has access to.

- When admin_access=true: Returns ALL published surveys in the tenant.
  The caller (mobile app) determines admin status from per-tenant role
  data received during login, and passes this flag accordingly.
- When admin_access=false (default): Returns ONLY surveys explicitly
  assigned via form_access that are PUBLISHED, in an ACTIVE project, and
  carry the write-to-fill capability (can_fill). Read-only/approve-only
  grants and unpublished surveys are never offered for collection.

Per-tenant admin status CANNOT be determined from JWT permissions alone,
because multi-tenant JWTs carry the PRIMARY tenant's permissions, which
may differ from the user's role in the X-Tenant-ID tenant.

Authentication: no security requirement declared for this operation.

Parameters:

- `skip` (query, integer, optional)
  Type: integer
  
  default: 0
  
  minimum: 0

- `limit` (query, integer, optional)
  Type: integer
  
  default: 20
  
  minimum: 1
  
  maximum: 100

- `admin_access` (query, boolean, optional) - If true, return ALL published surveys (for admin users). The caller must determine admin status from per-tenant role data.
  Type: boolean
  
  If true, return ALL published surveys (for admin users). The caller must determine admin status from per-tenant role data.
  
  default: false

Responses:

- 200: Successful Response

Content type: application/json

Type: object

Schema: [SurveyService_SurveyAccessListResponse](/api-reference/schemas/surveyservice-surveyaccesslistresponse-2da76e8ef7.md)

- `items` (required)
  Type: array
  
  Items:
    Reference: [SurveyService_SurveyWithAccessResponse](/api-reference/schemas/surveyservice-surveywithaccessresponse-13910afbb0.md); Type: object

- `total` (required)
  Type: integer

- `skip` (required)
  Type: integer

- `limit` (required)
  Type: integer

- `has_next` (required)
  Type: boolean

- `has_previous` (required)
  Type: boolean

- 422: Validation Error

Content type: application/json

Type: object

Schema: [SurveyService_HTTPValidationError](/api-reference/schemas/surveyservice-httpvalidationerror-6237d5d2de.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [SurveyService_ValidationError](/api-reference/schemas/surveyservice-validationerror-21d2a3258e.md); Type: object

## Examples

### cURL

```bash
curl -X GET 'http://localhost:8001/api/v1/surveys/access/my?skip=0&limit=20&admin_access=false'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8001/api/v1/surveys/access/my?skip=0&limit=20&admin_access=false', {
  method: 'GET',
});

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

### Python

```python
import requests

response = requests.get('http://localhost:8001/api/v1/surveys/access/my?skip=0&limit=20&admin_access=false')
print(response.text)
```


## Get Enumerators For Supervisor

`GET /api/v1/surveys/access/enumerators`

Get all enumerator user IDs that were granted access by the current Field Supervisor.

This is used by data-service to filter responses that Field Supervisors can see.

Authentication: no security requirement declared for this operation.

Responses:

- 200: Successful Response

Content type: application/json

Type: object

Schema: [SurveyService_EnumeratorListResponse](/api-reference/schemas/surveyservice-enumeratorlistresponse-e7b82581a7.md)

- `enumerator_ids` (required)
  Type: array
  
  Items:
    Type: string

## Examples

### cURL

```bash
curl -X GET 'http://localhost:8001/api/v1/surveys/access/enumerators'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8001/api/v1/surveys/access/enumerators', {
  method: 'GET',
});

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

### Python

```python
import requests

response = requests.get('http://localhost:8001/api/v1/surveys/access/enumerators')
print(response.text)
```


## Relay Production Activity

`POST /api/v1/surveys/{survey_id}/production-activity`

Mark that production collection has begun for a survey's project (internal).

Fail-closed: if the project cannot begin production activity (DRAFT or
closed) or workspace-service is unreachable, this returns the workspace
error and the CALLER MUST NOT proceed with the collection event.

Authentication: no security requirement declared for this operation.

Parameters:

- `survey_id` (path, string, uuid, required)
  Type: string, uuid

Responses:

- 200: Successful Response

Content type: application/json

Type: unknown

- 422: Validation Error

Content type: application/json

Type: object

Schema: [SurveyService_HTTPValidationError](/api-reference/schemas/surveyservice-httpvalidationerror-6237d5d2de.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [SurveyService_ValidationError](/api-reference/schemas/surveyservice-validationerror-21d2a3258e.md); Type: object

## Examples

### cURL

```bash
curl -X POST 'http://localhost:8001/api/v1/surveys/550e8400-e29b-41d4-a716-446655440000/production-activity'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8001/api/v1/surveys/550e8400-e29b-41d4-a716-446655440000/production-activity', {
  method: 'POST',
});

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

### Python

```python
import requests

response = requests.post('http://localhost:8001/api/v1/surveys/550e8400-e29b-41d4-a716-446655440000/production-activity')
print(response.text)
```


## Issue Grant

`POST /api/v1/surveys/{survey_id}/collection-grants`

Issue a durable collection grant (internal, service-auth only).

Called by sync-service (device_download on download acknowledgement) and
form-service (interview_reservation at production interview creation).
Grants are issued ONLY while the governing project is ACTIVE, and issuing
one marks the project's monotonic production-activity invariant. The
endpoint is idempotent — an existing identical binding is returned as-is,
so re-acknowledgements after closure still resolve their original grant.

Authentication: no security requirement declared for this operation.

Parameters:

- `survey_id` (path, string, uuid, required)
  Type: string, uuid

Request body: application/json (required)

Type: object

Schema: [SurveyService_IssueCollectionGrantRequest](/api-reference/schemas/surveyservice-issuecollectiongrantrequest-c252488a8b.md)

- `kind` (required)
  Type: string
  
  device_download | interview_reservation

- `user_id` (required)
  Type: string, uuid

- `survey_version_id` (required)
  Type: string, uuid

- `device_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string
    
    maxLength: 255
  
    Type: null

- `interview_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string, uuid
  
    Type: null

- `schema_hash` (optional)
  Type: unknown
  
  anyOf:
    Type: string
    
    maxLength: 64
  
    Type: null

Responses:

- 200: Successful Response

Content type: application/json

Type: object

Schema: [SurveyService_CollectionGrantResponse](/api-reference/schemas/surveyservice-collectiongrantresponse-76f52aa023.md)

- `id` (required)
  Type: string

- `kind` (required)
  Type: string

- `survey_id` (required)
  Type: string

- `survey_version_id` (required)
  Type: string

- `user_id` (required)
  Type: string

- `device_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `interview_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `project_status_at_issue` (required)
  Type: string

- `granted_at` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `project_bound` (optional)
  Type: boolean
  
  default: true

- 422: Validation Error

Content type: application/json

Type: object

Schema: [SurveyService_HTTPValidationError](/api-reference/schemas/surveyservice-httpvalidationerror-6237d5d2de.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [SurveyService_ValidationError](/api-reference/schemas/surveyservice-validationerror-21d2a3258e.md); Type: object

## Examples

### cURL

```bash
curl -X POST 'http://localhost:8001/api/v1/surveys/550e8400-e29b-41d4-a716-446655440000/collection-grants' \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "kind": "string",
  "user_id": "550e8400-e29b-41d4-a716-446655440000",
  "survey_version_id": "550e8400-e29b-41d4-a716-446655440000",
  "device_id": "string",
  "interview_id": "550e8400-e29b-41d4-a716-446655440000",
  "schema_hash": "string"
}'
```

### JavaScript

```javascript
const body = `{
  "kind": "string",
  "user_id": "550e8400-e29b-41d4-a716-446655440000",
  "survey_version_id": "550e8400-e29b-41d4-a716-446655440000",
  "device_id": "string",
  "interview_id": "550e8400-e29b-41d4-a716-446655440000",
  "schema_hash": "string"
}`;

const response = await fetch('http://localhost:8001/api/v1/surveys/550e8400-e29b-41d4-a716-446655440000/collection-grants', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
  },
  body,
});

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

### Python

```python
import requests

body = '''{
  "kind": "string",
  "user_id": "550e8400-e29b-41d4-a716-446655440000",
  "survey_version_id": "550e8400-e29b-41d4-a716-446655440000",
  "device_id": "string",
  "interview_id": "550e8400-e29b-41d4-a716-446655440000",
  "schema_hash": "string"
}'''

response = requests.post(
    'http://localhost:8001/api/v1/surveys/550e8400-e29b-41d4-a716-446655440000/collection-grants',
    data=body.encode('utf-8'),
    headers={
        'Content-Type': 'application/json',
    },
)
print(response.text)
```


## Validate Grant

`GET /api/v1/surveys/{survey_id}/collection-grants/validate`

Authoritatively validate a submission's collection provenance (internal).

Called by data-service (response submission/edit) and media-service (media
upload) when a project is no longer ACTIVE. Returns valid=true only when a
matching grant was issued while the project was ACTIVE. Forged
client-supplied identifiers never match (grants are server-created rows).

Authentication: no security requirement declared for this operation.

Parameters:

- `survey_id` (path, string, uuid, required)
  Type: string, uuid

- `user_id` (query, string, uuid, required)
  Type: string, uuid

- `survey_version_id` (query, unknown, optional)
  Type: unknown
  
  anyOf:
    Type: string, uuid
  
    Type: null

- `device_id` (query, unknown, optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `interview_id` (query, unknown, optional)
  Type: unknown
  
  anyOf:
    Type: string, uuid
  
    Type: null

Responses:

- 200: Successful Response

Content type: application/json

Type: object

Schema: [SurveyService_ValidateCollectionGrantResponse](/api-reference/schemas/surveyservice-validatecollectiongrantresponse-85d32170bf.md)

- `valid` (required)
  Type: boolean

- `project_bound` (required)
  Type: boolean

- `grant_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `kind` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `survey_version_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `granted_at` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `project_status_at_issue` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `late_arrival_flagged` (optional)
  Type: boolean
  
  default: false

- 422: Validation Error

Content type: application/json

Type: object

Schema: [SurveyService_HTTPValidationError](/api-reference/schemas/surveyservice-httpvalidationerror-6237d5d2de.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [SurveyService_ValidationError](/api-reference/schemas/surveyservice-validationerror-21d2a3258e.md); Type: object

## Examples

### cURL

```bash
curl -X GET 'http://localhost:8001/api/v1/surveys/550e8400-e29b-41d4-a716-446655440000/collection-grants/validate?user_id=550e8400-e29b-41d4-a716-446655440000'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8001/api/v1/surveys/550e8400-e29b-41d4-a716-446655440000/collection-grants/validate?user_id=550e8400-e29b-41d4-a716-446655440000', {
  method: 'GET',
});

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

### Python

```python
import requests

response = requests.get('http://localhost:8001/api/v1/surveys/550e8400-e29b-41d4-a716-446655440000/collection-grants/validate?user_id=550e8400-e29b-41d4-a716-446655440000')
print(response.text)
```


## Mark Late Arrival

`POST /api/v1/surveys/collection-grants/{grant_id}/late-arrival`

Flag a grant whose data landed after project closure (internal).

Called by data-service when it accepts a response for a non-ACTIVE project
via a valid grant. The flag surfaces in supervisor review as a
late-arrival warning — collection stays preserved, but is auditable.

Authentication: no security requirement declared for this operation.

Parameters:

- `grant_id` (path, string, uuid, required)
  Type: string, uuid

Responses:

- 200: Successful Response

Content type: application/json

Type: unknown

- 422: Validation Error

Content type: application/json

Type: object

Schema: [SurveyService_HTTPValidationError](/api-reference/schemas/surveyservice-httpvalidationerror-6237d5d2de.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [SurveyService_ValidationError](/api-reference/schemas/surveyservice-validationerror-21d2a3258e.md); Type: object

## Examples

### cURL

```bash
curl -X POST 'http://localhost:8001/api/v1/surveys/collection-grants/550e8400-e29b-41d4-a716-446655440000/late-arrival'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8001/api/v1/surveys/collection-grants/550e8400-e29b-41d4-a716-446655440000/late-arrival', {
  method: 'POST',
});

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

### Python

```python
import requests

response = requests.post('http://localhost:8001/api/v1/surveys/collection-grants/550e8400-e29b-41d4-a716-446655440000/late-arrival')
print(response.text)
```


## Get Survey Name

`GET /api/v1/surveys/internal/name/{survey_id}`

Return the display name for an internal survey_id (service-auth only).

Authentication: no security requirement declared for this operation.

Parameters:

- `survey_id` (path, string, uuid, required)
  Type: string, uuid

Responses:

- 200: Successful Response

Content type: application/json

Type: unknown

- 422: Validation Error

Content type: application/json

Type: object

Schema: [SurveyService_HTTPValidationError](/api-reference/schemas/surveyservice-httpvalidationerror-6237d5d2de.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [SurveyService_ValidationError](/api-reference/schemas/surveyservice-validationerror-21d2a3258e.md); Type: object

## Examples

### cURL

```bash
curl -X GET 'http://localhost:8001/api/v1/surveys/internal/name/550e8400-e29b-41d4-a716-446655440000'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8001/api/v1/surveys/internal/name/550e8400-e29b-41d4-a716-446655440000', {
  method: 'GET',
});

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

### Python

```python
import requests

response = requests.get('http://localhost:8001/api/v1/surveys/internal/name/550e8400-e29b-41d4-a716-446655440000')
print(response.text)
```


## List Template Categories

`GET /api/v1/template-categories`

List all template categories for the tenant.

Authentication: no security requirement declared for this operation.

Parameters:

- `skip` (query, integer, optional)
  Type: integer
  
  default: 0
  
  minimum: 0

- `limit` (query, integer, optional)
  Type: integer
  
  default: 20
  
  minimum: 1
  
  maximum: 100

- `search` (query, unknown, optional) - Search categories by name or description
  Type: unknown
  
  Search categories by name or description
  
  anyOf:
    Type: string
  
    Type: null

Responses:

- 200: Successful Response

Content type: application/json

Type: object

Schema: [SurveyService_TemplateCategoryListResponse](/api-reference/schemas/surveyservice-templatecategorylistresponse-5b69288fd0.md)

- `items` (required)
  Type: array
  
  Items:
    Reference: [SurveyService_TemplateCategoryResponse](/api-reference/schemas/surveyservice-templatecategoryresponse-01bb03f726.md); Type: object

- `total` (required)
  Type: integer

- `limit` (required)
  Type: integer

- `skip` (required)
  Type: integer

- `has_next` (required)
  Type: boolean

- `has_previous` (required)
  Type: boolean

- 422: Validation Error

Content type: application/json

Type: object

Schema: [SurveyService_HTTPValidationError](/api-reference/schemas/surveyservice-httpvalidationerror-6237d5d2de.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [SurveyService_ValidationError](/api-reference/schemas/surveyservice-validationerror-21d2a3258e.md); Type: object

## Examples

### cURL

```bash
curl -X GET 'http://localhost:8001/api/v1/template-categories?skip=0&limit=20'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8001/api/v1/template-categories?skip=0&limit=20', {
  method: 'GET',
});

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

### Python

```python
import requests

response = requests.get('http://localhost:8001/api/v1/template-categories?skip=0&limit=20')
print(response.text)
```


## Create Template Category

`POST /api/v1/template-categories`

Create a new template category.

Authentication: no security requirement declared for this operation.

Request body: application/json (required)

Type: object

Schema: [SurveyService_TemplateCategoryCreate](/api-reference/schemas/surveyservice-templatecategorycreate-9d2165817d.md)

- `name` (required)
  Type: string
  
  minLength: 1
  
  maxLength: 255

- `description` (optional)
  Type: unknown
  
  anyOf:
    Type: string
    
    maxLength: 2000
  
    Type: null

- `icon_name` (optional)
  Type: unknown
  
  anyOf:
    Type: string
    
    maxLength: 100
  
    Type: null

Responses:

- 201: Successful Response

Content type: application/json

Type: object

Schema: [SurveyService_TemplateCategoryResponse](/api-reference/schemas/surveyservice-templatecategoryresponse-01bb03f726.md)

- `id` (required)
  Type: string

- `tenant_id` (required)
  Type: string

- `name` (required)
  Type: string

- `description` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `icon_name` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `created_at` (required)
  Type: string, date-time

- `updated_at` (required)
  Type: string, date-time

- 422: Validation Error

Content type: application/json

Type: object

Schema: [SurveyService_HTTPValidationError](/api-reference/schemas/surveyservice-httpvalidationerror-6237d5d2de.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [SurveyService_ValidationError](/api-reference/schemas/surveyservice-validationerror-21d2a3258e.md); Type: object

## Examples

### cURL

```bash
curl -X POST 'http://localhost:8001/api/v1/template-categories' \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "name": "string",
  "description": "string",
  "icon_name": "string"
}'
```

### JavaScript

```javascript
const body = `{
  "name": "string",
  "description": "string",
  "icon_name": "string"
}`;

const response = await fetch('http://localhost:8001/api/v1/template-categories', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
  },
  body,
});

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

### Python

```python
import requests

body = '''{
  "name": "string",
  "description": "string",
  "icon_name": "string"
}'''

response = requests.post(
    'http://localhost:8001/api/v1/template-categories',
    data=body.encode('utf-8'),
    headers={
        'Content-Type': 'application/json',
    },
)
print(response.text)
```


## Get Template Category

`GET /api/v1/template-categories/{category_id}`

Get a specific template category by ID.

Authentication: no security requirement declared for this operation.

Parameters:

- `category_id` (path, string, required)
  Type: string

Responses:

- 200: Successful Response

Content type: application/json

Type: object

Schema: [SurveyService_TemplateCategoryResponse](/api-reference/schemas/surveyservice-templatecategoryresponse-01bb03f726.md)

- `id` (required)
  Type: string

- `tenant_id` (required)
  Type: string

- `name` (required)
  Type: string

- `description` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `icon_name` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `created_at` (required)
  Type: string, date-time

- `updated_at` (required)
  Type: string, date-time

- 422: Validation Error

Content type: application/json

Type: object

Schema: [SurveyService_HTTPValidationError](/api-reference/schemas/surveyservice-httpvalidationerror-6237d5d2de.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [SurveyService_ValidationError](/api-reference/schemas/surveyservice-validationerror-21d2a3258e.md); Type: object

## Examples

### cURL

```bash
curl -X GET 'http://localhost:8001/api/v1/template-categories/string'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8001/api/v1/template-categories/string', {
  method: 'GET',
});

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

### Python

```python
import requests

response = requests.get('http://localhost:8001/api/v1/template-categories/string')
print(response.text)
```


## Update Template Category

`PUT /api/v1/template-categories/{category_id}`

Update a template category.

Authentication: no security requirement declared for this operation.

Parameters:

- `category_id` (path, string, required)
  Type: string

Request body: application/json (required)

Type: object

Schema: [SurveyService_TemplateCategoryUpdate](/api-reference/schemas/surveyservice-templatecategoryupdate-6f49019647.md)

- `name` (optional)
  Type: unknown
  
  anyOf:
    Type: string
    
    minLength: 1
    
    maxLength: 255
  
    Type: null

- `description` (optional)
  Type: unknown
  
  anyOf:
    Type: string
    
    maxLength: 2000
  
    Type: null

- `icon_name` (optional)
  Type: unknown
  
  anyOf:
    Type: string
    
    maxLength: 100
  
    Type: null

Responses:

- 200: Successful Response

Content type: application/json

Type: object

Schema: [SurveyService_TemplateCategoryResponse](/api-reference/schemas/surveyservice-templatecategoryresponse-01bb03f726.md)

- `id` (required)
  Type: string

- `tenant_id` (required)
  Type: string

- `name` (required)
  Type: string

- `description` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `icon_name` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `created_at` (required)
  Type: string, date-time

- `updated_at` (required)
  Type: string, date-time

- 422: Validation Error

Content type: application/json

Type: object

Schema: [SurveyService_HTTPValidationError](/api-reference/schemas/surveyservice-httpvalidationerror-6237d5d2de.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [SurveyService_ValidationError](/api-reference/schemas/surveyservice-validationerror-21d2a3258e.md); Type: object

## Examples

### cURL

```bash
curl -X PUT 'http://localhost:8001/api/v1/template-categories/string' \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "name": "string",
  "description": "string",
  "icon_name": "string"
}'
```

### JavaScript

```javascript
const body = `{
  "name": "string",
  "description": "string",
  "icon_name": "string"
}`;

const response = await fetch('http://localhost:8001/api/v1/template-categories/string', {
  method: 'PUT',
  headers: {
    'Content-Type': 'application/json',
  },
  body,
});

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

### Python

```python
import requests

body = '''{
  "name": "string",
  "description": "string",
  "icon_name": "string"
}'''

response = requests.put(
    'http://localhost:8001/api/v1/template-categories/string',
    data=body.encode('utf-8'),
    headers={
        'Content-Type': 'application/json',
    },
)
print(response.text)
```


## Delete Template Category

`DELETE /api/v1/template-categories/{category_id}`

Delete a template category.

Authentication: no security requirement declared for this operation.

Parameters:

- `category_id` (path, string, required)
  Type: string

Responses:

- 204: Successful Response

- 422: Validation Error

Content type: application/json

Type: object

Schema: [SurveyService_HTTPValidationError](/api-reference/schemas/surveyservice-httpvalidationerror-6237d5d2de.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [SurveyService_ValidationError](/api-reference/schemas/surveyservice-validationerror-21d2a3258e.md); Type: object

## Examples

### cURL

```bash
curl -X DELETE 'http://localhost:8001/api/v1/template-categories/string'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8001/api/v1/template-categories/string', {
  method: 'DELETE',
});

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

### Python

```python
import requests

response = requests.delete('http://localhost:8001/api/v1/template-categories/string')
print(response.text)
```


## List Templates

`GET /api/v1/templates`

List all survey templates accessible for the tenant.

Authentication: no security requirement declared for this operation.

Parameters:

- `skip` (query, integer, optional)
  Type: integer
  
  default: 0
  
  minimum: 0

- `limit` (query, integer, optional)
  Type: integer
  
  default: 20
  
  minimum: 1
  
  maximum: 100

- `category_id` (query, unknown, optional) - Filter templates by category
  Type: unknown
  
  Filter templates by category
  
  anyOf:
    Type: string
  
    Type: null

- `search` (query, unknown, optional) - Search templates by name or description
  Type: unknown
  
  Search templates by name or description
  
  anyOf:
    Type: string
  
    Type: null

Responses:

- 200: Successful Response

Content type: application/json

Type: object

Schema: [SurveyService_SurveyTemplateListResponse](/api-reference/schemas/surveyservice-surveytemplatelistresponse-c54ef85c4c.md)

- `items` (required)
  Type: array
  
  Items:
    Reference: [SurveyService_SurveyTemplateResponse](/api-reference/schemas/surveyservice-surveytemplateresponse-3c9b6f0e45.md); Type: object

- `total` (required)
  Type: integer

- `limit` (required)
  Type: integer

- `skip` (required)
  Type: integer

- `has_next` (required)
  Type: boolean

- `has_previous` (required)
  Type: boolean

- 422: Validation Error

Content type: application/json

Type: object

Schema: [SurveyService_HTTPValidationError](/api-reference/schemas/surveyservice-httpvalidationerror-6237d5d2de.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [SurveyService_ValidationError](/api-reference/schemas/surveyservice-validationerror-21d2a3258e.md); Type: object

## Examples

### cURL

```bash
curl -X GET 'http://localhost:8001/api/v1/templates?skip=0&limit=20'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8001/api/v1/templates?skip=0&limit=20', {
  method: 'GET',
});

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

### Python

```python
import requests

response = requests.get('http://localhost:8001/api/v1/templates?skip=0&limit=20')
print(response.text)
```


## Create Template

`POST /api/v1/templates`

Create a new survey template.

Authentication: no security requirement declared for this operation.

Request body: application/json (required)

Type: object

Schema: [SurveyService_SurveyTemplateCreate](/api-reference/schemas/surveyservice-surveytemplatecreate-a66802de32.md)

- `name` (required)
  Type: string
  
  minLength: 1
  
  maxLength: 255

- `description` (optional)
  Type: unknown
  
  anyOf:
    Type: string
    
    maxLength: 2000
  
    Type: null

- `schema` (optional)
  Type: unknown
  
  anyOf:
    Type: object
    
    Additional properties: true
  
    Type: null

- `is_public` (optional)
  Type: boolean
  
  default: false

- `category_id` (required)
  Type: string
  
  ID of the template category
  
  minLength: 1

- `tenant_id` (optional)
  Type: unknown
  
  Tenant ID (null for global templates)
  
  anyOf:
    Type: string
  
    Type: null

Responses:

- 201: Successful Response

Content type: application/json

Type: object

Schema: [SurveyService_SurveyTemplateResponse](/api-reference/schemas/surveyservice-surveytemplateresponse-3c9b6f0e45.md)

- `id` (required)
  Type: string

- `tenant_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `category_id` (required)
  Type: string

- `name` (required)
  Type: string

- `description` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `schema` (optional)
  Type: unknown
  
  anyOf:
    Type: object
    
    Additional properties: true
  
    Type: null

- `is_public` (required)
  Type: boolean

- `created_by` (required)
  Type: string

- `created_at` (required)
  Type: string, date-time

- `updated_at` (required)
  Type: string, date-time

- `category` (optional)
  Type: unknown
  
  anyOf:
    Reference: [SurveyService_TemplateCategoryResponse](/api-reference/schemas/surveyservice-templatecategoryresponse-01bb03f726.md); Type: object
  
    Type: null

- 422: Validation Error

Content type: application/json

Type: object

Schema: [SurveyService_HTTPValidationError](/api-reference/schemas/surveyservice-httpvalidationerror-6237d5d2de.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [SurveyService_ValidationError](/api-reference/schemas/surveyservice-validationerror-21d2a3258e.md); Type: object

## Examples

### cURL

```bash
curl -X POST 'http://localhost:8001/api/v1/templates' \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "name": "string",
  "description": "string",
  "schema": {},
  "is_public": false,
  "category_id": "string",
  "tenant_id": "string"
}'
```

### JavaScript

```javascript
const body = `{
  "name": "string",
  "description": "string",
  "schema": {},
  "is_public": false,
  "category_id": "string",
  "tenant_id": "string"
}`;

const response = await fetch('http://localhost:8001/api/v1/templates', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
  },
  body,
});

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

### Python

```python
import requests

body = '''{
  "name": "string",
  "description": "string",
  "schema": {},
  "is_public": false,
  "category_id": "string",
  "tenant_id": "string"
}'''

response = requests.post(
    'http://localhost:8001/api/v1/templates',
    data=body.encode('utf-8'),
    headers={
        'Content-Type': 'application/json',
    },
)
print(response.text)
```


## List Templates Grouped

`GET /api/v1/templates/by-category`

List all survey templates grouped by category.

Authentication: no security requirement declared for this operation.

Responses:

- 200: Successful Response

Content type: application/json

Type: array

Items:
  Reference: [SurveyService_TemplatesByCategoryResponse](/api-reference/schemas/surveyservice-templatesbycategoryresponse-211480a557.md); Type: object

## Examples

### cURL

```bash
curl -X GET 'http://localhost:8001/api/v1/templates/by-category'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8001/api/v1/templates/by-category', {
  method: 'GET',
});

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

### Python

```python
import requests

response = requests.get('http://localhost:8001/api/v1/templates/by-category')
print(response.text)
```


## Get Template

`GET /api/v1/templates/{template_id}`

Get a specific survey template by ID.

Authentication: no security requirement declared for this operation.

Parameters:

- `template_id` (path, string, required)
  Type: string

Responses:

- 200: Successful Response

Content type: application/json

Type: object

Schema: [SurveyService_SurveyTemplateDetailResponse](/api-reference/schemas/surveyservice-surveytemplatedetailresponse-127ad9735c.md)

- `id` (required)
  Type: string

- `tenant_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `category_id` (required)
  Type: string

- `name` (required)
  Type: string

- `description` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `schema` (optional)
  Type: unknown
  
  anyOf:
    Type: object
    
    Additional properties: true
  
    Type: null

- `is_public` (required)
  Type: boolean

- `created_by` (required)
  Type: string

- `created_at` (required)
  Type: string, date-time

- `updated_at` (required)
  Type: string, date-time

- `category` (required)
  Reference: [SurveyService_TemplateCategoryResponse](/api-reference/schemas/surveyservice-templatecategoryresponse-01bb03f726.md); Type: object

- 422: Validation Error

Content type: application/json

Type: object

Schema: [SurveyService_HTTPValidationError](/api-reference/schemas/surveyservice-httpvalidationerror-6237d5d2de.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [SurveyService_ValidationError](/api-reference/schemas/surveyservice-validationerror-21d2a3258e.md); Type: object

## Examples

### cURL

```bash
curl -X GET 'http://localhost:8001/api/v1/templates/string'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8001/api/v1/templates/string', {
  method: 'GET',
});

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

### Python

```python
import requests

response = requests.get('http://localhost:8001/api/v1/templates/string')
print(response.text)
```


## Update Template

`PUT /api/v1/templates/{template_id}`

Update a survey template.

Authentication: no security requirement declared for this operation.

Parameters:

- `template_id` (path, string, required)
  Type: string

Request body: application/json (required)

Type: object

Schema: [SurveyService_SurveyTemplateUpdate](/api-reference/schemas/surveyservice-surveytemplateupdate-afa2e05134.md)

- `name` (optional)
  Type: unknown
  
  anyOf:
    Type: string
    
    minLength: 1
    
    maxLength: 255
  
    Type: null

- `description` (optional)
  Type: unknown
  
  anyOf:
    Type: string
    
    maxLength: 2000
  
    Type: null

- `schema` (optional)
  Type: unknown
  
  anyOf:
    Type: object
    
    Additional properties: true
  
    Type: null

- `category_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `is_public` (optional)
  Type: unknown
  
  anyOf:
    Type: boolean
  
    Type: null

Responses:

- 200: Successful Response

Content type: application/json

Type: object

Schema: [SurveyService_SurveyTemplateResponse](/api-reference/schemas/surveyservice-surveytemplateresponse-3c9b6f0e45.md)

- `id` (required)
  Type: string

- `tenant_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `category_id` (required)
  Type: string

- `name` (required)
  Type: string

- `description` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `schema` (optional)
  Type: unknown
  
  anyOf:
    Type: object
    
    Additional properties: true
  
    Type: null

- `is_public` (required)
  Type: boolean

- `created_by` (required)
  Type: string

- `created_at` (required)
  Type: string, date-time

- `updated_at` (required)
  Type: string, date-time

- `category` (optional)
  Type: unknown
  
  anyOf:
    Reference: [SurveyService_TemplateCategoryResponse](/api-reference/schemas/surveyservice-templatecategoryresponse-01bb03f726.md); Type: object
  
    Type: null

- 422: Validation Error

Content type: application/json

Type: object

Schema: [SurveyService_HTTPValidationError](/api-reference/schemas/surveyservice-httpvalidationerror-6237d5d2de.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [SurveyService_ValidationError](/api-reference/schemas/surveyservice-validationerror-21d2a3258e.md); Type: object

## Examples

### cURL

```bash
curl -X PUT 'http://localhost:8001/api/v1/templates/string' \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "name": "string",
  "description": "string",
  "schema": {},
  "category_id": "string",
  "is_public": true
}'
```

### JavaScript

```javascript
const body = `{
  "name": "string",
  "description": "string",
  "schema": {},
  "category_id": "string",
  "is_public": true
}`;

const response = await fetch('http://localhost:8001/api/v1/templates/string', {
  method: 'PUT',
  headers: {
    'Content-Type': 'application/json',
  },
  body,
});

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

### Python

```python
import requests

body = '''{
  "name": "string",
  "description": "string",
  "schema": {},
  "category_id": "string",
  "is_public": true
}'''

response = requests.put(
    'http://localhost:8001/api/v1/templates/string',
    data=body.encode('utf-8'),
    headers={
        'Content-Type': 'application/json',
    },
)
print(response.text)
```


## Delete Template

`DELETE /api/v1/templates/{template_id}`

Delete a survey template.

Authentication: no security requirement declared for this operation.

Parameters:

- `template_id` (path, string, required)
  Type: string

Responses:

- 204: Successful Response

- 422: Validation Error

Content type: application/json

Type: object

Schema: [SurveyService_HTTPValidationError](/api-reference/schemas/surveyservice-httpvalidationerror-6237d5d2de.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [SurveyService_ValidationError](/api-reference/schemas/surveyservice-validationerror-21d2a3258e.md); Type: object

## Examples

### cURL

```bash
curl -X DELETE 'http://localhost:8001/api/v1/templates/string'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8001/api/v1/templates/string', {
  method: 'DELETE',
});

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

### Python

```python
import requests

response = requests.delete('http://localhost:8001/api/v1/templates/string')
print(response.text)
```


## Import Template From Xlsform

`POST /api/v1/templates/import-xlsform`

Import a survey template from an XLSForm Excel file (.xlsx).

The XLSForm file should contain the following worksheets:
- **survey** (required): Question definitions with columns: type, name, label, hint, required, etc.
- **choices** (optional): Choice lists for select_one/select_multiple questions
- **settings** (optional): Form metadata (form_title, form_id, version, etc.)

Reference: https://xlsform.org/en/

Parses the uploaded file into a survey schema and persists it as a reusable
template in the given category. The schema can later be used to create
surveys via the create-from-template flow.

Authentication: no security requirement declared for this operation.

Request body: multipart/form-data (required)

Type: object

Schema: [SurveyService_Body_import_template_from_xlsform_api_v1_templates_import_xlsform_post](/api-reference/schemas/surveyservice-body-import-template-from-xlsform-api-v1-templates-import-xlsform-post-9975f0f41d.md)

- `file` (required)
  Type: string
  
  XLSForm Excel file (.xlsx)

- `name` (required)
  Type: string
  
  Template name
  
  minLength: 1
  
  maxLength: 255

- `category_id` (required)
  Type: string
  
  Template category ID
  
  minLength: 1

- `description` (optional)
  Type: unknown
  
  Template description
  
  anyOf:
    Type: string
    
    maxLength: 2000
  
    Type: null

- `is_public` (optional)
  Type: boolean
  
  Whether the template is public
  
  default: false

Responses:

- 201: Successful Response

Content type: application/json

Type: object

Schema: [SurveyService_TemplateImportResponse](/api-reference/schemas/surveyservice-templateimportresponse-dc4e6cc7de.md)

- `id` (required)
  Type: string

- `tenant_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `category_id` (required)
  Type: string

- `name` (required)
  Type: string

- `description` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `schema` (optional)
  Type: unknown
  
  anyOf:
    Type: object
    
    Additional properties: true
  
    Type: null

- `is_public` (required)
  Type: boolean

- `created_by` (required)
  Type: string

- `created_at` (required)
  Type: string, date-time

- `updated_at` (required)
  Type: string, date-time

- `category` (optional)
  Type: unknown
  
  anyOf:
    Reference: [SurveyService_TemplateCategoryResponse](/api-reference/schemas/surveyservice-templatecategoryresponse-01bb03f726.md); Type: object
  
    Type: null

- `import_warnings` (optional)
  Type: array
  
  Items:
    Type: object
    
    Additional properties: true

- 422: Validation Error

Content type: application/json

Type: object

Schema: [SurveyService_HTTPValidationError](/api-reference/schemas/surveyservice-httpvalidationerror-6237d5d2de.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [SurveyService_ValidationError](/api-reference/schemas/surveyservice-validationerror-21d2a3258e.md); Type: object

## Examples

### cURL

```bash
curl -X POST 'http://localhost:8001/api/v1/templates/import-xlsform' \
  --form-string 'file=string' \
  --form-string 'name=string' \
  --form-string 'category_id=string' \
  --form-string 'description=string' \
  --form-string 'is_public=false'
```

### JavaScript

```javascript
const form = new FormData();
form.append('file', 'string');
form.append('name', 'string');
form.append('category_id', 'string');
form.append('description', 'string');
form.append('is_public', 'false');
const response = await fetch('http://localhost:8001/api/v1/templates/import-xlsform', {
  method: 'POST',
  headers: {},
  body: form,
});
console.log(await response.text());
```

### Python

```python
import requests
from contextlib import ExitStack

with ExitStack() as stack:
    files = [
        ('file', (None, 'string')),
        ('name', (None, 'string')),
        ('category_id', (None, 'string')),
        ('description', (None, 'string')),
        ('is_public', (None, 'false')),
    ]
    response = requests.request('POST', 'http://localhost:8001/api/v1/templates/import-xlsform', headers={}, files=files)
    print(response.text)
```


## Download a starter XLSForm template

`GET /api/v1/templates/import-xlsform/download`

Download a starter .xlsx XLSForm workbook that can be filled in and re-imported via POST /templates/import-xlsform.

Authentication: no security requirement declared for this operation.

Responses:

- 200: Successful Response

Content type: application/json

Type: unknown

## Examples

### cURL

```bash
curl -X GET 'http://localhost:8001/api/v1/templates/import-xlsform/download'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8001/api/v1/templates/import-xlsform/download', {
  method: 'GET',
});

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

### Python

```python
import requests

response = requests.get('http://localhost:8001/api/v1/templates/import-xlsform/download')
print(response.text)
```


## Create Survey From Template

`POST /api/v1/templates/create-survey`

Create a new survey using a template's schema.

Authentication: no security requirement declared for this operation.

Request body: application/json (required)

Type: object

Schema: [SurveyService_CreateSurveyFromTemplateRequest](/api-reference/schemas/surveyservice-createsurveyfromtemplaterequest-a1896e60e4.md)

- `template_id` (required)
  Type: string
  
  Template ID to create survey from
  
  minLength: 1

- `name` (required)
  Type: string
  
  minLength: 1
  
  maxLength: 255

- `description` (optional)
  Type: unknown
  
  anyOf:
    Type: string
    
    maxLength: 2000
  
    Type: null

- `workspace_id` (required)
  Type: string
  
  Workspace ID for the new survey
  
  minLength: 1

- `project_id` (required)
  Type: string
  
  Project ID for the new survey
  
  minLength: 1

- `is_anonymous` (optional)
  Type: boolean
  
  default: false

- `allow_multiple_responses` (optional)
  Type: boolean
  
  default: false

- `scheduling_enabled` (optional)
  Type: boolean
  
  default: false

- `open_at` (optional)
  Type: unknown
  
  Scheduled open timestamp
  
  anyOf:
    Type: string, date-time
  
    Type: null

- `close_at` (optional)
  Type: unknown
  
  Scheduled close timestamp
  
  anyOf:
    Type: string, date-time
  
    Type: null

Responses:

- 201: Successful Response

Content type: application/json

Type: object

Schema: [SurveyService_CreateSurveyFromTemplateResponse](/api-reference/schemas/surveyservice-createsurveyfromtemplateresponse-3531509aa6.md)

- `survey_id` (required)
  Type: string

- `name` (required)
  Type: string

- `template_id` (required)
  Type: string

- `created_at` (required)
  Type: string, date-time

- 422: Validation Error

Content type: application/json

Type: object

Schema: [SurveyService_HTTPValidationError](/api-reference/schemas/surveyservice-httpvalidationerror-6237d5d2de.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [SurveyService_ValidationError](/api-reference/schemas/surveyservice-validationerror-21d2a3258e.md); Type: object

## Examples

### cURL

```bash
curl -X POST 'http://localhost:8001/api/v1/templates/create-survey' \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "template_id": "string",
  "name": "string",
  "description": "string",
  "workspace_id": "string",
  "project_id": "string",
  "is_anonymous": false,
  "allow_multiple_responses": false,
  "scheduling_enabled": false,
  "open_at": "2024-01-15T09:30:00Z",
  "close_at": "2024-01-15T09:30:00Z"
}'
```

### JavaScript

```javascript
const body = `{
  "template_id": "string",
  "name": "string",
  "description": "string",
  "workspace_id": "string",
  "project_id": "string",
  "is_anonymous": false,
  "allow_multiple_responses": false,
  "scheduling_enabled": false,
  "open_at": "2024-01-15T09:30:00Z",
  "close_at": "2024-01-15T09:30:00Z"
}`;

const response = await fetch('http://localhost:8001/api/v1/templates/create-survey', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
  },
  body,
});

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

### Python

```python
import requests

body = '''{
  "template_id": "string",
  "name": "string",
  "description": "string",
  "workspace_id": "string",
  "project_id": "string",
  "is_anonymous": false,
  "allow_multiple_responses": false,
  "scheduling_enabled": false,
  "open_at": "2024-01-15T09:30:00Z",
  "close_at": "2024-01-15T09:30:00Z"
}'''

response = requests.post(
    'http://localhost:8001/api/v1/templates/create-survey',
    data=body.encode('utf-8'),
    headers={
        'Content-Type': 'application/json',
    },
)
print(response.text)
```


## Seed Default Templates

`POST /api/v1/templates/seed`

Seed default template categories and templates if none exist.

This endpoint is idempotent - safe to call multiple times.
Default categories: Census, Health, Education, Agriculture
Default templates: Standard Census Form, Community Health Assessment

Authentication: no security requirement declared for this operation.

Responses:

- 200: Successful Response

Content type: application/json

Type: object

Additional properties: true

## Examples

### cURL

```bash
curl -X POST 'http://localhost:8001/api/v1/templates/seed'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8001/api/v1/templates/seed', {
  method: 'POST',
});

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

### Python

```python
import requests

response = requests.post('http://localhost:8001/api/v1/templates/seed')
print(response.text)
```


## Upload XLSForm as New Survey Version

`POST /api/v1/surveys/{survey_id}/versions/upload`

Create a new version of an existing survey by uploading an XLSForm file.

This endpoint:
1. Validates the uploaded file (size, extension)
2. Parses the XLSForm using XLSFormImportService
3. Validates schema using existing validators
4. Creates a new version using VersionService (SAME logic as JSON endpoint)
5. Returns standardized response

Authentication: no security requirement declared for this operation.

Parameters:

- `survey_id` (path, string, uuid, required)
  Type: string, uuid

Request body: multipart/form-data (required)

Type: object

Schema: [SurveyService_Body_upload_xlsform_as_new_version_api_v1_surveys__survey_id__versions_upload_post](/api-reference/schemas/surveyservice-body-upload-xlsform-as-new-version-api-v1-surveys-survey-id-versions-upload-post-7627bf80b3.md)

- `file` (required)
  Type: string

Responses:

- 201: Created survey version

Content type: application/json

Type: unknown

- 422: Validation Error

Content type: application/json

Type: object

Schema: [SurveyService_HTTPValidationError](/api-reference/schemas/surveyservice-httpvalidationerror-6237d5d2de.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [SurveyService_ValidationError](/api-reference/schemas/surveyservice-validationerror-21d2a3258e.md); Type: object

## Examples

### cURL

```bash
curl -X POST 'http://localhost:8001/api/v1/surveys/550e8400-e29b-41d4-a716-446655440000/versions/upload' \
  --form-string 'file=string'
```

### JavaScript

```javascript
const form = new FormData();
form.append('file', 'string');
const response = await fetch('http://localhost:8001/api/v1/surveys/550e8400-e29b-41d4-a716-446655440000/versions/upload', {
  method: 'POST',
  headers: {},
  body: form,
});
console.log(await response.text());
```

### Python

```python
import requests
from contextlib import ExitStack

with ExitStack() as stack:
    files = [
        ('file', (None, 'string')),
    ]
    response = requests.request('POST', 'http://localhost:8001/api/v1/surveys/550e8400-e29b-41d4-a716-446655440000/versions/upload', headers={}, files=files)
    print(response.text)
```


## Download blank form as PDF

`GET /api/v1/surveys/{survey_id}/blank.pdf`

Generate and download a blank paper form PDF for a published survey.

Authentication: no security requirement declared for this operation.

Parameters:

- `survey_id` (path, string, uuid, required)
  Type: string, uuid

- `primary_language` (query, string, optional) - Primary language code for labels
  Type: string
  
  Primary language code for labels
  
  default: "en"
  
  maxLength: 10

- `secondary_language` (query, string, optional) - Secondary language code for bilingual mode
  Type: string
  
  Secondary language code for bilingual mode
  
  default: ""
  
  maxLength: 10

- `export_mode` (query, string, optional) - Export mode: 'single' or 'bilingual'
  Type: string
  
  Export mode: 'single' or 'bilingual'
  
  default: "single"
  
  maxLength: 10

- `lang` (query, string, optional) - (Deprecated) Use primary_language instead
  Type: string
  
  (Deprecated) Use primary_language instead
  
  maxLength: 10

- `version` (query, string, optional) - Version string (optional)
  Type: string
  
  Version string (optional)
  
  default: ""
  
  maxLength: 50

- `org` (query, string, optional) - Organization name (optional)
  Type: string
  
  Organization name (optional)
  
  default: ""
  
  maxLength: 200

Responses:

- 200: PDF file bytes

Content type: application/json

Type: unknown

- 422: Validation Error

Content type: application/json

Type: object

Schema: [SurveyService_HTTPValidationError](/api-reference/schemas/surveyservice-httpvalidationerror-6237d5d2de.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [SurveyService_ValidationError](/api-reference/schemas/surveyservice-validationerror-21d2a3258e.md); Type: object

## Examples

### cURL

```bash
curl -X GET 'http://localhost:8001/api/v1/surveys/550e8400-e29b-41d4-a716-446655440000/blank.pdf?primary_language=en&secondary_language=&export_mode=single&version=&org='
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8001/api/v1/surveys/550e8400-e29b-41d4-a716-446655440000/blank.pdf?primary_language=en&secondary_language=&export_mode=single&version=&org=', {
  method: 'GET',
});

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

### Python

```python
import requests

response = requests.get('http://localhost:8001/api/v1/surveys/550e8400-e29b-41d4-a716-446655440000/blank.pdf?primary_language=en&secondary_language=&export_mode=single&version=&org=')
print(response.text)
```


## Metrics

`GET /api/v1/metrics`

Prometheus metrics endpoint

Also served by Data Service at http://localhost:8002.

Also served by Sync Service at http://localhost:8003.

Also served by Workspace Service at http://localhost:8006.

Also served by Media Service at http://localhost:8011.

Also served by Notification Service at http://localhost:8012.

Also served by Audit Service at http://localhost:8013.

Also served by Feature Flags Service at http://localhost:8014.

Authentication: no security requirement declared for this operation.

Responses:

- 200: Successful Response

Content type: application/json

Type: unknown

## Examples

### cURL

```bash
curl -X GET 'http://localhost:8001/api/v1/metrics'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8001/api/v1/metrics', {
  method: 'GET',
});

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

### Python

```python
import requests

response = requests.get('http://localhost:8001/api/v1/metrics')
print(response.text)
```


## Check Survey Schedules

`POST /api/v1/surveys/check-schedules`

Manually trigger survey schedule check for the tenant.

Authentication: no security requirement declared for this operation.

Responses:

- 200: Successful Response

Content type: application/json

Type: unknown

## Examples

### cURL

```bash
curl -X POST 'http://localhost:8001/api/v1/surveys/check-schedules'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8001/api/v1/surveys/check-schedules', {
  method: 'POST',
});

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

### Python

```python
import requests

response = requests.post('http://localhost:8001/api/v1/surveys/check-schedules')
print(response.text)
```


## Run Migrations

`POST /api/v1/migrations/run`

Run database migrations for tenant

Also served by Data Service at http://localhost:8002.

Also served by Sync Service at http://localhost:8003.

Also served by Analytics Service at http://localhost:8004.

Also served by Workspace Service at http://localhost:8006.

Also served by Webhook Service at http://localhost:8007.

Also served by Form Service at http://localhost:8010.

Also served by Media Service at http://localhost:8011.

Also served by Notification Service at http://localhost:8012.

Also served by Audit Service at http://localhost:8013.

Also served by Feature Flags Service at http://localhost:8014.

Authentication: no security requirement declared for this operation.

Responses:

- 200: Successful Response

Content type: application/json

Type: unknown

## Examples

### cURL

```bash
curl -X POST 'http://localhost:8001/api/v1/migrations/run'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8001/api/v1/migrations/run', {
  method: 'POST',
});

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

### Python

```python
import requests

response = requests.post('http://localhost:8001/api/v1/migrations/run')
print(response.text)
```


## Ingest Bulk Responses

`POST /api/v1/responses/bulk`

Ingest multiple survey responses in bulk.

- Idempotent: Same idempotency_key returns same response
- Max batch size: 100 responses per request
- Partial success: Failed items don't block successful ones
- Transactional: Each response created in own transaction

Authentication: no security requirement declared for this operation.

Request body: application/json (required)

Type: object

Schema: [DataService_BulkResponseDTO](/api-reference/schemas/dataservice-bulkresponsedto-6186a6cba3.md)

- `responses` (required)
  Type: array
  
  maxItems: 100
  
  Items:
    Reference: [DataService_BulkResponseItemDTO](/api-reference/schemas/dataservice-bulkresponseitemdto-815f063e10.md); Type: object

Responses:

- 200: Successful Response

Content type: application/json

Type: object

Schema: [DataService_BulkResponseResultDTO](/api-reference/schemas/dataservice-bulkresponseresultdto-7fef7c2d2a.md)

- `total` (required)
  Type: integer

- `successful` (required)
  Type: integer

- `failed` (required)
  Type: integer

- `results` (required)
  Type: array
  
  Items:
    Reference: [DataService_BulkResponseResultItemDTO](/api-reference/schemas/dataservice-bulkresponseresultitemdto-1444f4952d.md); Type: object

- 422: Validation Error

Content type: application/json

Type: object

Schema: [DataService_HTTPValidationError](/api-reference/schemas/dataservice-httpvalidationerror-2b62d4c031.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [DataService_ValidationError](/api-reference/schemas/dataservice-validationerror-be7f37f547.md); Type: object

## Examples

### cURL

```bash
curl -X POST 'http://localhost:8002/api/v1/responses/bulk' \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "responses": [
    {
      "idempotency_key": "string",
      "survey_id": "550e8400-e29b-41d4-a716-446655440000",
      "version_id": "550e8400-e29b-41d4-a716-446655440000",
      "respondent_id": "string",
      "answers": {},
      "metadata": {},
      "submitted_at": "2024-01-15T09:30:00Z"
    }
  ]
}'
```

### JavaScript

```javascript
const body = `{
  "responses": [
    {
      "idempotency_key": "string",
      "survey_id": "550e8400-e29b-41d4-a716-446655440000",
      "version_id": "550e8400-e29b-41d4-a716-446655440000",
      "respondent_id": "string",
      "answers": {},
      "metadata": {},
      "submitted_at": "2024-01-15T09:30:00Z"
    }
  ]
}`;

const response = await fetch('http://localhost:8002/api/v1/responses/bulk', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
  },
  body,
});

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

### Python

```python
import requests

body = '''{
  "responses": [
    {
      "idempotency_key": "string",
      "survey_id": "550e8400-e29b-41d4-a716-446655440000",
      "version_id": "550e8400-e29b-41d4-a716-446655440000",
      "respondent_id": "string",
      "answers": {},
      "metadata": {},
      "submitted_at": "2024-01-15T09:30:00Z"
    }
  ]
}'''

response = requests.post(
    'http://localhost:8002/api/v1/responses/bulk',
    data=body.encode('utf-8'),
    headers={
        'Content-Type': 'application/json',
    },
)
print(response.text)
```


## Bulk Delete Responses

`POST /api/v1/responses/bulk/delete`

Bulk delete survey responses.

Supports filtering by survey_id, status, date range, or specific response_ids.
Max 10,000 responses per operation. Use dry_run=True to preview the count.

Authentication: no security requirement declared for this operation.

Request body: application/json (required)

Type: object

Schema: [DataService_BulkDeleteRequest](/api-reference/schemas/dataservice-bulkdeleterequest-042aef6d19.md)

- `survey_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string, uuid
  
    Type: null

- `status` (optional)
  Type: unknown
  
  anyOf:
    Type: array
    
    Items:
      Reference: [DataService_ResponseStatus](/api-reference/schemas/dataservice-responsestatus-e5ef0d2145.md); Type: string
      
      enum: ["draft","submitted","completed","invalidated","pending_approval","approved","rejected","terminated"]
  
    Type: null

- `start_date` (optional)
  Type: unknown
  
  anyOf:
    Type: string, date-time
  
    Type: null

- `end_date` (optional)
  Type: unknown
  
  anyOf:
    Type: string, date-time
  
    Type: null

- `response_ids` (optional)
  Type: unknown
  
  anyOf:
    Type: array
    
    Items:
      Type: string, uuid
  
    Type: null

- `dry_run` (optional)
  Type: boolean
  
  default: false

Responses:

- 200: Successful Response

Content type: application/json

Type: object

Schema: [DataService_BulkOperationResponseDTO](/api-reference/schemas/dataservice-bulkoperationresponsedto-213250aa8e.md)

- `success_count` (optional)
  Type: integer
  
  default: 0

- `failure_count` (optional)
  Type: integer
  
  default: 0

- `skipped_count` (optional)
  Type: integer
  
  default: 0

- `errors` (optional)
  Type: array
  
  default: []
  
  Items:
    Type: object
    
    Additional properties: true

- `dry_run` (optional)
  Type: boolean
  
  default: false

- 422: Validation Error

Content type: application/json

Type: object

Schema: [DataService_HTTPValidationError](/api-reference/schemas/dataservice-httpvalidationerror-2b62d4c031.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [DataService_ValidationError](/api-reference/schemas/dataservice-validationerror-be7f37f547.md); Type: object

## Examples

### cURL

```bash
curl -X POST 'http://localhost:8002/api/v1/responses/bulk/delete' \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "survey_id": "550e8400-e29b-41d4-a716-446655440000",
  "status": [
    "draft"
  ],
  "start_date": "2024-01-15T09:30:00Z",
  "end_date": "2024-01-15T09:30:00Z",
  "response_ids": [
    "550e8400-e29b-41d4-a716-446655440000"
  ],
  "dry_run": false
}'
```

### JavaScript

```javascript
const body = `{
  "survey_id": "550e8400-e29b-41d4-a716-446655440000",
  "status": [
    "draft"
  ],
  "start_date": "2024-01-15T09:30:00Z",
  "end_date": "2024-01-15T09:30:00Z",
  "response_ids": [
    "550e8400-e29b-41d4-a716-446655440000"
  ],
  "dry_run": false
}`;

const response = await fetch('http://localhost:8002/api/v1/responses/bulk/delete', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
  },
  body,
});

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

### Python

```python
import requests

body = '''{
  "survey_id": "550e8400-e29b-41d4-a716-446655440000",
  "status": [
    "draft"
  ],
  "start_date": "2024-01-15T09:30:00Z",
  "end_date": "2024-01-15T09:30:00Z",
  "response_ids": [
    "550e8400-e29b-41d4-a716-446655440000"
  ],
  "dry_run": false
}'''

response = requests.post(
    'http://localhost:8002/api/v1/responses/bulk/delete',
    data=body.encode('utf-8'),
    headers={
        'Content-Type': 'application/json',
    },
)
print(response.text)
```


## Bulk Invalidate Responses

`POST /api/v1/responses/bulk/invalidate`

Bulk invalidate survey responses with a reason.

Supports filtering by survey_id, status, date range, or specific response_ids.
Max 10,000 responses per operation. Use dry_run=True to preview the count.

Authentication: no security requirement declared for this operation.

Request body: application/json (required)

Type: object

Schema: [DataService_BulkInvalidateRequest](/api-reference/schemas/dataservice-bulkinvalidaterequest-645d71b8e2.md)

- `survey_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string, uuid
  
    Type: null

- `status` (optional)
  Type: unknown
  
  anyOf:
    Type: array
    
    Items:
      Reference: [DataService_ResponseStatus](/api-reference/schemas/dataservice-responsestatus-e5ef0d2145.md); Type: string
      
      enum: ["draft","submitted","completed","invalidated","pending_approval","approved","rejected","terminated"]
  
    Type: null

- `start_date` (optional)
  Type: unknown
  
  anyOf:
    Type: string, date-time
  
    Type: null

- `end_date` (optional)
  Type: unknown
  
  anyOf:
    Type: string, date-time
  
    Type: null

- `response_ids` (optional)
  Type: unknown
  
  anyOf:
    Type: array
    
    Items:
      Type: string, uuid
  
    Type: null

- `dry_run` (optional)
  Type: boolean
  
  default: false

- `reason` (required)
  Type: string

Responses:

- 200: Successful Response

Content type: application/json

Type: object

Schema: [DataService_BulkOperationResponseDTO](/api-reference/schemas/dataservice-bulkoperationresponsedto-213250aa8e.md)

- `success_count` (optional)
  Type: integer
  
  default: 0

- `failure_count` (optional)
  Type: integer
  
  default: 0

- `skipped_count` (optional)
  Type: integer
  
  default: 0

- `errors` (optional)
  Type: array
  
  default: []
  
  Items:
    Type: object
    
    Additional properties: true

- `dry_run` (optional)
  Type: boolean
  
  default: false

- 422: Validation Error

Content type: application/json

Type: object

Schema: [DataService_HTTPValidationError](/api-reference/schemas/dataservice-httpvalidationerror-2b62d4c031.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [DataService_ValidationError](/api-reference/schemas/dataservice-validationerror-be7f37f547.md); Type: object

## Examples

### cURL

```bash
curl -X POST 'http://localhost:8002/api/v1/responses/bulk/invalidate' \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "survey_id": "550e8400-e29b-41d4-a716-446655440000",
  "status": [
    "draft"
  ],
  "start_date": "2024-01-15T09:30:00Z",
  "end_date": "2024-01-15T09:30:00Z",
  "response_ids": [
    "550e8400-e29b-41d4-a716-446655440000"
  ],
  "dry_run": false,
  "reason": "string"
}'
```

### JavaScript

```javascript
const body = `{
  "survey_id": "550e8400-e29b-41d4-a716-446655440000",
  "status": [
    "draft"
  ],
  "start_date": "2024-01-15T09:30:00Z",
  "end_date": "2024-01-15T09:30:00Z",
  "response_ids": [
    "550e8400-e29b-41d4-a716-446655440000"
  ],
  "dry_run": false,
  "reason": "string"
}`;

const response = await fetch('http://localhost:8002/api/v1/responses/bulk/invalidate', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
  },
  body,
});

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

### Python

```python
import requests

body = '''{
  "survey_id": "550e8400-e29b-41d4-a716-446655440000",
  "status": [
    "draft"
  ],
  "start_date": "2024-01-15T09:30:00Z",
  "end_date": "2024-01-15T09:30:00Z",
  "response_ids": [
    "550e8400-e29b-41d4-a716-446655440000"
  ],
  "dry_run": false,
  "reason": "string"
}'''

response = requests.post(
    'http://localhost:8002/api/v1/responses/bulk/invalidate',
    data=body.encode('utf-8'),
    headers={
        'Content-Type': 'application/json',
    },
)
print(response.text)
```


## Bulk Approve Responses

`POST /api/v1/responses/bulk/approve`

Bulk approve survey responses.

Supports filtering by survey_id, status, date range, or specific response_ids.
Max 10,000 responses per operation. Use dry_run=True to preview the count.

Authentication: no security requirement declared for this operation.

Request body: application/json (required)

Type: object

Schema: [DataService_BulkApproveRequest](/api-reference/schemas/dataservice-bulkapproverequest-f8cbfdfa6b.md)

- `survey_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string, uuid
  
    Type: null

- `status` (optional)
  Type: unknown
  
  anyOf:
    Type: array
    
    Items:
      Reference: [DataService_ResponseStatus](/api-reference/schemas/dataservice-responsestatus-e5ef0d2145.md); Type: string
      
      enum: ["draft","submitted","completed","invalidated","pending_approval","approved","rejected","terminated"]
  
    Type: null

- `start_date` (optional)
  Type: unknown
  
  anyOf:
    Type: string, date-time
  
    Type: null

- `end_date` (optional)
  Type: unknown
  
  anyOf:
    Type: string, date-time
  
    Type: null

- `response_ids` (optional)
  Type: unknown
  
  anyOf:
    Type: array
    
    Items:
      Type: string, uuid
  
    Type: null

- `dry_run` (optional)
  Type: boolean
  
  default: false

- `notes` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

Responses:

- 200: Successful Response

Content type: application/json

Type: object

Schema: [DataService_BulkOperationResponseDTO](/api-reference/schemas/dataservice-bulkoperationresponsedto-213250aa8e.md)

- `success_count` (optional)
  Type: integer
  
  default: 0

- `failure_count` (optional)
  Type: integer
  
  default: 0

- `skipped_count` (optional)
  Type: integer
  
  default: 0

- `errors` (optional)
  Type: array
  
  default: []
  
  Items:
    Type: object
    
    Additional properties: true

- `dry_run` (optional)
  Type: boolean
  
  default: false

- 422: Validation Error

Content type: application/json

Type: object

Schema: [DataService_HTTPValidationError](/api-reference/schemas/dataservice-httpvalidationerror-2b62d4c031.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [DataService_ValidationError](/api-reference/schemas/dataservice-validationerror-be7f37f547.md); Type: object

## Examples

### cURL

```bash
curl -X POST 'http://localhost:8002/api/v1/responses/bulk/approve' \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "survey_id": "550e8400-e29b-41d4-a716-446655440000",
  "status": [
    "draft"
  ],
  "start_date": "2024-01-15T09:30:00Z",
  "end_date": "2024-01-15T09:30:00Z",
  "response_ids": [
    "550e8400-e29b-41d4-a716-446655440000"
  ],
  "dry_run": false,
  "notes": "string"
}'
```

### JavaScript

```javascript
const body = `{
  "survey_id": "550e8400-e29b-41d4-a716-446655440000",
  "status": [
    "draft"
  ],
  "start_date": "2024-01-15T09:30:00Z",
  "end_date": "2024-01-15T09:30:00Z",
  "response_ids": [
    "550e8400-e29b-41d4-a716-446655440000"
  ],
  "dry_run": false,
  "notes": "string"
}`;

const response = await fetch('http://localhost:8002/api/v1/responses/bulk/approve', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
  },
  body,
});

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

### Python

```python
import requests

body = '''{
  "survey_id": "550e8400-e29b-41d4-a716-446655440000",
  "status": [
    "draft"
  ],
  "start_date": "2024-01-15T09:30:00Z",
  "end_date": "2024-01-15T09:30:00Z",
  "response_ids": [
    "550e8400-e29b-41d4-a716-446655440000"
  ],
  "dry_run": false,
  "notes": "string"
}'''

response = requests.post(
    'http://localhost:8002/api/v1/responses/bulk/approve',
    data=body.encode('utf-8'),
    headers={
        'Content-Type': 'application/json',
    },
)
print(response.text)
```


## Bulk Update Status Responses

`POST /api/v1/responses/bulk/update-status`

Bulk update status of survey responses.

Supports filtering by survey_id, status, date range, or specific response_ids.
Max 10,000 responses per operation. Use dry_run=True to preview the count.

Authentication: no security requirement declared for this operation.

Request body: application/json (required)

Type: object

Schema: [DataService_BulkUpdateStatusRequest](/api-reference/schemas/dataservice-bulkupdatestatusrequest-81e86f7c47.md)

- `survey_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string, uuid
  
    Type: null

- `status` (optional)
  Type: unknown
  
  anyOf:
    Type: array
    
    Items:
      Reference: [DataService_ResponseStatus](/api-reference/schemas/dataservice-responsestatus-e5ef0d2145.md); Type: string
      
      enum: ["draft","submitted","completed","invalidated","pending_approval","approved","rejected","terminated"]
  
    Type: null

- `start_date` (optional)
  Type: unknown
  
  anyOf:
    Type: string, date-time
  
    Type: null

- `end_date` (optional)
  Type: unknown
  
  anyOf:
    Type: string, date-time
  
    Type: null

- `response_ids` (optional)
  Type: unknown
  
  anyOf:
    Type: array
    
    Items:
      Type: string, uuid
  
    Type: null

- `dry_run` (optional)
  Type: boolean
  
  default: false

- `new_status` (required)
  Type: string

Responses:

- 200: Successful Response

Content type: application/json

Type: object

Schema: [DataService_BulkOperationResponseDTO](/api-reference/schemas/dataservice-bulkoperationresponsedto-213250aa8e.md)

- `success_count` (optional)
  Type: integer
  
  default: 0

- `failure_count` (optional)
  Type: integer
  
  default: 0

- `skipped_count` (optional)
  Type: integer
  
  default: 0

- `errors` (optional)
  Type: array
  
  default: []
  
  Items:
    Type: object
    
    Additional properties: true

- `dry_run` (optional)
  Type: boolean
  
  default: false

- 422: Validation Error

Content type: application/json

Type: object

Schema: [DataService_HTTPValidationError](/api-reference/schemas/dataservice-httpvalidationerror-2b62d4c031.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [DataService_ValidationError](/api-reference/schemas/dataservice-validationerror-be7f37f547.md); Type: object

## Examples

### cURL

```bash
curl -X POST 'http://localhost:8002/api/v1/responses/bulk/update-status' \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "survey_id": "550e8400-e29b-41d4-a716-446655440000",
  "status": [
    "draft"
  ],
  "start_date": "2024-01-15T09:30:00Z",
  "end_date": "2024-01-15T09:30:00Z",
  "response_ids": [
    "550e8400-e29b-41d4-a716-446655440000"
  ],
  "dry_run": false,
  "new_status": "string"
}'
```

### JavaScript

```javascript
const body = `{
  "survey_id": "550e8400-e29b-41d4-a716-446655440000",
  "status": [
    "draft"
  ],
  "start_date": "2024-01-15T09:30:00Z",
  "end_date": "2024-01-15T09:30:00Z",
  "response_ids": [
    "550e8400-e29b-41d4-a716-446655440000"
  ],
  "dry_run": false,
  "new_status": "string"
}`;

const response = await fetch('http://localhost:8002/api/v1/responses/bulk/update-status', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
  },
  body,
});

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

### Python

```python
import requests

body = '''{
  "survey_id": "550e8400-e29b-41d4-a716-446655440000",
  "status": [
    "draft"
  ],
  "start_date": "2024-01-15T09:30:00Z",
  "end_date": "2024-01-15T09:30:00Z",
  "response_ids": [
    "550e8400-e29b-41d4-a716-446655440000"
  ],
  "dry_run": false,
  "new_status": "string"
}'''

response = requests.post(
    'http://localhost:8002/api/v1/responses/bulk/update-status',
    data=body.encode('utf-8'),
    headers={
        'Content-Type': 'application/json',
    },
)
print(response.text)
```


## Search Similar

`POST /api/v1/responses/search-similar`

Find similar responses by survey_id + identifier fields

Authentication: no security requirement declared for this operation.

Request body: application/json

Type: unknown

anyOf:
  Reference: [DataService_SimilaritySearchRequest](/api-reference/schemas/dataservice-similaritysearchrequest-6164e6359c.md); Type: object

  Type: null

Responses:

- 200: Successful Response

Content type: application/json

Type: object

Schema: [DataService_SimilaritySearchResponse](/api-reference/schemas/dataservice-similaritysearchresponse-f509f4699d.md)

- `matches` (required)
  Type: array
  
  List of potential duplicates
  
  Items:
    Reference: [DataService_SimilarityMatch](/api-reference/schemas/dataservice-similaritymatch-1257ee54f6.md); Type: object

- `total` (required)
  Type: integer
  
  Total number of matches found

- 422: Validation Error

Content type: application/json

Type: object

Schema: [DataService_HTTPValidationError](/api-reference/schemas/dataservice-httpvalidationerror-2b62d4c031.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [DataService_ValidationError](/api-reference/schemas/dataservice-validationerror-be7f37f547.md); Type: object

## Examples

### cURL

```bash
curl -X POST 'http://localhost:8002/api/v1/responses/search-similar' \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "survey_id": "string",
  "respondent_id": "string",
  "respondent_fields": {},
  "gps_coordinates": {}
}'
```

### JavaScript

```javascript
const body = `{
  "survey_id": "string",
  "respondent_id": "string",
  "respondent_fields": {},
  "gps_coordinates": {}
}`;

const response = await fetch('http://localhost:8002/api/v1/responses/search-similar', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
  },
  body,
});

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

### Python

```python
import requests

body = '''{
  "survey_id": "string",
  "respondent_id": "string",
  "respondent_fields": {},
  "gps_coordinates": {}
}'''

response = requests.post(
    'http://localhost:8002/api/v1/responses/search-similar',
    data=body.encode('utf-8'),
    headers={
        'Content-Type': 'application/json',
    },
)
print(response.text)
```


## Get Duplicate Groups

`GET /api/v1/responses/duplicate-groups`

List all duplicate groups (paginated, filterable)

Authentication: no security requirement declared for this operation.

Parameters:

- `survey_id` (query, unknown, optional) - Filter by survey ID
  Type: unknown
  
  Filter by survey ID
  
  anyOf:
    Type: string, uuid
  
    Type: null

- `status` (query, unknown, optional) - Filter by status
  Type: unknown
  
  Filter by status
  
  anyOf:
    Type: string
  
    Type: null

- `skip` (query, integer, optional) - Number of items to skip
  Type: integer
  
  Number of items to skip
  
  default: 0
  
  minimum: 0

- `limit` (query, integer, optional) - Number of items per page
  Type: integer
  
  Number of items per page
  
  default: 20
  
  minimum: 1
  
  maximum: 100

Responses:

- 200: Successful Response

Content type: application/json

Type: object

Schema: [DataService_DuplicateGroupListDto](/api-reference/schemas/dataservice-duplicategrouplistdto-45925a02af.md)

- `items` (required)
  Type: array
  
  List of duplicate groups
  
  Items:
    Reference: [DataService_DuplicateGroupDto](/api-reference/schemas/dataservice-duplicategroupdto-569a80b84c.md); Type: object

- `total` (required)
  Type: integer
  
  Total number of duplicate groups

- `skip` (required)
  Type: integer
  
  Number of items skipped

- `limit` (required)
  Type: integer
  
  Number of items per page

- `has_next` (required)
  Type: boolean
  
  Whether there are more items

- `has_previous` (required)
  Type: boolean
  
  Whether there are previous items

- 422: Validation Error

Content type: application/json

Type: object

Schema: [DataService_HTTPValidationError](/api-reference/schemas/dataservice-httpvalidationerror-2b62d4c031.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [DataService_ValidationError](/api-reference/schemas/dataservice-validationerror-be7f37f547.md); Type: object

## Examples

### cURL

```bash
curl -X GET 'http://localhost:8002/api/v1/responses/duplicate-groups?skip=0&limit=20'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8002/api/v1/responses/duplicate-groups?skip=0&limit=20', {
  method: 'GET',
});

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

### Python

```python
import requests

response = requests.get('http://localhost:8002/api/v1/responses/duplicate-groups?skip=0&limit=20')
print(response.text)
```


## Merge

`POST /api/v1/responses/{response_id}/merge`

Merge response into another response

Authentication: no security requirement declared for this operation.

Parameters:

- `response_id` (path, string, uuid, required)
  Type: string, uuid

Request body: application/json (required)

Type: object

Schema: [DataService_MergeRequestDto](/api-reference/schemas/dataservice-mergerequestdto-552a15fd50.md)

- `target_response_id` (required)
  Type: string, uuid
  
  Response ID to merge into (primary)

- `merge_note` (optional)
  Type: unknown
  
  Note about the merge
  
  anyOf:
    Type: string
  
    Type: null

- `conflict_resolutions` (optional)
  Type: unknown
  
  Resolutions for conflicting fields (field name -> response ID to keep)
  
  anyOf:
    Type: object
    
    Additional properties: 
      Type: string
  
    Type: null

Responses:

- 200: Successful Response

Content type: application/json

Type: object

Schema: [DataService_MergeResponseDto](/api-reference/schemas/dataservice-mergeresponsedto-9a85c20cf5.md)

- `success` (required)
  Type: boolean
  
  Whether the merge was successful

- `primary_response_id` (required)
  Type: string, uuid
  
  Primary response ID after merge

- `merged_response_id` (required)
  Type: string, uuid
  
  Response ID that was merged

- `message` (required)
  Type: string
  
  Status message

- 422: Validation Error

Content type: application/json

Type: object

Schema: [DataService_HTTPValidationError](/api-reference/schemas/dataservice-httpvalidationerror-2b62d4c031.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [DataService_ValidationError](/api-reference/schemas/dataservice-validationerror-be7f37f547.md); Type: object

## Examples

### cURL

```bash
curl -X POST 'http://localhost:8002/api/v1/responses/550e8400-e29b-41d4-a716-446655440000/merge' \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "target_response_id": "550e8400-e29b-41d4-a716-446655440000",
  "merge_note": "string",
  "conflict_resolutions": {}
}'
```

### JavaScript

```javascript
const body = `{
  "target_response_id": "550e8400-e29b-41d4-a716-446655440000",
  "merge_note": "string",
  "conflict_resolutions": {}
}`;

const response = await fetch('http://localhost:8002/api/v1/responses/550e8400-e29b-41d4-a716-446655440000/merge', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
  },
  body,
});

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

### Python

```python
import requests

body = '''{
  "target_response_id": "550e8400-e29b-41d4-a716-446655440000",
  "merge_note": "string",
  "conflict_resolutions": {}
}'''

response = requests.post(
    'http://localhost:8002/api/v1/responses/550e8400-e29b-41d4-a716-446655440000/merge',
    data=body.encode('utf-8'),
    headers={
        'Content-Type': 'application/json',
    },
)
print(response.text)
```


## Update Group Status

`POST /api/v1/responses/duplicate-groups/{group_id}/status`

Update the status of a duplicate group

Authentication: no security requirement declared for this operation.

Parameters:

- `group_id` (path, string, uuid, required)
  Type: string, uuid

- `status` (query, string, required) - New status (flagged, merged, discarded, kept_both)
  Type: string
  
  New status (flagged, merged, discarded, kept_both)

Responses:

- 200: Successful Response

Content type: application/json

Type: object

Schema: [DataService_DuplicateGroupDto](/api-reference/schemas/dataservice-duplicategroupdto-569a80b84c.md)

- `id` (required)
  Type: string, uuid
  
  Duplicate group ID

- `primary_response_id` (required)
  Type: string, uuid
  
  Primary response ID

- `duplicate_response_id` (required)
  Type: string, uuid
  
  Duplicate response ID

- `survey_id` (required)
  Type: string, uuid
  
  Survey ID

- `confidence_score` (required)
  Type: number
  
  Confidence score

- `criteria_breakdown` (required)
  Type: object
  
  Breakdown of scores per criterion
  
  Additional properties: 
    Type: number

- `status` (required)
  Type: string
  
  Status of the duplicate group (flagged, merged, discarded, kept_both)

- `merged_by` (optional)
  Type: unknown
  
  User who performed the merge
  
  anyOf:
    Type: string, uuid
  
    Type: null

- `merged_at` (optional)
  Type: unknown
  
  When the merge was performed
  
  anyOf:
    Type: string, date-time
  
    Type: null

- `created_at` (required)
  Type: string, date-time
  
  When the duplicate was detected

- 422: Validation Error

Content type: application/json

Type: object

Schema: [DataService_HTTPValidationError](/api-reference/schemas/dataservice-httpvalidationerror-2b62d4c031.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [DataService_ValidationError](/api-reference/schemas/dataservice-validationerror-be7f37f547.md); Type: object

## Examples

### cURL

```bash
curl -X POST 'http://localhost:8002/api/v1/responses/duplicate-groups/550e8400-e29b-41d4-a716-446655440000/status?status=string'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8002/api/v1/responses/duplicate-groups/550e8400-e29b-41d4-a716-446655440000/status?status=string', {
  method: 'POST',
});

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

### Python

```python
import requests

response = requests.post('http://localhost:8002/api/v1/responses/duplicate-groups/550e8400-e29b-41d4-a716-446655440000/status?status=string')
print(response.text)
```


## List Responses

`GET /api/v1/responses`

List survey responses with filtering and pagination.

Supports filtering by:
- Survey ID
- Response status
- Respondent ID
- Date range
- Enumerator (submitted_by, enumerator_user_code)
- Device (device_id, sync_batch_id)

Authentication: no security requirement declared for this operation.

Parameters:

- `survey_id` (query, unknown, optional) - Filter by survey ID
  Type: unknown
  
  Filter by survey ID
  
  anyOf:
    Type: string, uuid
  
    Type: null

- `status` (query, unknown, optional) - Filter by status (draft, submitted, completed, invalidated)
  Type: unknown
  
  Filter by status (draft, submitted, completed, invalidated)
  
  anyOf:
    Type: string
  
    Type: null

- `respondent_id` (query, unknown, optional) - Filter by respondent ID
  Type: unknown
  
  Filter by respondent ID
  
  anyOf:
    Type: string
  
    Type: null

- `from_date` (query, unknown, optional) - Filter responses from date (ISO 8601)
  Type: unknown
  
  Filter responses from date (ISO 8601)
  
  anyOf:
    Type: string, date-time
  
    Type: null

- `to_date` (query, unknown, optional) - Filter responses to date (ISO 8601)
  Type: unknown
  
  Filter responses to date (ISO 8601)
  
  anyOf:
    Type: string, date-time
  
    Type: null

- `submitted_by` (query, unknown, optional) - Filter by enumerator user ID
  Type: unknown
  
  Filter by enumerator user ID
  
  anyOf:
    Type: string, uuid
  
    Type: null

- `enumerator_user_code` (query, unknown, optional) - Filter by enumerator user code
  Type: unknown
  
  Filter by enumerator user code
  
  anyOf:
    Type: string
  
    Type: null

- `device_id` (query, unknown, optional) - Filter by device ID
  Type: unknown
  
  Filter by device ID
  
  anyOf:
    Type: string
  
    Type: null

- `sync_batch_id` (query, unknown, optional) - Filter by sync batch ID
  Type: unknown
  
  Filter by sync batch ID
  
  anyOf:
    Type: string, uuid
  
    Type: null

- `limit` (query, integer, optional) - Number of results per page
  Type: integer
  
  Number of results per page
  
  default: 20
  
  minimum: 1
  
  maximum: 100

- `skip` (query, integer, optional) - Number of results to skip for pagination
  Type: integer
  
  Number of results to skip for pagination
  
  default: 0
  
  minimum: 0

- `sort_by` (query, string, optional) - Sort field
  Type: string
  
  Sort field
  
  default: "created_at"

- `sort_order` (query, string, optional) - Sort order (asc/desc)
  Type: string
  
  Sort order (asc/desc)
  
  default: "desc"

Responses:

- 200: Successful Response

Content type: application/json

Type: object

Schema: [DataService_ResponseListDTO](/api-reference/schemas/dataservice-responselistdto-2944fe7056.md)

- `items` (required)
  Type: array
  
  Items:
    Reference: [DataService_ResponseDTO](/api-reference/schemas/dataservice-responsedto-4965ff7816.md); Type: object

- `total` (required)
  Type: integer

- `skip` (required)
  Type: integer

- `limit` (required)
  Type: integer

- `has_next` (required)
  Type: boolean

- `has_previous` (required)
  Type: boolean

- 422: Validation Error

Content type: application/json

Type: object

Schema: [DataService_HTTPValidationError](/api-reference/schemas/dataservice-httpvalidationerror-2b62d4c031.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [DataService_ValidationError](/api-reference/schemas/dataservice-validationerror-be7f37f547.md); Type: object

## Examples

### cURL

```bash
curl -X GET 'http://localhost:8002/api/v1/responses?limit=20&skip=0&sort_by=created_at&sort_order=desc'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8002/api/v1/responses?limit=20&skip=0&sort_by=created_at&sort_order=desc', {
  method: 'GET',
});

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

### Python

```python
import requests

response = requests.get('http://localhost:8002/api/v1/responses?limit=20&skip=0&sort_by=created_at&sort_order=desc')
print(response.text)
```


## Submit Response

`POST /api/v1/responses`

Submit a survey response.

- Checks if user has form access
- Validates survey is published
- Validates response against survey schema
- Creates response and answers in transaction
- Returns response ID and status

Authentication: no security requirement declared for this operation.

Request body: application/json (required)

Type: object

Schema: [DataService_SubmitResponseDTO](/api-reference/schemas/dataservice-submitresponsedto-c283e9d365.md)

- `survey_id` (required)
  Type: string, uuid
  
  Survey ID

- `version_id` (optional)
  Type: unknown
  
  Survey version ID
  
  anyOf:
    Type: string, uuid
  
    Type: null

- `idempotency_key` (optional)
  Type: unknown
  
  Unique key for submission idempotency
  
  anyOf:
    Type: string
    
    maxLength: 255
  
    Type: null

- `respondent_id` (optional)
  Type: unknown
  
  Respondent identifier
  
  anyOf:
    Type: string
    
    maxLength: 255
  
    Type: null

- `answers` (required)
  Type: object
  
  Question ID to answer mapping
  
  Additional properties: true

- `metadata` (optional)
  Type: unknown
  
  Additional metadata (clients send this under the 'metadata' key)
  
  anyOf:
    Type: object
    
    Additional properties: true
  
    Type: null

- `ip_address` (optional)
  Type: unknown
  
  Client IP address
  
  anyOf:
    Type: string
    
    maxLength: 45
  
    Type: null

- `user_agent` (optional)
  Type: unknown
  
  Client user agent
  
  anyOf:
    Type: string
  
    Type: null

- `device_id` (optional)
  Type: unknown
  
  Device identifier (ODK Collect deviceID, CSPro device ID)
  
  anyOf:
    Type: string
    
    maxLength: 255
  
    Type: null

- `sync_batch_id` (optional)
  Type: unknown
  
  Batch ID for grouping offline sync submissions
  
  anyOf:
    Type: string, uuid
  
    Type: null

- `submission_mode` (optional)
  Type: unknown
  
  Domain-level intent: 'complete' or 'terminated_partial'
  
  default: "complete"
  
  anyOf:
    Type: string
  
    Type: null

- `duration_seconds` (optional)
  Type: unknown
  
  Active form filling duration in seconds, excluding paused time
  
  anyOf:
    Type: integer
    
    minimum: 0
    
    maximum: 2592000
  
    Type: null

- `interview_id` (optional)
  Type: unknown
  
  Interview execution ID — links this response to its interview lifecycle
  
  anyOf:
    Type: string, uuid
  
    Type: null

- `interview_rid` (optional)
  Type: unknown
  
  Response RID from interview (generated at interview creation, not at submission)
  
  anyOf:
    Type: string
    
    maxLength: 100
  
    Type: null

- `collected_at` (optional)
  Type: unknown
  
  Device-reported capture time (ISO-8601). Source of truth for the schedule window on offline submissions — a response collected on-device before close_at syncs even after the survey is auto-archived server-side.
  
  anyOf:
    Type: string, date-time
  
    Type: null

- `response_language` (optional)
  Type: unknown
  
  Language code used for this submission (e.g., 'en', 'es', 'fr')
  
  anyOf:
    Type: string
    
    maxLength: 10
  
    Type: null

- `is_reconciliation` (optional)
  Type: boolean
  
  Flag indicating this submission is a server-authorized reconciliation of work predating revocation (R22)
  
  default: false

- `reconciliation_grant_id` (optional)
  Type: unknown
  
  Historical form access grant ID authorizing this reconciliation
  
  anyOf:
    Type: string, uuid
  
    Type: null

Responses:

- 201: Successful Response

Content type: application/json

Type: object

Schema: [DataService_ResponseDTO](/api-reference/schemas/dataservice-responsedto-4965ff7816.md)

- `id` (required)
  Type: string

- `survey_id` (required)
  Type: string

- `tenant_id` (required)
  Type: string

- `version_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `idempotency_key` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `interview_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `respondent_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `rid` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `uid` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `status` (required)
  Type: string

- `answers` (required)
  Type: integer

- `completed_answers` (required)
  Type: integer

- `progress_percentage` (required)
  Type: integer

- `started_at` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `submitted_at` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `completed_at` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `duration_seconds` (optional)
  Type: unknown
  
  anyOf:
    Type: integer
  
    Type: null

- `ip_address` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `user_agent` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `metadata` (optional)
  Type: unknown
  
  anyOf:
    Type: object
    
    Additional properties: true
  
    Type: null

- `is_valid` (required)
  Type: boolean

- `submitted_by` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `enumerator_user_code` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `enumerator_email` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `enumerator_name` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `respondent_name` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `respondent_user_code` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `device_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `sync_batch_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `synced_at` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `approved_by` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `approved_at` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `approval_notes` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `rejected_by` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `rejected_at` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `rejection_reason` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `review_flags` (optional)
  Type: unknown
  
  anyOf:
    Type: object
    
    Additional properties: true
  
    Type: null

- `response_language` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `is_reconciled` (optional)
  Type: boolean
  
  default: false

- `reconciled_at` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `reconciliation_grant_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `created_at` (required)
  Type: string

- `updated_at` (required)
  Type: string

- 400: Validation error

Content type: application/json

Type: object

Schema: [DataService_ResponseValidationErrorDTO](/api-reference/schemas/dataservice-responsevalidationerrordto-bf8fbf8f8b.md)

- `error` (required)
  Type: string

- `validation_errors` (required)
  Type: array
  
  Items:
    Type: object
    
    Additional properties: true

- 403: Access denied

- 404: Survey not found

- 409: Duplicate response

- 422: Validation Error

Content type: application/json

Type: object

Schema: [DataService_HTTPValidationError](/api-reference/schemas/dataservice-httpvalidationerror-2b62d4c031.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [DataService_ValidationError](/api-reference/schemas/dataservice-validationerror-be7f37f547.md); Type: object

## Examples

### cURL

```bash
curl -X POST 'http://localhost:8002/api/v1/responses' \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "survey_id": "550e8400-e29b-41d4-a716-446655440000",
  "version_id": "550e8400-e29b-41d4-a716-446655440000",
  "idempotency_key": "string",
  "respondent_id": "string",
  "answers": {},
  "metadata": {},
  "ip_address": "string",
  "user_agent": "string",
  "device_id": "string",
  "sync_batch_id": "550e8400-e29b-41d4-a716-446655440000",
  "submission_mode": "complete",
  "duration_seconds": 0,
  "interview_id": "550e8400-e29b-41d4-a716-446655440000",
  "interview_rid": "string",
  "collected_at": "2024-01-15T09:30:00Z",
  "response_language": "string",
  "is_reconciliation": false,
  "reconciliation_grant_id": "550e8400-e29b-41d4-a716-446655440000"
}'
```

### JavaScript

```javascript
const body = `{
  "survey_id": "550e8400-e29b-41d4-a716-446655440000",
  "version_id": "550e8400-e29b-41d4-a716-446655440000",
  "idempotency_key": "string",
  "respondent_id": "string",
  "answers": {},
  "metadata": {},
  "ip_address": "string",
  "user_agent": "string",
  "device_id": "string",
  "sync_batch_id": "550e8400-e29b-41d4-a716-446655440000",
  "submission_mode": "complete",
  "duration_seconds": 0,
  "interview_id": "550e8400-e29b-41d4-a716-446655440000",
  "interview_rid": "string",
  "collected_at": "2024-01-15T09:30:00Z",
  "response_language": "string",
  "is_reconciliation": false,
  "reconciliation_grant_id": "550e8400-e29b-41d4-a716-446655440000"
}`;

const response = await fetch('http://localhost:8002/api/v1/responses', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
  },
  body,
});

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

### Python

```python
import requests

body = '''{
  "survey_id": "550e8400-e29b-41d4-a716-446655440000",
  "version_id": "550e8400-e29b-41d4-a716-446655440000",
  "idempotency_key": "string",
  "respondent_id": "string",
  "answers": {},
  "metadata": {},
  "ip_address": "string",
  "user_agent": "string",
  "device_id": "string",
  "sync_batch_id": "550e8400-e29b-41d4-a716-446655440000",
  "submission_mode": "complete",
  "duration_seconds": 0,
  "interview_id": "550e8400-e29b-41d4-a716-446655440000",
  "interview_rid": "string",
  "collected_at": "2024-01-15T09:30:00Z",
  "response_language": "string",
  "is_reconciliation": false,
  "reconciliation_grant_id": "550e8400-e29b-41d4-a716-446655440000"
}'''

response = requests.post(
    'http://localhost:8002/api/v1/responses',
    data=body.encode('utf-8'),
    headers={
        'Content-Type': 'application/json',
    },
)
print(response.text)
```


## Get RID sequential counter

`GET /api/v1/responses/response-counters`

Get the current sequential RID counter for a user + survey. Returns 0 when no RID has been generated yet. Clients increment the returned value locally to build the next RID.

Authentication: no security requirement declared for this operation.

Parameters:

- `survey_id` (query, string, uuid, required) - Survey ID
  Type: string, uuid
  
  Survey ID

- `user_code` (query, string, required) - Enumerator user code (6 chars)
  Type: string
  
  Enumerator user code (6 chars)

Responses:

- 200: Successful Response

Content type: application/json

Type: unknown

- 422: Validation Error

Content type: application/json

Type: object

Schema: [DataService_HTTPValidationError](/api-reference/schemas/dataservice-httpvalidationerror-2b62d4c031.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [DataService_ValidationError](/api-reference/schemas/dataservice-validationerror-be7f37f547.md); Type: object

## Examples

### cURL

```bash
curl -X GET 'http://localhost:8002/api/v1/responses/response-counters?survey_id=550e8400-e29b-41d4-a716-446655440000&user_code=string'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8002/api/v1/responses/response-counters?survey_id=550e8400-e29b-41d4-a716-446655440000&user_code=string', {
  method: 'GET',
});

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

### Python

```python
import requests

response = requests.get('http://localhost:8002/api/v1/responses/response-counters?survey_id=550e8400-e29b-41d4-a716-446655440000&user_code=string')
print(response.text)
```


## Get latest response by respondent ID

`GET /api/v1/responses/by-respondent-id/{survey_id}`

Get the latest submitted/completed response for a respondent in a survey.

Authentication: no security requirement declared for this operation.

Parameters:

- `survey_id` (path, string, uuid, required)
  Type: string, uuid

- `respondent_id` (query, string, required) - Respondent identifier
  Type: string
  
  Respondent identifier

Responses:

- 200: Successful Response

Content type: application/json

Type: object

Schema: [DataService_ResponseDetailDTO](/api-reference/schemas/dataservice-responsedetaildto-a1480d5392.md)

- `id` (required)
  Type: string

- `survey_id` (required)
  Type: string

- `tenant_id` (required)
  Type: string

- `version_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `idempotency_key` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `interview_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `respondent_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `rid` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `uid` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `status` (required)
  Type: string

- `answers` (required)
  Type: integer

- `completed_answers` (required)
  Type: integer

- `progress_percentage` (required)
  Type: integer

- `started_at` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `submitted_at` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `completed_at` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `duration_seconds` (optional)
  Type: unknown
  
  anyOf:
    Type: integer
  
    Type: null

- `ip_address` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `user_agent` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `metadata` (optional)
  Type: unknown
  
  anyOf:
    Type: object
    
    Additional properties: true
  
    Type: null

- `is_valid` (required)
  Type: boolean

- `submitted_by` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `enumerator_user_code` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `enumerator_email` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `enumerator_name` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `respondent_name` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `respondent_user_code` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `device_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `sync_batch_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `synced_at` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `approved_by` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `approved_at` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `approval_notes` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `rejected_by` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `rejected_at` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `rejection_reason` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `review_flags` (optional)
  Type: unknown
  
  anyOf:
    Type: object
    
    Additional properties: true
  
    Type: null

- `response_language` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `is_reconciled` (optional)
  Type: boolean
  
  default: false

- `reconciled_at` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `reconciliation_grant_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `created_at` (required)
  Type: string

- `updated_at` (required)
  Type: string

- `answers_list` (optional)
  Type: array
  
  default: []
  
  Items:
    Reference: [DataService_EnrichedAnswerDTO](/api-reference/schemas/dataservice-enrichedanswerdto-26018a4e78.md); Type: object

- 422: Validation Error

Content type: application/json

Type: object

Schema: [DataService_HTTPValidationError](/api-reference/schemas/dataservice-httpvalidationerror-2b62d4c031.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [DataService_ValidationError](/api-reference/schemas/dataservice-validationerror-be7f37f547.md); Type: object

## Examples

### cURL

```bash
curl -X GET 'http://localhost:8002/api/v1/responses/by-respondent-id/550e8400-e29b-41d4-a716-446655440000?respondent_id=string'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8002/api/v1/responses/by-respondent-id/550e8400-e29b-41d4-a716-446655440000?respondent_id=string', {
  method: 'GET',
});

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

### Python

```python
import requests

response = requests.get('http://localhost:8002/api/v1/responses/by-respondent-id/550e8400-e29b-41d4-a716-446655440000?respondent_id=string')
print(response.text)
```


## Get response by unique ID

`GET /api/v1/responses/by-unique-id/{survey_id}`

Get a response matching the unique_id (uid) value for a survey.

Authentication: no security requirement declared for this operation.

Parameters:

- `survey_id` (path, string, uuid, required)
  Type: string, uuid

- `unique_id` (query, string, required) - Unique identifier value from uid column
  Type: string
  
  Unique identifier value from uid column

Responses:

- 200: Successful Response

Content type: application/json

Type: object

Schema: [DataService_ResponseDetailDTO](/api-reference/schemas/dataservice-responsedetaildto-a1480d5392.md)

- `id` (required)
  Type: string

- `survey_id` (required)
  Type: string

- `tenant_id` (required)
  Type: string

- `version_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `idempotency_key` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `interview_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `respondent_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `rid` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `uid` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `status` (required)
  Type: string

- `answers` (required)
  Type: integer

- `completed_answers` (required)
  Type: integer

- `progress_percentage` (required)
  Type: integer

- `started_at` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `submitted_at` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `completed_at` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `duration_seconds` (optional)
  Type: unknown
  
  anyOf:
    Type: integer
  
    Type: null

- `ip_address` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `user_agent` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `metadata` (optional)
  Type: unknown
  
  anyOf:
    Type: object
    
    Additional properties: true
  
    Type: null

- `is_valid` (required)
  Type: boolean

- `submitted_by` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `enumerator_user_code` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `enumerator_email` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `enumerator_name` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `respondent_name` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `respondent_user_code` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `device_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `sync_batch_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `synced_at` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `approved_by` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `approved_at` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `approval_notes` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `rejected_by` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `rejected_at` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `rejection_reason` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `review_flags` (optional)
  Type: unknown
  
  anyOf:
    Type: object
    
    Additional properties: true
  
    Type: null

- `response_language` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `is_reconciled` (optional)
  Type: boolean
  
  default: false

- `reconciled_at` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `reconciliation_grant_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `created_at` (required)
  Type: string

- `updated_at` (required)
  Type: string

- `answers_list` (optional)
  Type: array
  
  default: []
  
  Items:
    Reference: [DataService_EnrichedAnswerDTO](/api-reference/schemas/dataservice-enrichedanswerdto-26018a4e78.md); Type: object

- 422: Validation Error

Content type: application/json

Type: object

Schema: [DataService_HTTPValidationError](/api-reference/schemas/dataservice-httpvalidationerror-2b62d4c031.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [DataService_ValidationError](/api-reference/schemas/dataservice-validationerror-be7f37f547.md); Type: object

## Examples

### cURL

```bash
curl -X GET 'http://localhost:8002/api/v1/responses/by-unique-id/550e8400-e29b-41d4-a716-446655440000?unique_id=string'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8002/api/v1/responses/by-unique-id/550e8400-e29b-41d4-a716-446655440000?unique_id=string', {
  method: 'GET',
});

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

### Python

```python
import requests

response = requests.get('http://localhost:8002/api/v1/responses/by-unique-id/550e8400-e29b-41d4-a716-446655440000?unique_id=string')
print(response.text)
```


## Get enumerator statistics for a survey

`GET /api/v1/responses/enumerator-stats`

Get per-enumerator submission counts, rejection rates, and quality metrics.

Authentication: no security requirement declared for this operation.

Parameters:

- `survey_id` (query, string, uuid, required) - Survey ID to get stats for
  Type: string, uuid
  
  Survey ID to get stats for

- `user_id` (query, unknown, optional) - Filter by specific enumerator
  Type: unknown
  
  Filter by specific enumerator
  
  anyOf:
    Type: string, uuid
  
    Type: null

- `limit` (query, integer, optional)
  Type: integer
  
  default: 20
  
  minimum: 1
  
  maximum: 100

- `offset` (query, integer, optional)
  Type: integer
  
  default: 0
  
  minimum: 0

Responses:

- 200: Successful Response

Content type: application/json

Type: object

Schema: [DataService_EnumeratorStatsListDTO](/api-reference/schemas/dataservice-enumeratorstatslistdto-6246a16b16.md)

- `items` (required)
  Type: array
  
  Items:
    Reference: [DataService_EnumeratorStatsDTO](/api-reference/schemas/dataservice-enumeratorstatsdto-770c9262e3.md); Type: object

- `total` (required)
  Type: integer

- `skip` (required)
  Type: integer

- `limit` (required)
  Type: integer

- 422: Validation Error

Content type: application/json

Type: object

Schema: [DataService_HTTPValidationError](/api-reference/schemas/dataservice-httpvalidationerror-2b62d4c031.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [DataService_ValidationError](/api-reference/schemas/dataservice-validationerror-be7f37f547.md); Type: object

## Examples

### cURL

```bash
curl -X GET 'http://localhost:8002/api/v1/responses/enumerator-stats?survey_id=550e8400-e29b-41d4-a716-446655440000&limit=20&offset=0'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8002/api/v1/responses/enumerator-stats?survey_id=550e8400-e29b-41d4-a716-446655440000&limit=20&offset=0', {
  method: 'GET',
});

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

### Python

```python
import requests

response = requests.get('http://localhost:8002/api/v1/responses/enumerator-stats?survey_id=550e8400-e29b-41d4-a716-446655440000&limit=20&offset=0')
print(response.text)
```


## List Response Changes

`GET /api/v1/responses/changes`

Durable, resumable feed of this enumerator's own response changes (E1b).

Scope is fixed to the caller's tenant **and** the caller as the *original
submitting user* (``submitted_by == current_user.id``). It deliberately does
NOT use ``resolve_response_scope`` and has no ``full:access`` bypass: even a
platform admin only ever sees changes for responses they personally
submitted.

Changes are logged transactionally by a DB trigger; the cursor is an
``xid8`` watermark with a snapshot horizon so pages never overlap and never
skip an in-flight transaction. No answer values are returned.

Authentication: no security requirement declared for this operation.

Parameters:

- `since` (query, string, optional) - Watermark (transaction id, decimal text) from a previous page
  Type: string
  
  Watermark (transaction id, decimal text) from a previous page
  
  default: "0"

- `limit` (query, integer, optional) - Maximum number of changes per page
  Type: integer
  
  Maximum number of changes per page
  
  default: 100
  
  minimum: 1
  
  maximum: 1000

Responses:

- 200: Successful Response

Content type: application/json

Type: object

Schema: [DataService_ResponseChangeFeedDTO](/api-reference/schemas/dataservice-responsechangefeeddto-027825417d.md)

- `items` (required)
  Type: array
  
  Items:
    Reference: [DataService_ResponseChangeDTO](/api-reference/schemas/dataservice-responsechangedto-8743e04bc7.md); Type: object
    
    A single response change. Deliberately carries no answer values.

- `next_watermark` (required)
  Type: string

- `has_more` (required)
  Type: boolean

- 422: Validation Error

Content type: application/json

Type: object

Schema: [DataService_HTTPValidationError](/api-reference/schemas/dataservice-httpvalidationerror-2b62d4c031.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [DataService_ValidationError](/api-reference/schemas/dataservice-validationerror-be7f37f547.md); Type: object

## Examples

### cURL

```bash
curl -X GET 'http://localhost:8002/api/v1/responses/changes?since=0&limit=100'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8002/api/v1/responses/changes?since=0&limit=100', {
  method: 'GET',
});

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

### Python

```python
import requests

response = requests.get('http://localhost:8002/api/v1/responses/changes?since=0&limit=100')
print(response.text)
```


## Get Response

`GET /api/v1/responses/{response_id}`

Get a single response by ID with optional answer details.

Authentication: no security requirement declared for this operation.

Parameters:

- `response_id` (path, string, uuid, required)
  Type: string, uuid

- `include_answers` (query, boolean, optional) - Include answer details
  Type: boolean
  
  Include answer details
  
  default: true

Responses:

- 200: Successful Response

Content type: application/json

Type: object

Schema: [DataService_ResponseDetailDTO](/api-reference/schemas/dataservice-responsedetaildto-a1480d5392.md)

- `id` (required)
  Type: string

- `survey_id` (required)
  Type: string

- `tenant_id` (required)
  Type: string

- `version_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `idempotency_key` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `interview_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `respondent_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `rid` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `uid` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `status` (required)
  Type: string

- `answers` (required)
  Type: integer

- `completed_answers` (required)
  Type: integer

- `progress_percentage` (required)
  Type: integer

- `started_at` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `submitted_at` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `completed_at` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `duration_seconds` (optional)
  Type: unknown
  
  anyOf:
    Type: integer
  
    Type: null

- `ip_address` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `user_agent` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `metadata` (optional)
  Type: unknown
  
  anyOf:
    Type: object
    
    Additional properties: true
  
    Type: null

- `is_valid` (required)
  Type: boolean

- `submitted_by` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `enumerator_user_code` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `enumerator_email` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `enumerator_name` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `respondent_name` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `respondent_user_code` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `device_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `sync_batch_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `synced_at` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `approved_by` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `approved_at` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `approval_notes` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `rejected_by` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `rejected_at` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `rejection_reason` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `review_flags` (optional)
  Type: unknown
  
  anyOf:
    Type: object
    
    Additional properties: true
  
    Type: null

- `response_language` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `is_reconciled` (optional)
  Type: boolean
  
  default: false

- `reconciled_at` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `reconciliation_grant_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `created_at` (required)
  Type: string

- `updated_at` (required)
  Type: string

- `answers_list` (optional)
  Type: array
  
  default: []
  
  Items:
    Reference: [DataService_EnrichedAnswerDTO](/api-reference/schemas/dataservice-enrichedanswerdto-26018a4e78.md); Type: object

- 422: Validation Error

Content type: application/json

Type: object

Schema: [DataService_HTTPValidationError](/api-reference/schemas/dataservice-httpvalidationerror-2b62d4c031.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [DataService_ValidationError](/api-reference/schemas/dataservice-validationerror-be7f37f547.md); Type: object

## Examples

### cURL

```bash
curl -X GET 'http://localhost:8002/api/v1/responses/550e8400-e29b-41d4-a716-446655440000?include_answers=true'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8002/api/v1/responses/550e8400-e29b-41d4-a716-446655440000?include_answers=true', {
  method: 'GET',
});

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

### Python

```python
import requests

response = requests.get('http://localhost:8002/api/v1/responses/550e8400-e29b-41d4-a716-446655440000?include_answers=true')
print(response.text)
```


## Update Response

`PUT /api/v1/responses/{response_id}`

Update response metadata (only allowed for draft/submitted responses).

Cannot modify completed or invalidated responses.

Authentication: no security requirement declared for this operation.

Parameters:

- `response_id` (path, string, uuid, required)
  Type: string, uuid

Request body: application/json (required)

Type: object

Schema: [DataService_UpdateResponseDTO](/api-reference/schemas/dataservice-updateresponsedto-e633777d14.md)

- `respondent_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string
    
    maxLength: 255
  
    Type: null

- `metadata` (optional)
  Type: unknown
  
  Additional metadata (clients send this under the 'metadata' key)
  
  anyOf:
    Type: object
    
    Additional properties: true
  
    Type: null

- `status` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

Responses:

- 200: Successful Response

Content type: application/json

Type: object

Schema: [DataService_ResponseDTO](/api-reference/schemas/dataservice-responsedto-4965ff7816.md)

- `id` (required)
  Type: string

- `survey_id` (required)
  Type: string

- `tenant_id` (required)
  Type: string

- `version_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `idempotency_key` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `interview_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `respondent_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `rid` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `uid` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `status` (required)
  Type: string

- `answers` (required)
  Type: integer

- `completed_answers` (required)
  Type: integer

- `progress_percentage` (required)
  Type: integer

- `started_at` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `submitted_at` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `completed_at` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `duration_seconds` (optional)
  Type: unknown
  
  anyOf:
    Type: integer
  
    Type: null

- `ip_address` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `user_agent` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `metadata` (optional)
  Type: unknown
  
  anyOf:
    Type: object
    
    Additional properties: true
  
    Type: null

- `is_valid` (required)
  Type: boolean

- `submitted_by` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `enumerator_user_code` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `enumerator_email` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `enumerator_name` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `respondent_name` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `respondent_user_code` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `device_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `sync_batch_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `synced_at` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `approved_by` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `approved_at` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `approval_notes` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `rejected_by` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `rejected_at` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `rejection_reason` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `review_flags` (optional)
  Type: unknown
  
  anyOf:
    Type: object
    
    Additional properties: true
  
    Type: null

- `response_language` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `is_reconciled` (optional)
  Type: boolean
  
  default: false

- `reconciled_at` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `reconciliation_grant_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `created_at` (required)
  Type: string

- `updated_at` (required)
  Type: string

- 422: Validation Error

Content type: application/json

Type: object

Schema: [DataService_HTTPValidationError](/api-reference/schemas/dataservice-httpvalidationerror-2b62d4c031.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [DataService_ValidationError](/api-reference/schemas/dataservice-validationerror-be7f37f547.md); Type: object

## Examples

### cURL

```bash
curl -X PUT 'http://localhost:8002/api/v1/responses/550e8400-e29b-41d4-a716-446655440000' \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "respondent_id": "string",
  "metadata": {},
  "status": "string"
}'
```

### JavaScript

```javascript
const body = `{
  "respondent_id": "string",
  "metadata": {},
  "status": "string"
}`;

const response = await fetch('http://localhost:8002/api/v1/responses/550e8400-e29b-41d4-a716-446655440000', {
  method: 'PUT',
  headers: {
    'Content-Type': 'application/json',
  },
  body,
});

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

### Python

```python
import requests

body = '''{
  "respondent_id": "string",
  "metadata": {},
  "status": "string"
}'''

response = requests.put(
    'http://localhost:8002/api/v1/responses/550e8400-e29b-41d4-a716-446655440000',
    data=body.encode('utf-8'),
    headers={
        'Content-Type': 'application/json',
    },
)
print(response.text)
```


## Delete Response

`DELETE /api/v1/responses/{response_id}`

Delete a response and all its answers.

Authentication: no security requirement declared for this operation.

Parameters:

- `response_id` (path, string, uuid, required)
  Type: string, uuid

Responses:

- 204: Successful Response

- 422: Validation Error

Content type: application/json

Type: object

Schema: [DataService_HTTPValidationError](/api-reference/schemas/dataservice-httpvalidationerror-2b62d4c031.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [DataService_ValidationError](/api-reference/schemas/dataservice-validationerror-be7f37f547.md); Type: object

## Examples

### cURL

```bash
curl -X DELETE 'http://localhost:8002/api/v1/responses/550e8400-e29b-41d4-a716-446655440000'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8002/api/v1/responses/550e8400-e29b-41d4-a716-446655440000', {
  method: 'DELETE',
});

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

### Python

```python
import requests

response = requests.delete('http://localhost:8002/api/v1/responses/550e8400-e29b-41d4-a716-446655440000')
print(response.text)
```


## Invalidate Response

`POST /api/v1/responses/{response_id}/invalidate`

Mark a response as invalidated with optional error messages.

Authentication: no security requirement declared for this operation.

Parameters:

- `response_id` (path, string, uuid, required)
  Type: string, uuid

Request body: application/json

Type: unknown

anyOf:
  Type: array
  
  Items:
    Type: string

  Type: null

Responses:

- 200: Successful Response

Content type: application/json

Type: object

Schema: [DataService_ResponseDTO](/api-reference/schemas/dataservice-responsedto-4965ff7816.md)

- `id` (required)
  Type: string

- `survey_id` (required)
  Type: string

- `tenant_id` (required)
  Type: string

- `version_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `idempotency_key` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `interview_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `respondent_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `rid` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `uid` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `status` (required)
  Type: string

- `answers` (required)
  Type: integer

- `completed_answers` (required)
  Type: integer

- `progress_percentage` (required)
  Type: integer

- `started_at` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `submitted_at` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `completed_at` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `duration_seconds` (optional)
  Type: unknown
  
  anyOf:
    Type: integer
  
    Type: null

- `ip_address` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `user_agent` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `metadata` (optional)
  Type: unknown
  
  anyOf:
    Type: object
    
    Additional properties: true
  
    Type: null

- `is_valid` (required)
  Type: boolean

- `submitted_by` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `enumerator_user_code` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `enumerator_email` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `enumerator_name` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `respondent_name` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `respondent_user_code` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `device_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `sync_batch_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `synced_at` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `approved_by` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `approved_at` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `approval_notes` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `rejected_by` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `rejected_at` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `rejection_reason` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `review_flags` (optional)
  Type: unknown
  
  anyOf:
    Type: object
    
    Additional properties: true
  
    Type: null

- `response_language` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `is_reconciled` (optional)
  Type: boolean
  
  default: false

- `reconciled_at` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `reconciliation_grant_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `created_at` (required)
  Type: string

- `updated_at` (required)
  Type: string

- 422: Validation Error

Content type: application/json

Type: object

Schema: [DataService_HTTPValidationError](/api-reference/schemas/dataservice-httpvalidationerror-2b62d4c031.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [DataService_ValidationError](/api-reference/schemas/dataservice-validationerror-be7f37f547.md); Type: object

## Examples

### cURL

```bash
curl -X POST 'http://localhost:8002/api/v1/responses/550e8400-e29b-41d4-a716-446655440000/invalidate' \
  -H 'Content-Type: application/json' \
  --data-raw '[
  "string"
]'
```

### JavaScript

```javascript
const body = `[
  "string"
]`;

const response = await fetch('http://localhost:8002/api/v1/responses/550e8400-e29b-41d4-a716-446655440000/invalidate', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
  },
  body,
});

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

### Python

```python
import requests

body = '''[
  "string"
]'''

response = requests.post(
    'http://localhost:8002/api/v1/responses/550e8400-e29b-41d4-a716-446655440000/invalidate',
    data=body.encode('utf-8'),
    headers={
        'Content-Type': 'application/json',
    },
)
print(response.text)
```


## Edit Response

`PATCH /api/v1/responses/{response_id}/edit`

Edit a submitted/completed response. Maintains full audit trail.

- Blocked for DRAFT responses (use PUT instead)
- Blocked for INVALIDATED responses
- Validates new answers against survey schema
- Saves previous answers to edit history
- Publishes response.edited event

Authentication: no security requirement declared for this operation.

Parameters:

- `response_id` (path, string, uuid, required)
  Type: string, uuid

Request body: application/json (required)

Type: object

Schema: [DataService_ResponseEditRequest](/api-reference/schemas/dataservice-responseeditrequest-37984377ec.md)

- `answers` (required)
  Type: object
  
  Question ID to answer mapping
  
  Additional properties: true

- `reason` (optional)
  Type: unknown
  
  Reason for edit
  
  anyOf:
    Type: string
    
    maxLength: 500
  
    Type: null

Responses:

- 200: Successful Response

Content type: application/json

Type: object

Schema: [DataService_ResponseEditResponse](/api-reference/schemas/dataservice-responseeditresponse-d2dbe15ff5.md)

- `success` (required)
  Type: boolean

- `edit_id` (required)
  Type: string, uuid

- `response` (required)
  Reference: [DataService_ResponseDetailDTO](/api-reference/schemas/dataservice-responsedetaildto-a1480d5392.md); Type: object

- `changes_count` (required)
  Type: integer

- 422: Validation Error

Content type: application/json

Type: object

Schema: [DataService_HTTPValidationError](/api-reference/schemas/dataservice-httpvalidationerror-2b62d4c031.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [DataService_ValidationError](/api-reference/schemas/dataservice-validationerror-be7f37f547.md); Type: object

## Examples

### cURL

```bash
curl -X PATCH 'http://localhost:8002/api/v1/responses/550e8400-e29b-41d4-a716-446655440000/edit' \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "answers": {},
  "reason": "string"
}'
```

### JavaScript

```javascript
const body = `{
  "answers": {},
  "reason": "string"
}`;

const response = await fetch('http://localhost:8002/api/v1/responses/550e8400-e29b-41d4-a716-446655440000/edit', {
  method: 'PATCH',
  headers: {
    'Content-Type': 'application/json',
  },
  body,
});

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

### Python

```python
import requests

body = '''{
  "answers": {},
  "reason": "string"
}'''

response = requests.patch(
    'http://localhost:8002/api/v1/responses/550e8400-e29b-41d4-a716-446655440000/edit',
    data=body.encode('utf-8'),
    headers={
        'Content-Type': 'application/json',
    },
)
print(response.text)
```


## Get Response Edits

`GET /api/v1/responses/{response_id}/edits`

Get edit history for a specific response.

Authentication: no security requirement declared for this operation.

Parameters:

- `response_id` (path, string, uuid, required)
  Type: string, uuid

Responses:

- 200: Successful Response

Content type: application/json

Type: object

Schema: [DataService_ResponseEditHistoryListDTO](/api-reference/schemas/dataservice-responseedithistorylistdto-aea661769a.md)

- `items` (required)
  Type: array
  
  Items:
    Reference: [DataService_ResponseEditHistoryDTO](/api-reference/schemas/dataservice-responseedithistorydto-bc9831bff8.md); Type: object

- `total` (required)
  Type: integer

- 422: Validation Error

Content type: application/json

Type: object

Schema: [DataService_HTTPValidationError](/api-reference/schemas/dataservice-httpvalidationerror-2b62d4c031.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [DataService_ValidationError](/api-reference/schemas/dataservice-validationerror-be7f37f547.md); Type: object

## Examples

### cURL

```bash
curl -X GET 'http://localhost:8002/api/v1/responses/550e8400-e29b-41d4-a716-446655440000/edits'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8002/api/v1/responses/550e8400-e29b-41d4-a716-446655440000/edits', {
  method: 'GET',
});

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

### Python

```python
import requests

response = requests.get('http://localhost:8002/api/v1/responses/550e8400-e29b-41d4-a716-446655440000/edits')
print(response.text)
```


## Submit Response For Approval

`POST /api/v1/responses/{response_id}/submit-for-approval`

Submit a response for approval.

Transitions: SUBMITTED or REJECTED → PENDING_APPROVAL
Permission: RESPONSE_READ_AND_WRITE_ONLY

Authentication: no security requirement declared for this operation.

Parameters:

- `response_id` (path, string, uuid, required)
  Type: string, uuid

Responses:

- 200: Successful Response

Content type: application/json

Type: object

Schema: [DataService_ApprovalActionResponse](/api-reference/schemas/dataservice-approvalactionresponse-fc3f5095f9.md)

- `success` (required)
  Type: boolean

- `message` (required)
  Type: string

- `response` (required)
  Reference: [DataService_ResponseDTO](/api-reference/schemas/dataservice-responsedto-4965ff7816.md); Type: object

- 422: Validation Error

Content type: application/json

Type: object

Schema: [DataService_HTTPValidationError](/api-reference/schemas/dataservice-httpvalidationerror-2b62d4c031.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [DataService_ValidationError](/api-reference/schemas/dataservice-validationerror-be7f37f547.md); Type: object

## Examples

### cURL

```bash
curl -X POST 'http://localhost:8002/api/v1/responses/550e8400-e29b-41d4-a716-446655440000/submit-for-approval'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8002/api/v1/responses/550e8400-e29b-41d4-a716-446655440000/submit-for-approval', {
  method: 'POST',
});

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

### Python

```python
import requests

response = requests.post('http://localhost:8002/api/v1/responses/550e8400-e29b-41d4-a716-446655440000/submit-for-approval')
print(response.text)
```


## Approve Response

`POST /api/v1/responses/{response_id}/approve`

Approve a response that is pending approval.

Transitions: PENDING_APPROVAL → APPROVED
Permission: RESPONSE_APPROVE

Sends approval notification to the respondent.

Authentication: no security requirement declared for this operation.

Parameters:

- `response_id` (path, string, uuid, required)
  Type: string, uuid

Request body: application/json (required)

Type: object

Schema: [DataService_ResponseApprovalRequest](/api-reference/schemas/dataservice-responseapprovalrequest-79fb6037db.md)

- `notes` (optional)
  Type: unknown
  
  Optional approval notes
  
  anyOf:
    Type: string
  
    Type: null

Responses:

- 200: Successful Response

Content type: application/json

Type: object

Schema: [DataService_ApprovalActionResponse](/api-reference/schemas/dataservice-approvalactionresponse-fc3f5095f9.md)

- `success` (required)
  Type: boolean

- `message` (required)
  Type: string

- `response` (required)
  Reference: [DataService_ResponseDTO](/api-reference/schemas/dataservice-responsedto-4965ff7816.md); Type: object

- 422: Validation Error

Content type: application/json

Type: object

Schema: [DataService_HTTPValidationError](/api-reference/schemas/dataservice-httpvalidationerror-2b62d4c031.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [DataService_ValidationError](/api-reference/schemas/dataservice-validationerror-be7f37f547.md); Type: object

## Examples

### cURL

```bash
curl -X POST 'http://localhost:8002/api/v1/responses/550e8400-e29b-41d4-a716-446655440000/approve' \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "notes": "string"
}'
```

### JavaScript

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

const response = await fetch('http://localhost:8002/api/v1/responses/550e8400-e29b-41d4-a716-446655440000/approve', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
  },
  body,
});

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

### Python

```python
import requests

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

response = requests.post(
    'http://localhost:8002/api/v1/responses/550e8400-e29b-41d4-a716-446655440000/approve',
    data=body.encode('utf-8'),
    headers={
        'Content-Type': 'application/json',
    },
)
print(response.text)
```


## Reject Response

`POST /api/v1/responses/{response_id}/reject`

Reject a response that is pending approval.

Transitions: PENDING_APPROVAL → REJECTED
Permission: RESPONSE_APPROVE

Requires a reason for rejection.
Sends rejection notification with reason to the respondent.

Authentication: no security requirement declared for this operation.

Parameters:

- `response_id` (path, string, uuid, required)
  Type: string, uuid

Request body: application/json (required)

Type: object

Schema: [DataService_ResponseRejectionRequest](/api-reference/schemas/dataservice-responserejectionrequest-10039c1db0.md)

- `reason` (required)
  Type: string
  
  Required rejection reason
  
  minLength: 1

- `flags` (required)
  Type: object
  
  Required review flags to persist atomically with the rejection. At least one flag must have checked=true. There is no fallback to previously stored flags.
  
  Additional properties: 
    Reference: [DataService_ReviewFlag](/api-reference/schemas/dataservice-reviewflag-00bddaec6b.md); Type: object

Responses:

- 200: Successful Response

Content type: application/json

Type: object

Schema: [DataService_ApprovalActionResponse](/api-reference/schemas/dataservice-approvalactionresponse-fc3f5095f9.md)

- `success` (required)
  Type: boolean

- `message` (required)
  Type: string

- `response` (required)
  Reference: [DataService_ResponseDTO](/api-reference/schemas/dataservice-responsedto-4965ff7816.md); Type: object

- 422: Validation Error

Content type: application/json

Type: object

Schema: [DataService_HTTPValidationError](/api-reference/schemas/dataservice-httpvalidationerror-2b62d4c031.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [DataService_ValidationError](/api-reference/schemas/dataservice-validationerror-be7f37f547.md); Type: object

## Examples

### cURL

```bash
curl -X POST 'http://localhost:8002/api/v1/responses/550e8400-e29b-41d4-a716-446655440000/reject' \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "reason": "string",
  "flags": {}
}'
```

### JavaScript

```javascript
const body = `{
  "reason": "string",
  "flags": {}
}`;

const response = await fetch('http://localhost:8002/api/v1/responses/550e8400-e29b-41d4-a716-446655440000/reject', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
  },
  body,
});

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

### Python

```python
import requests

body = '''{
  "reason": "string",
  "flags": {}
}'''

response = requests.post(
    'http://localhost:8002/api/v1/responses/550e8400-e29b-41d4-a716-446655440000/reject',
    data=body.encode('utf-8'),
    headers={
        'Content-Type': 'application/json',
    },
)
print(response.text)
```


## Correct Response

`POST /api/v1/responses/{response_id}/correct`

Correct a rejected response and resubmit it for approval (E1a).

Correction actor is the ORIGINAL submitting enumerator only, enforced by an
unconditional ``submitted_by == current_user.id`` check that is independent
of (and cannot be bypassed by) permissions such as ``full:access``.

Only supervisor-flagged (``checked: true``) questions may be changed; all
other answers are preserved. The whole flow runs in one transaction:
ownership → Idempotency-Key requirement → advisory lock → replay lookup →
status → flagged validation → schema validation → answer apply → edit
history → status transition (REJECTED → PENDING_APPROVAL) → durable
idempotency record. No webhook/outbox events are published in this phase.

Authentication: no security requirement declared for this operation.

Parameters:

- `response_id` (path, string, uuid, required)
  Type: string, uuid

Request body: application/json (required)

Type: object

Enumerator correction of a rejected response.

``answers`` must contain only questions the supervisor flagged as checked.
Supplying answers for unflagged questions is rejected with 422. Questions
omitted here are left unchanged.

Schema: [DataService_ResponseCorrectionRequest](/api-reference/schemas/dataservice-responsecorrectionrequest-cf62c1af2f.md)

- `answers` (required)
  Type: object
  
  Corrected answers for flagged questions only
  
  Additional properties: true

- `reason` (optional)
  Type: unknown
  
  Reason for correction
  
  anyOf:
    Type: string
    
    maxLength: 500
  
    Type: null

Responses:

- 200: Successful Response

Content type: application/json

Type: object

Schema: [DataService_ResponseCorrectionResponse](/api-reference/schemas/dataservice-responsecorrectionresponse-c28bcbc076.md)

- `success` (optional)
  Type: boolean
  
  default: true

- `replayed` (optional)
  Type: boolean
  
  default: false

- `response_id` (required)
  Type: string, uuid

- `status` (required)
  Type: string

- `edit_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string, uuid
  
    Type: null

- `edit_count` (required)
  Type: integer

- `changed_questions` (required)
  Type: array
  
  Items:
    Type: string

- `updated_at` (optional)
  Type: unknown
  
  anyOf:
    Type: string, date-time
  
    Type: null

- 422: Validation Error

Content type: application/json

Type: object

Schema: [DataService_HTTPValidationError](/api-reference/schemas/dataservice-httpvalidationerror-2b62d4c031.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [DataService_ValidationError](/api-reference/schemas/dataservice-validationerror-be7f37f547.md); Type: object

## Examples

### cURL

```bash
curl -X POST 'http://localhost:8002/api/v1/responses/550e8400-e29b-41d4-a716-446655440000/correct' \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "answers": {},
  "reason": "string"
}'
```

### JavaScript

```javascript
const body = `{
  "answers": {},
  "reason": "string"
}`;

const response = await fetch('http://localhost:8002/api/v1/responses/550e8400-e29b-41d4-a716-446655440000/correct', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
  },
  body,
});

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

### Python

```python
import requests

body = '''{
  "answers": {},
  "reason": "string"
}'''

response = requests.post(
    'http://localhost:8002/api/v1/responses/550e8400-e29b-41d4-a716-446655440000/correct',
    data=body.encode('utf-8'),
    headers={
        'Content-Type': 'application/json',
    },
)
print(response.text)
```


## Complete Response

`POST /api/v1/responses/{response_id}/complete`

Mark a response as completed.

Transitions: DRAFT, SUBMITTED, or APPROVED → COMPLETED
Permission: RESPONSE_READ_AND_WRITE_ONLY

Authentication: no security requirement declared for this operation.

Parameters:

- `response_id` (path, string, uuid, required)
  Type: string, uuid

Responses:

- 200: Successful Response

Content type: application/json

Type: object

Schema: [DataService_ApprovalActionResponse](/api-reference/schemas/dataservice-approvalactionresponse-fc3f5095f9.md)

- `success` (required)
  Type: boolean

- `message` (required)
  Type: string

- `response` (required)
  Reference: [DataService_ResponseDTO](/api-reference/schemas/dataservice-responsedto-4965ff7816.md); Type: object

- 422: Validation Error

Content type: application/json

Type: object

Schema: [DataService_HTTPValidationError](/api-reference/schemas/dataservice-httpvalidationerror-2b62d4c031.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [DataService_ValidationError](/api-reference/schemas/dataservice-validationerror-be7f37f547.md); Type: object

## Examples

### cURL

```bash
curl -X POST 'http://localhost:8002/api/v1/responses/550e8400-e29b-41d4-a716-446655440000/complete'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8002/api/v1/responses/550e8400-e29b-41d4-a716-446655440000/complete', {
  method: 'POST',
});

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

### Python

```python
import requests

response = requests.post('http://localhost:8002/api/v1/responses/550e8400-e29b-41d4-a716-446655440000/complete')
print(response.text)
```


## Get Pending Approval Count

`GET /api/v1/responses/pending-approval/count`

Get count of responses pending approval for a given survey.

Permission: RESPONSE_APPROVE

Authentication: no security requirement declared for this operation.

Parameters:

- `survey_id` (query, string, uuid, required) - Survey ID
  Type: string, uuid
  
  Survey ID

Responses:

- 200: Successful Response

Content type: application/json

Type: object

Schema: [DataService_PendingApprovalCountDTO](/api-reference/schemas/dataservice-pendingapprovalcountdto-c52d4fc3f3.md)

- `survey_id` (required)
  Type: string, uuid

- `count` (required)
  Type: integer

- 422: Validation Error

Content type: application/json

Type: object

Schema: [DataService_HTTPValidationError](/api-reference/schemas/dataservice-httpvalidationerror-2b62d4c031.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [DataService_ValidationError](/api-reference/schemas/dataservice-validationerror-be7f37f547.md); Type: object

## Examples

### cURL

```bash
curl -X GET 'http://localhost:8002/api/v1/responses/pending-approval/count?survey_id=550e8400-e29b-41d4-a716-446655440000'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8002/api/v1/responses/pending-approval/count?survey_id=550e8400-e29b-41d4-a716-446655440000', {
  method: 'GET',
});

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

### Python

```python
import requests

response = requests.get('http://localhost:8002/api/v1/responses/pending-approval/count?survey_id=550e8400-e29b-41d4-a716-446655440000')
print(response.text)
```


## Update Review Flags

`PUT /api/v1/responses/{response_id}/review-flags`

Update review flags for a response pending approval.

Allows the reviewer to flag individual questions that need modification
and add review notes. These flags are visible to the respondent when
the response is rejected.

Authentication: no security requirement declared for this operation.

Parameters:

- `response_id` (path, string, uuid, required)
  Type: string, uuid

Request body: application/json (required)

Type: object

Schema: [DataService_UpdateReviewFlagsRequest](/api-reference/schemas/dataservice-updatereviewflagsrequest-58d53f9cf3.md)

- `flags` (optional)
  Type: object
  
  Question ID to review flag mapping
  
  Additional properties: 
    Reference: [DataService_ReviewFlag](/api-reference/schemas/dataservice-reviewflag-00bddaec6b.md); Type: object

Responses:

- 200: Successful Response

Content type: application/json

Type: object

Schema: [DataService_ResponseDTO](/api-reference/schemas/dataservice-responsedto-4965ff7816.md)

- `id` (required)
  Type: string

- `survey_id` (required)
  Type: string

- `tenant_id` (required)
  Type: string

- `version_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `idempotency_key` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `interview_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `respondent_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `rid` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `uid` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `status` (required)
  Type: string

- `answers` (required)
  Type: integer

- `completed_answers` (required)
  Type: integer

- `progress_percentage` (required)
  Type: integer

- `started_at` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `submitted_at` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `completed_at` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `duration_seconds` (optional)
  Type: unknown
  
  anyOf:
    Type: integer
  
    Type: null

- `ip_address` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `user_agent` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `metadata` (optional)
  Type: unknown
  
  anyOf:
    Type: object
    
    Additional properties: true
  
    Type: null

- `is_valid` (required)
  Type: boolean

- `submitted_by` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `enumerator_user_code` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `enumerator_email` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `enumerator_name` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `respondent_name` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `respondent_user_code` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `device_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `sync_batch_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `synced_at` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `approved_by` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `approved_at` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `approval_notes` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `rejected_by` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `rejected_at` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `rejection_reason` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `review_flags` (optional)
  Type: unknown
  
  anyOf:
    Type: object
    
    Additional properties: true
  
    Type: null

- `response_language` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `is_reconciled` (optional)
  Type: boolean
  
  default: false

- `reconciled_at` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `reconciliation_grant_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `created_at` (required)
  Type: string

- `updated_at` (required)
  Type: string

- 422: Validation Error

Content type: application/json

Type: object

Schema: [DataService_HTTPValidationError](/api-reference/schemas/dataservice-httpvalidationerror-2b62d4c031.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [DataService_ValidationError](/api-reference/schemas/dataservice-validationerror-be7f37f547.md); Type: object

## Examples

### cURL

```bash
curl -X PUT 'http://localhost:8002/api/v1/responses/550e8400-e29b-41d4-a716-446655440000/review-flags' \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "flags": {}
}'
```

### JavaScript

```javascript
const body = `{
  "flags": {}
}`;

const response = await fetch('http://localhost:8002/api/v1/responses/550e8400-e29b-41d4-a716-446655440000/review-flags', {
  method: 'PUT',
  headers: {
    'Content-Type': 'application/json',
  },
  body,
});

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

### Python

```python
import requests

body = '''{
  "flags": {}
}'''

response = requests.put(
    'http://localhost:8002/api/v1/responses/550e8400-e29b-41d4-a716-446655440000/review-flags',
    data=body.encode('utf-8'),
    headers={
        'Content-Type': 'application/json',
    },
)
print(response.text)
```


## Get response statistics for a survey (internal)

`GET /api/v1/responses/survey-stats/{survey_id}`

Return response counts grouped by status for a given survey.
Used internally by survey-service for publish guardrails.
Requires X-Tenant-ID header for multi-tenant routing.

Authentication: no security requirement declared for this operation.

Parameters:

- `survey_id` (path, string, uuid, required)
  Type: string, uuid

Responses:

- 200: Successful Response

Content type: application/json

Type: unknown

- 422: Validation Error

Content type: application/json

Type: object

Schema: [DataService_HTTPValidationError](/api-reference/schemas/dataservice-httpvalidationerror-2b62d4c031.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [DataService_ValidationError](/api-reference/schemas/dataservice-validationerror-be7f37f547.md); Type: object

## Examples

### cURL

```bash
curl -X GET 'http://localhost:8002/api/v1/responses/survey-stats/550e8400-e29b-41d4-a716-446655440000'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8002/api/v1/responses/survey-stats/550e8400-e29b-41d4-a716-446655440000', {
  method: 'GET',
});

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

### Python

```python
import requests

response = requests.get('http://localhost:8002/api/v1/responses/survey-stats/550e8400-e29b-41d4-a716-446655440000')
print(response.text)
```


## Validate a list of response IDs (removes orphans)

`POST /api/v1/responses/{survey_id}/validate-ids`

Takes a list of response UUIDs and returns only those that exist
and belong to the current survey/tenant. Used to identify orphaned
media attachments.

Authentication: no security requirement declared for this operation.

Parameters:

- `survey_id` (path, string, uuid, required)
  Type: string, uuid

Request body: application/json (required)

Type: object

Schema: [DataService_ValidateIdsRequest](/api-reference/schemas/dataservice-validateidsrequest-e80f9a9107.md)

- `response_ids` (required)
  Type: array
  
  maxItems: 1000
  
  Items:
    Type: string, uuid

Responses:

- 200: Successful Response

Content type: application/json

Type: object

Schema: [DataService_ValidateIdsResponse](/api-reference/schemas/dataservice-validateidsresponse-6025aa50ee.md)

- `valid_ids` (required)
  Type: array
  
  Items:
    Type: string, uuid

- 422: Validation Error

Content type: application/json

Type: object

Schema: [DataService_HTTPValidationError](/api-reference/schemas/dataservice-httpvalidationerror-2b62d4c031.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [DataService_ValidationError](/api-reference/schemas/dataservice-validationerror-be7f37f547.md); Type: object

## Examples

### cURL

```bash
curl -X POST 'http://localhost:8002/api/v1/responses/550e8400-e29b-41d4-a716-446655440000/validate-ids' \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "response_ids": [
    "550e8400-e29b-41d4-a716-446655440000"
  ]
}'
```

### JavaScript

```javascript
const body = `{
  "response_ids": [
    "550e8400-e29b-41d4-a716-446655440000"
  ]
}`;

const response = await fetch('http://localhost:8002/api/v1/responses/550e8400-e29b-41d4-a716-446655440000/validate-ids', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
  },
  body,
});

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

### Python

```python
import requests

body = '''{
  "response_ids": [
    "550e8400-e29b-41d4-a716-446655440000"
  ]
}'''

response = requests.post(
    'http://localhost:8002/api/v1/responses/550e8400-e29b-41d4-a716-446655440000/validate-ids',
    data=body.encode('utf-8'),
    headers={
        'Content-Type': 'application/json',
    },
)
print(response.text)
```


## Export Responses

`POST /api/v1/export/responses`

Export survey responses in CSV, Excel, or JSON format.
Returns a streaming response with the exported data.

Authentication: no security requirement declared for this operation.

Request body: application/json (required)

Type: object

Schema: [DataService_ExportRequestDTO](/api-reference/schemas/dataservice-exportrequestdto-6e960894dd.md)

- `survey_id` (required)
  Type: string, uuid
  
  Survey ID to export

- `format` (optional)
  Type: string
  
  Export format: csv, xlsx, json, dta, sav
  
  default: "csv"

- `status` (optional)
  Type: unknown
  
  Filter by response status
  
  anyOf:
    Type: string
  
    Type: null

- `from_date` (optional)
  Type: unknown
  
  Filter from date
  
  anyOf:
    Type: string, date-time
  
    Type: null

- `to_date` (optional)
  Type: unknown
  
  Filter to date
  
  anyOf:
    Type: string, date-time
  
    Type: null

- `respondent_id` (optional)
  Type: unknown
  
  Filter by respondent
  
  anyOf:
    Type: string
  
    Type: null

- `include_metadata` (optional)
  Type: boolean
  
  Include response metadata
  
  default: true

- `include_answers` (optional)
  Type: boolean
  
  Include answer data
  
  default: true

- `version_id` (optional)
  Type: unknown
  
  Survey version ID for schema labels (uses latest if not set)
  
  anyOf:
    Type: string
  
    Type: null

- `language` (optional)
  Type: unknown
  
  Language code for translated labels (e.g., 'es', 'fr')
  
  anyOf:
    Type: string
  
    Type: null

Responses:

- 200: Successful Response

- 422: Validation Error

Content type: application/json

Type: object

Schema: [DataService_HTTPValidationError](/api-reference/schemas/dataservice-httpvalidationerror-2b62d4c031.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [DataService_ValidationError](/api-reference/schemas/dataservice-validationerror-be7f37f547.md); Type: object

## Examples

### cURL

```bash
curl -X POST 'http://localhost:8002/api/v1/export/responses' \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "survey_id": "550e8400-e29b-41d4-a716-446655440000",
  "format": "csv",
  "status": "string",
  "from_date": "2024-01-15T09:30:00Z",
  "to_date": "2024-01-15T09:30:00Z",
  "respondent_id": "string",
  "include_metadata": true,
  "include_answers": true,
  "version_id": "string",
  "language": "string"
}'
```

### JavaScript

```javascript
const body = `{
  "survey_id": "550e8400-e29b-41d4-a716-446655440000",
  "format": "csv",
  "status": "string",
  "from_date": "2024-01-15T09:30:00Z",
  "to_date": "2024-01-15T09:30:00Z",
  "respondent_id": "string",
  "include_metadata": true,
  "include_answers": true,
  "version_id": "string",
  "language": "string"
}`;

const response = await fetch('http://localhost:8002/api/v1/export/responses', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
  },
  body,
});

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

### Python

```python
import requests

body = '''{
  "survey_id": "550e8400-e29b-41d4-a716-446655440000",
  "format": "csv",
  "status": "string",
  "from_date": "2024-01-15T09:30:00Z",
  "to_date": "2024-01-15T09:30:00Z",
  "respondent_id": "string",
  "include_metadata": true,
  "include_answers": true,
  "version_id": "string",
  "language": "string"
}'''

response = requests.post(
    'http://localhost:8002/api/v1/export/responses',
    data=body.encode('utf-8'),
    headers={
        'Content-Type': 'application/json',
    },
)
print(response.text)
```


## Export Responses Stream

`GET /api/v1/export/responses/stream`

Stream export responses (GET version for simple downloads).

Authentication: no security requirement declared for this operation.

Parameters:

- `survey_id` (query, string, uuid, required) - Survey ID
  Type: string, uuid
  
  Survey ID

- `format` (query, string, optional) - Export format
  Type: string
  
  Export format
  
  default: "csv"

- `status` (query, unknown, optional) - Filter by status
  Type: unknown
  
  Filter by status
  
  anyOf:
    Type: string
  
    Type: null

- `from_date` (query, unknown, optional) - From date
  Type: unknown
  
  From date
  
  anyOf:
    Type: string, date-time
  
    Type: null

- `to_date` (query, unknown, optional) - To date
  Type: unknown
  
  To date
  
  anyOf:
    Type: string, date-time
  
    Type: null

- `include_metadata` (query, boolean, optional)
  Type: boolean
  
  default: true

- `include_answers` (query, boolean, optional)
  Type: boolean
  
  default: true

- `language` (query, unknown, optional) - Language code for translated labels
  Type: unknown
  
  Language code for translated labels
  
  anyOf:
    Type: string
  
    Type: null

Responses:

- 200: Successful Response

Content type: application/json

Type: unknown

- 422: Validation Error

Content type: application/json

Type: object

Schema: [DataService_HTTPValidationError](/api-reference/schemas/dataservice-httpvalidationerror-2b62d4c031.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [DataService_ValidationError](/api-reference/schemas/dataservice-validationerror-be7f37f547.md); Type: object

## Examples

### cURL

```bash
curl -X GET 'http://localhost:8002/api/v1/export/responses/stream?survey_id=550e8400-e29b-41d4-a716-446655440000&format=csv&include_metadata=true&include_answers=true'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8002/api/v1/export/responses/stream?survey_id=550e8400-e29b-41d4-a716-446655440000&format=csv&include_metadata=true&include_answers=true', {
  method: 'GET',
});

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

### Python

```python
import requests

response = requests.get('http://localhost:8002/api/v1/export/responses/stream?survey_id=550e8400-e29b-41d4-a716-446655440000&format=csv&include_metadata=true&include_answers=true')
print(response.text)
```


## Get Media Export Status

`GET /api/v1/export/media/{request_id}/status`

Poll the status of a background media export job.

Authentication: no security requirement declared for this operation.

Parameters:

- `request_id` (path, string, required)
  Type: string

Responses:

- 200: Successful Response

Content type: application/json

Type: object

Schema: [DataService_MediaExportStatusDTO](/api-reference/schemas/dataservice-mediaexportstatusdto-010ab9ea35.md)

- `request_id` (required)
  Type: string

- `task_status` (required)
  Type: string

- `result` (optional)
  Type: unknown
  
  anyOf:
    Type: object
    
    Additional properties: true
  
    Type: null

- `error` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- 422: Validation Error

Content type: application/json

Type: object

Schema: [DataService_HTTPValidationError](/api-reference/schemas/dataservice-httpvalidationerror-2b62d4c031.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [DataService_ValidationError](/api-reference/schemas/dataservice-validationerror-be7f37f547.md); Type: object

## Examples

### cURL

```bash
curl -X GET 'http://localhost:8002/api/v1/export/media/string/status'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8002/api/v1/export/media/string/status', {
  method: 'GET',
});

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

### Python

```python
import requests

response = requests.get('http://localhost:8002/api/v1/export/media/string/status')
print(response.text)
```


## Export Survey Csv

`GET /api/v1/export/survey/{survey_id}/csv`

Quick CSV export for a survey.

Authentication: no security requirement declared for this operation.

Parameters:

- `survey_id` (path, string, uuid, required)
  Type: string, uuid

- `status` (query, unknown, optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `language` (query, unknown, optional) - Language code for translated labels
  Type: unknown
  
  Language code for translated labels
  
  anyOf:
    Type: string
  
    Type: null

Responses:

- 200: Successful Response

Content type: application/json

Type: unknown

- 422: Validation Error

Content type: application/json

Type: object

Schema: [DataService_HTTPValidationError](/api-reference/schemas/dataservice-httpvalidationerror-2b62d4c031.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [DataService_ValidationError](/api-reference/schemas/dataservice-validationerror-be7f37f547.md); Type: object

## Examples

### cURL

```bash
curl -X GET 'http://localhost:8002/api/v1/export/survey/550e8400-e29b-41d4-a716-446655440000/csv'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8002/api/v1/export/survey/550e8400-e29b-41d4-a716-446655440000/csv', {
  method: 'GET',
});

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

### Python

```python
import requests

response = requests.get('http://localhost:8002/api/v1/export/survey/550e8400-e29b-41d4-a716-446655440000/csv')
print(response.text)
```


## Export Survey Json

`GET /api/v1/export/survey/{survey_id}/json`

Quick JSON export for a survey.

Authentication: no security requirement declared for this operation.

Parameters:

- `survey_id` (path, string, uuid, required)
  Type: string, uuid

- `status` (query, unknown, optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `language` (query, unknown, optional) - Language code for translated labels
  Type: unknown
  
  Language code for translated labels
  
  anyOf:
    Type: string
  
    Type: null

Responses:

- 200: Successful Response

Content type: application/json

Type: unknown

- 422: Validation Error

Content type: application/json

Type: object

Schema: [DataService_HTTPValidationError](/api-reference/schemas/dataservice-httpvalidationerror-2b62d4c031.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [DataService_ValidationError](/api-reference/schemas/dataservice-validationerror-be7f37f547.md); Type: object

## Examples

### cURL

```bash
curl -X GET 'http://localhost:8002/api/v1/export/survey/550e8400-e29b-41d4-a716-446655440000/json'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8002/api/v1/export/survey/550e8400-e29b-41d4-a716-446655440000/json', {
  method: 'GET',
});

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

### Python

```python
import requests

response = requests.get('http://localhost:8002/api/v1/export/survey/550e8400-e29b-41d4-a716-446655440000/json')
print(response.text)
```


## Export Survey Xlsx

`GET /api/v1/export/survey/{survey_id}/xlsx`

Quick Excel export for a survey.

Authentication: no security requirement declared for this operation.

Parameters:

- `survey_id` (path, string, uuid, required)
  Type: string, uuid

- `status` (query, unknown, optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `language` (query, unknown, optional) - Language code for translated labels
  Type: unknown
  
  Language code for translated labels
  
  anyOf:
    Type: string
  
    Type: null

Responses:

- 200: Successful Response

Content type: application/json

Type: unknown

- 422: Validation Error

Content type: application/json

Type: object

Schema: [DataService_HTTPValidationError](/api-reference/schemas/dataservice-httpvalidationerror-2b62d4c031.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [DataService_ValidationError](/api-reference/schemas/dataservice-validationerror-be7f37f547.md); Type: object

## Examples

### cURL

```bash
curl -X GET 'http://localhost:8002/api/v1/export/survey/550e8400-e29b-41d4-a716-446655440000/xlsx'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8002/api/v1/export/survey/550e8400-e29b-41d4-a716-446655440000/xlsx', {
  method: 'GET',
});

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

### Python

```python
import requests

response = requests.get('http://localhost:8002/api/v1/export/survey/550e8400-e29b-41d4-a716-446655440000/xlsx')
print(response.text)
```


## Export Survey Stata

`GET /api/v1/export/survey/{survey_id}/dta`

Quick STATA export for a survey.

Authentication: no security requirement declared for this operation.

Parameters:

- `survey_id` (path, string, uuid, required)
  Type: string, uuid

- `status` (query, unknown, optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `language` (query, unknown, optional) - Language code for translated labels
  Type: unknown
  
  Language code for translated labels
  
  anyOf:
    Type: string
  
    Type: null

Responses:

- 200: Successful Response

Content type: application/json

Type: unknown

- 422: Validation Error

Content type: application/json

Type: object

Schema: [DataService_HTTPValidationError](/api-reference/schemas/dataservice-httpvalidationerror-2b62d4c031.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [DataService_ValidationError](/api-reference/schemas/dataservice-validationerror-be7f37f547.md); Type: object

## Examples

### cURL

```bash
curl -X GET 'http://localhost:8002/api/v1/export/survey/550e8400-e29b-41d4-a716-446655440000/dta'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8002/api/v1/export/survey/550e8400-e29b-41d4-a716-446655440000/dta', {
  method: 'GET',
});

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

### Python

```python
import requests

response = requests.get('http://localhost:8002/api/v1/export/survey/550e8400-e29b-41d4-a716-446655440000/dta')
print(response.text)
```


## Export Survey Spss

`GET /api/v1/export/survey/{survey_id}/sav`

Quick SPSS export for a survey.

Authentication: no security requirement declared for this operation.

Parameters:

- `survey_id` (path, string, uuid, required)
  Type: string, uuid

- `status` (query, unknown, optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `language` (query, unknown, optional) - Language code for translated labels
  Type: unknown
  
  Language code for translated labels
  
  anyOf:
    Type: string
  
    Type: null

Responses:

- 200: Successful Response

Content type: application/json

Type: unknown

- 422: Validation Error

Content type: application/json

Type: object

Schema: [DataService_HTTPValidationError](/api-reference/schemas/dataservice-httpvalidationerror-2b62d4c031.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [DataService_ValidationError](/api-reference/schemas/dataservice-validationerror-be7f37f547.md); Type: object

## Examples

### cURL

```bash
curl -X GET 'http://localhost:8002/api/v1/export/survey/550e8400-e29b-41d4-a716-446655440000/sav'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8002/api/v1/export/survey/550e8400-e29b-41d4-a716-446655440000/sav', {
  method: 'GET',
});

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

### Python

```python
import requests

response = requests.get('http://localhost:8002/api/v1/export/survey/550e8400-e29b-41d4-a716-446655440000/sav')
print(response.text)
```


## List Attachments

`GET /api/v1/attachments`

List attachments with filtering.

Authentication: no security requirement declared for this operation.

Parameters:

- `entity_type` (query, unknown, optional) - Filter by entity type
  Type: unknown
  
  Filter by entity type
  
  anyOf:
    Type: string
  
    Type: null

- `entity_id` (query, unknown, optional) - Filter by entity ID
  Type: unknown
  
  Filter by entity ID
  
  anyOf:
    Type: string, uuid
  
    Type: null

- `file_type` (query, unknown, optional) - Filter by file type (image, audio, video, document)
  Type: unknown
  
  Filter by file type (image, audio, video, document)
  
  anyOf:
    Type: string
  
    Type: null

- `field_name` (query, unknown, optional) - Filter by question field name
  Type: unknown
  
  Filter by question field name
  
  anyOf:
    Type: string
  
    Type: null

- `limit` (query, integer, optional)
  Type: integer
  
  default: 20
  
  minimum: 1
  
  maximum: 100

- `offset` (query, integer, optional)
  Type: integer
  
  default: 0
  
  minimum: 0

Responses:

- 200: Successful Response

Content type: application/json

Type: object

Schema: [DataService_AttachmentListDTO](/api-reference/schemas/dataservice-attachmentlistdto-1d811c8982.md)

- `attachments` (required)
  Type: array
  
  Items:
    Reference: [DataService_AttachmentResponseDTO](/api-reference/schemas/dataservice-attachmentresponsedto-d97d998c70.md); Type: object

- `total` (required)
  Type: integer

- `page` (required)
  Type: integer

- `limit` (required)
  Type: integer

- 422: Validation Error

Content type: application/json

Type: object

Schema: [DataService_HTTPValidationError](/api-reference/schemas/dataservice-httpvalidationerror-2b62d4c031.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [DataService_ValidationError](/api-reference/schemas/dataservice-validationerror-be7f37f547.md); Type: object

## Examples

### cURL

```bash
curl -X GET 'http://localhost:8002/api/v1/attachments?limit=20&offset=0'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8002/api/v1/attachments?limit=20&offset=0', {
  method: 'GET',
});

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

### Python

```python
import requests

response = requests.get('http://localhost:8002/api/v1/attachments?limit=20&offset=0')
print(response.text)
```


## Upload Attachment

`POST /api/v1/attachments`

Upload a file attachment.

Supported file types:
- Images (jpg, png, gif)
- Audio (mp3, wav, ogg)
- Video (mp4, avi, mov)
- Documents (pdf, doc, docx, xls, xlsx)

Max file size: 50MB

Authentication: no security requirement declared for this operation.

Request body: multipart/form-data (required)

Type: object

Schema: [DataService_Body_upload_attachment_api_v1_attachments__post](/api-reference/schemas/dataservice-body-upload-attachment-api-v1-attachments-post-26b3416a69.md)

- `entity_type` (required)
  Type: string
  
  Entity type (response, survey, etc.)

- `entity_id` (required)
  Type: string, uuid
  
  Entity ID

- `description` (optional)
  Type: unknown
  
  Description
  
  anyOf:
    Type: string
  
    Type: null

- `file` (required)
  Type: string
  
  File to upload

Responses:

- 201: Successful Response

Content type: application/json

Type: object

Schema: [DataService_AttachmentResponseDTO](/api-reference/schemas/dataservice-attachmentresponsedto-d97d998c70.md)

- `id` (required)
  Type: string

- `entity_type` (required)
  Type: string

- `entity_id` (required)
  Type: string

- `filename` (required)
  Type: string

- `original_filename` (required)
  Type: string

- `file_type` (required)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `mime_type` (required)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `file_size` (required)
  Type: integer

- `description` (required)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `uploaded_by` (required)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `checksum` (required)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `is_public` (required)
  Type: boolean

- `field_name` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `captured_at` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `status` (required)
  Type: string

- `created_at` (required)
  Type: string

- `download_url` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- 422: Validation Error

Content type: application/json

Type: object

Schema: [DataService_HTTPValidationError](/api-reference/schemas/dataservice-httpvalidationerror-2b62d4c031.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [DataService_ValidationError](/api-reference/schemas/dataservice-validationerror-be7f37f547.md); Type: object

## Examples

### cURL

```bash
curl -X POST 'http://localhost:8002/api/v1/attachments' \
  --form-string 'entity_type=string' \
  --form-string 'entity_id=550e8400-e29b-41d4-a716-446655440000' \
  --form-string 'description=string' \
  --form-string 'file=string'
```

### JavaScript

```javascript
const form = new FormData();
form.append('entity_type', 'string');
form.append('entity_id', '550e8400-e29b-41d4-a716-446655440000');
form.append('description', 'string');
form.append('file', 'string');
const response = await fetch('http://localhost:8002/api/v1/attachments', {
  method: 'POST',
  headers: {},
  body: form,
});
console.log(await response.text());
```

### Python

```python
import requests
from contextlib import ExitStack

with ExitStack() as stack:
    files = [
        ('entity_type', (None, 'string')),
        ('entity_id', (None, '550e8400-e29b-41d4-a716-446655440000')),
        ('description', (None, 'string')),
        ('file', (None, 'string')),
    ]
    response = requests.request('POST', 'http://localhost:8002/api/v1/attachments', headers={}, files=files)
    print(response.text)
```


## Create Attachment Record

`POST /api/v1/attachments/record`

Create an attachment record from provided metadata (file already uploaded via media-service).

This is used by the interview/attachment flow where the file is uploaded separately
through media-service, and the data-service only stores the metadata record.

Authentication: no security requirement declared for this operation.

Request body: application/json (required)

Type: object

Schema: [DataService_AttachmentRecordDTO](/api-reference/schemas/dataservice-attachmentrecorddto-a8c558619c.md)

- `entity_type` (required)
  Type: string
  
  Type of entity (e.g., 'interview', 'response')

- `entity_id` (required)
  Type: string, uuid
  
  ID of the associated entity

- `field_name` (optional)
  Type: unknown
  
  Question field name
  
  anyOf:
    Type: string
  
    Type: null

- `filename` (required)
  Type: string
  
  Stored filename

- `original_filename` (required)
  Type: string
  
  Original filename

- `file_type` (optional)
  Type: unknown
  
  File category (image, audio, video, document)
  
  anyOf:
    Type: string
  
    Type: null

- `mime_type` (optional)
  Type: unknown
  
  MIME type
  
  anyOf:
    Type: string
  
    Type: null

- `file_size` (optional)
  Type: integer
  
  File size in bytes
  
  default: 0

- `checksum` (optional)
  Type: unknown
  
  SHA-256 checksum
  
  anyOf:
    Type: string
  
    Type: null

- `storage_url` (optional)
  Type: unknown
  
  URL to the uploaded file
  
  anyOf:
    Type: string
  
    Type: null

- `captured_at` (optional)
  Type: unknown
  
  Device capture timestamp
  
  anyOf:
    Type: string
  
    Type: null

- `description` (optional)
  Type: unknown
  
  Notes/description
  
  anyOf:
    Type: string
  
    Type: null

Responses:

- 201: Successful Response

Content type: application/json

Type: object

Schema: [DataService_AttachmentResponseDTO](/api-reference/schemas/dataservice-attachmentresponsedto-d97d998c70.md)

- `id` (required)
  Type: string

- `entity_type` (required)
  Type: string

- `entity_id` (required)
  Type: string

- `filename` (required)
  Type: string

- `original_filename` (required)
  Type: string

- `file_type` (required)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `mime_type` (required)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `file_size` (required)
  Type: integer

- `description` (required)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `uploaded_by` (required)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `checksum` (required)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `is_public` (required)
  Type: boolean

- `field_name` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `captured_at` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `status` (required)
  Type: string

- `created_at` (required)
  Type: string

- `download_url` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- 422: Validation Error

Content type: application/json

Type: object

Schema: [DataService_HTTPValidationError](/api-reference/schemas/dataservice-httpvalidationerror-2b62d4c031.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [DataService_ValidationError](/api-reference/schemas/dataservice-validationerror-be7f37f547.md); Type: object

## Examples

### cURL

```bash
curl -X POST 'http://localhost:8002/api/v1/attachments/record' \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "entity_type": "string",
  "entity_id": "550e8400-e29b-41d4-a716-446655440000",
  "field_name": "string",
  "filename": "string",
  "original_filename": "string",
  "file_type": "string",
  "mime_type": "string",
  "file_size": 0,
  "checksum": "string",
  "storage_url": "string",
  "captured_at": "string",
  "description": "string"
}'
```

### JavaScript

```javascript
const body = `{
  "entity_type": "string",
  "entity_id": "550e8400-e29b-41d4-a716-446655440000",
  "field_name": "string",
  "filename": "string",
  "original_filename": "string",
  "file_type": "string",
  "mime_type": "string",
  "file_size": 0,
  "checksum": "string",
  "storage_url": "string",
  "captured_at": "string",
  "description": "string"
}`;

const response = await fetch('http://localhost:8002/api/v1/attachments/record', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
  },
  body,
});

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

### Python

```python
import requests

body = '''{
  "entity_type": "string",
  "entity_id": "550e8400-e29b-41d4-a716-446655440000",
  "field_name": "string",
  "filename": "string",
  "original_filename": "string",
  "file_type": "string",
  "mime_type": "string",
  "file_size": 0,
  "checksum": "string",
  "storage_url": "string",
  "captured_at": "string",
  "description": "string"
}'''

response = requests.post(
    'http://localhost:8002/api/v1/attachments/record',
    data=body.encode('utf-8'),
    headers={
        'Content-Type': 'application/json',
    },
)
print(response.text)
```


## Get Attachment

`GET /api/v1/attachments/{attachment_id}`

Get attachment metadata by ID.

Authentication: no security requirement declared for this operation.

Parameters:

- `attachment_id` (path, string, uuid, required)
  Type: string, uuid

Responses:

- 200: Successful Response

Content type: application/json

Type: object

Schema: [DataService_AttachmentResponseDTO](/api-reference/schemas/dataservice-attachmentresponsedto-d97d998c70.md)

- `id` (required)
  Type: string

- `entity_type` (required)
  Type: string

- `entity_id` (required)
  Type: string

- `filename` (required)
  Type: string

- `original_filename` (required)
  Type: string

- `file_type` (required)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `mime_type` (required)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `file_size` (required)
  Type: integer

- `description` (required)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `uploaded_by` (required)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `checksum` (required)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `is_public` (required)
  Type: boolean

- `field_name` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `captured_at` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `status` (required)
  Type: string

- `created_at` (required)
  Type: string

- `download_url` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- 422: Validation Error

Content type: application/json

Type: object

Schema: [DataService_HTTPValidationError](/api-reference/schemas/dataservice-httpvalidationerror-2b62d4c031.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [DataService_ValidationError](/api-reference/schemas/dataservice-validationerror-be7f37f547.md); Type: object

## Examples

### cURL

```bash
curl -X GET 'http://localhost:8002/api/v1/attachments/550e8400-e29b-41d4-a716-446655440000'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8002/api/v1/attachments/550e8400-e29b-41d4-a716-446655440000', {
  method: 'GET',
});

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

### Python

```python
import requests

response = requests.get('http://localhost:8002/api/v1/attachments/550e8400-e29b-41d4-a716-446655440000')
print(response.text)
```


## Delete Attachment

`DELETE /api/v1/attachments/{attachment_id}`

Delete an attachment.

Authentication: no security requirement declared for this operation.

Parameters:

- `attachment_id` (path, string, uuid, required)
  Type: string, uuid

Responses:

- 200: Successful Response

Content type: application/json

Type: object

Schema: [DataService_AttachmentDeleteResponse](/api-reference/schemas/dataservice-attachmentdeleteresponse-70c557fcbf.md)

- `message` (required)
  Type: string

- `id` (required)
  Type: string

- 422: Validation Error

Content type: application/json

Type: object

Schema: [DataService_HTTPValidationError](/api-reference/schemas/dataservice-httpvalidationerror-2b62d4c031.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [DataService_ValidationError](/api-reference/schemas/dataservice-validationerror-be7f37f547.md); Type: object

## Examples

### cURL

```bash
curl -X DELETE 'http://localhost:8002/api/v1/attachments/550e8400-e29b-41d4-a716-446655440000'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8002/api/v1/attachments/550e8400-e29b-41d4-a716-446655440000', {
  method: 'DELETE',
});

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

### Python

```python
import requests

response = requests.delete('http://localhost:8002/api/v1/attachments/550e8400-e29b-41d4-a716-446655440000')
print(response.text)
```


## Update Attachment

`PATCH /api/v1/attachments/{attachment_id}`

Update attachment metadata (notes/description and field_name).

Authentication: no security requirement declared for this operation.

Parameters:

- `attachment_id` (path, string, uuid, required)
  Type: string, uuid

Request body: application/json (required)

Type: object

Schema: [DataService_UpdateAttachmentDTO](/api-reference/schemas/dataservice-updateattachmentdto-507e7c264d.md)

- `description` (optional)
  Type: unknown
  
  Updated notes/description
  
  anyOf:
    Type: string
  
    Type: null

- `field_name` (optional)
  Type: unknown
  
  Updated question field name
  
  anyOf:
    Type: string
  
    Type: null

Responses:

- 200: Successful Response

Content type: application/json

Type: object

Schema: [DataService_AttachmentResponseDTO](/api-reference/schemas/dataservice-attachmentresponsedto-d97d998c70.md)

- `id` (required)
  Type: string

- `entity_type` (required)
  Type: string

- `entity_id` (required)
  Type: string

- `filename` (required)
  Type: string

- `original_filename` (required)
  Type: string

- `file_type` (required)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `mime_type` (required)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `file_size` (required)
  Type: integer

- `description` (required)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `uploaded_by` (required)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `checksum` (required)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `is_public` (required)
  Type: boolean

- `field_name` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `captured_at` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `status` (required)
  Type: string

- `created_at` (required)
  Type: string

- `download_url` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- 422: Validation Error

Content type: application/json

Type: object

Schema: [DataService_HTTPValidationError](/api-reference/schemas/dataservice-httpvalidationerror-2b62d4c031.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [DataService_ValidationError](/api-reference/schemas/dataservice-validationerror-be7f37f547.md); Type: object

## Examples

### cURL

```bash
curl -X PATCH 'http://localhost:8002/api/v1/attachments/550e8400-e29b-41d4-a716-446655440000' \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "description": "string",
  "field_name": "string"
}'
```

### JavaScript

```javascript
const body = `{
  "description": "string",
  "field_name": "string"
}`;

const response = await fetch('http://localhost:8002/api/v1/attachments/550e8400-e29b-41d4-a716-446655440000', {
  method: 'PATCH',
  headers: {
    'Content-Type': 'application/json',
  },
  body,
});

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

### Python

```python
import requests

body = '''{
  "description": "string",
  "field_name": "string"
}'''

response = requests.patch(
    'http://localhost:8002/api/v1/attachments/550e8400-e29b-41d4-a716-446655440000',
    data=body.encode('utf-8'),
    headers={
        'Content-Type': 'application/json',
    },
)
print(response.text)
```


## Download Attachment

`GET /api/v1/attachments/{attachment_id}/download`

Download attachment file.

Authentication: no security requirement declared for this operation.

Parameters:

- `attachment_id` (path, string, uuid, required)
  Type: string, uuid

Responses:

- 200: Successful Response

Content type: application/json

Type: unknown

- 422: Validation Error

Content type: application/json

Type: object

Schema: [DataService_HTTPValidationError](/api-reference/schemas/dataservice-httpvalidationerror-2b62d4c031.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [DataService_ValidationError](/api-reference/schemas/dataservice-validationerror-be7f37f547.md); Type: object

## Examples

### cURL

```bash
curl -X GET 'http://localhost:8002/api/v1/attachments/550e8400-e29b-41d4-a716-446655440000/download'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8002/api/v1/attachments/550e8400-e29b-41d4-a716-446655440000/download', {
  method: 'GET',
});

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

### Python

```python
import requests

response = requests.get('http://localhost:8002/api/v1/attachments/550e8400-e29b-41d4-a716-446655440000/download')
print(response.text)
```


## Get Active Surveys

`GET /api/v1/analytics/responses/active`

Get a list of all survey IDs for this tenant that have at least one response.
Used by frontend to filter survey list in Data Viewer.

Authentication: no security requirement declared for this operation.

Responses:

- 200: Successful Response

Content type: application/json

Type: array

Items:
  Type: string

## Examples

### cURL

```bash
curl -X GET 'http://localhost:8002/api/v1/analytics/responses/active'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8002/api/v1/analytics/responses/active', {
  method: 'GET',
});

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

### Python

```python
import requests

response = requests.get('http://localhost:8002/api/v1/analytics/responses/active')
print(response.text)
```


## Get Response Stats

`GET /api/v1/analytics/responses/stats/{survey_id}`

Get comprehensive statistics for survey responses.

Returns counts by status, completion rate, and average duration.
Date-only from_date/to_date values are interpreted as local calendar days
in ``timezone_context``; full datetimes are treated as instants. The end
boundary is exclusive.

Authentication: no security requirement declared for this operation.

Parameters:

- `survey_id` (path, string, uuid, required)
  Type: string, uuid

- `from_date` (query, unknown, optional) - Start date filter
  Type: unknown
  
  Start date filter
  
  anyOf:
    Type: string, date-time
  
    Type: null

- `to_date` (query, unknown, optional) - End date filter
  Type: unknown
  
  End date filter
  
  anyOf:
    Type: string, date-time
  
    Type: null

- `timezone_context` (query, unknown, optional) - IANA timezone for date-only boundaries
  Type: unknown
  
  IANA timezone for date-only boundaries
  
  anyOf:
    Type: string
  
    Type: null

Responses:

- 200: Successful Response

Content type: application/json

Type: object

Schema: [DataService_ResponseStatsDTO](/api-reference/schemas/dataservice-responsestatsdto-984232426a.md)

- `survey_id` (required)
  Type: string

- `total_responses` (required)
  Type: integer

- `draft_count` (required)
  Type: integer

- `submitted_count` (required)
  Type: integer

- `completed_count` (required)
  Type: integer

- `invalidated_count` (required)
  Type: integer

- `completion_rate` (required)
  Type: number

- `average_duration_seconds` (required)
  Type: unknown
  
  anyOf:
    Type: number
  
    Type: null

- `date_from` (required)
  Type: string

- `date_to` (required)
  Type: string

- 422: Validation Error

Content type: application/json

Type: object

Schema: [DataService_HTTPValidationError](/api-reference/schemas/dataservice-httpvalidationerror-2b62d4c031.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [DataService_ValidationError](/api-reference/schemas/dataservice-validationerror-be7f37f547.md); Type: object

## Examples

### cURL

```bash
curl -X GET 'http://localhost:8002/api/v1/analytics/responses/stats/550e8400-e29b-41d4-a716-446655440000'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8002/api/v1/analytics/responses/stats/550e8400-e29b-41d4-a716-446655440000', {
  method: 'GET',
});

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

### Python

```python
import requests

response = requests.get('http://localhost:8002/api/v1/analytics/responses/stats/550e8400-e29b-41d4-a716-446655440000')
print(response.text)
```


## Get Response Timeseries

`GET /api/v1/analytics/responses/timeseries/{survey_id}`

Get time-series data for survey responses.

Buckets are the effective-IANA CALENDAR day (``YYYY-MM-DD``), never UTC
wall-clock days. ``timezone_context`` selects the zone; Postgres applies
its DST rules per timestamp via ``created_at AT TIME ZONE :tz``. Date-only
from_date/to_date are interpreted as local calendar days; full datetimes
are instants. The end boundary is exclusive and daily series are
zero-filled so exactly the requested local calendar days are returned.

Authentication: no security requirement declared for this operation.

Parameters:

- `survey_id` (path, string, uuid, required)
  Type: string, uuid

- `granularity` (query, string, optional) - Time granularity: day, week, month
  Type: string
  
  Time granularity: day, week, month
  
  default: "day"

- `from_date` (query, unknown, optional) - Start date
  Type: unknown
  
  Start date
  
  anyOf:
    Type: string, date-time
  
    Type: null

- `to_date` (query, unknown, optional) - End date (exclusive)
  Type: unknown
  
  End date (exclusive)
  
  anyOf:
    Type: string, date-time
  
    Type: null

- `status` (query, unknown, optional) - Filter by response status
  Type: unknown
  
  Filter by response status
  
  anyOf:
    Type: string
  
    Type: null

- `timezone_context` (query, unknown, optional) - IANA timezone for calendar-day bucketing
  Type: unknown
  
  IANA timezone for calendar-day bucketing
  
  anyOf:
    Type: string
  
    Type: null

Responses:

- 200: Successful Response

Content type: application/json

Type: object

Schema: [DataService_TimeSeriesDTO](/api-reference/schemas/dataservice-timeseriesdto-6c2dc9344e.md)

- `survey_id` (required)
  Type: string

- `granularity` (required)
  Type: string

- `data` (required)
  Type: array
  
  Items:
    Reference: [DataService_TimeSeriesPointDTO](/api-reference/schemas/dataservice-timeseriespointdto-ffb25995cd.md); Type: object

- 422: Validation Error

Content type: application/json

Type: object

Schema: [DataService_HTTPValidationError](/api-reference/schemas/dataservice-httpvalidationerror-2b62d4c031.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [DataService_ValidationError](/api-reference/schemas/dataservice-validationerror-be7f37f547.md); Type: object

## Examples

### cURL

```bash
curl -X GET 'http://localhost:8002/api/v1/analytics/responses/timeseries/550e8400-e29b-41d4-a716-446655440000?granularity=day'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8002/api/v1/analytics/responses/timeseries/550e8400-e29b-41d4-a716-446655440000?granularity=day', {
  method: 'GET',
});

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

### Python

```python
import requests

response = requests.get('http://localhost:8002/api/v1/analytics/responses/timeseries/550e8400-e29b-41d4-a716-446655440000?granularity=day')
print(response.text)
```


## Get Question Stats

`GET /api/v1/analytics/responses/questions/{survey_id}`

Get statistics for individual questions across all responses.

Shows answer counts, unique respondents, and most common values.

Authentication: no security requirement declared for this operation.

Parameters:

- `survey_id` (path, string, uuid, required)
  Type: string, uuid

- `limit` (query, integer, optional) - Number of questions to return
  Type: integer
  
  Number of questions to return
  
  default: 10
  
  minimum: 1
  
  maximum: 50

Responses:

- 200: Successful Response

Content type: application/json

Type: array

Items:
  Reference: [DataService_QuestionStatsDTO](/api-reference/schemas/dataservice-questionstatsdto-7c2abb2676.md); Type: object

- 422: Validation Error

Content type: application/json

Type: object

Schema: [DataService_HTTPValidationError](/api-reference/schemas/dataservice-httpvalidationerror-2b62d4c031.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [DataService_ValidationError](/api-reference/schemas/dataservice-validationerror-be7f37f547.md); Type: object

## Examples

### cURL

```bash
curl -X GET 'http://localhost:8002/api/v1/analytics/responses/questions/550e8400-e29b-41d4-a716-446655440000?limit=10'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8002/api/v1/analytics/responses/questions/550e8400-e29b-41d4-a716-446655440000?limit=10', {
  method: 'GET',
});

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

### Python

```python
import requests

response = requests.get('http://localhost:8002/api/v1/analytics/responses/questions/550e8400-e29b-41d4-a716-446655440000?limit=10')
print(response.text)
```


## Get Answer Distribution

`GET /api/v1/analytics/responses/distribution/{survey_id}/{question_id}`

Get distribution of answers for a specific question.

Shows value counts and percentages - useful for multiple choice questions.

Authentication: no security requirement declared for this operation.

Parameters:

- `survey_id` (path, string, uuid, required)
  Type: string, uuid

- `question_id` (path, string, required)
  Type: string

- `limit` (query, integer, optional)
  Type: integer
  
  default: 20
  
  minimum: 1
  
  maximum: 100

Responses:

- 200: Successful Response

Content type: application/json

Type: array

Items:
  Reference: [DataService_AnswerDistributionDTO](/api-reference/schemas/dataservice-answerdistributiondto-ec182b84a8.md); Type: object

- 422: Validation Error

Content type: application/json

Type: object

Schema: [DataService_HTTPValidationError](/api-reference/schemas/dataservice-httpvalidationerror-2b62d4c031.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [DataService_ValidationError](/api-reference/schemas/dataservice-validationerror-be7f37f547.md); Type: object

## Examples

### cURL

```bash
curl -X GET 'http://localhost:8002/api/v1/analytics/responses/distribution/550e8400-e29b-41d4-a716-446655440000/string?limit=20'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8002/api/v1/analytics/responses/distribution/550e8400-e29b-41d4-a716-446655440000/string?limit=20', {
  method: 'GET',
});

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

### Python

```python
import requests

response = requests.get('http://localhost:8002/api/v1/analytics/responses/distribution/550e8400-e29b-41d4-a716-446655440000/string?limit=20')
print(response.text)
```


## Get Analytics Summary

`GET /api/v1/analytics/responses/summary/{survey_id}`

Get a comprehensive analytics summary for a survey.

Combines multiple metrics: response counts, completion rates,
question statistics, and respondent information.

Authentication: no security requirement declared for this operation.

Parameters:

- `survey_id` (path, string, uuid, required)
  Type: string, uuid

Responses:

- 200: Successful Response

Content type: application/json

Type: object

Schema: [DataService_AnalyticsSummaryDTO](/api-reference/schemas/dataservice-analyticssummarydto-f89f77fe05.md)

- `survey_id` (required)
  Type: string

- `total_responses` (required)
  Type: integer

- `unique_respondents` (required)
  Type: integer

- `response_rate` (required)
  Type: unknown
  
  anyOf:
    Type: number
  
    Type: null

- `average_completion_time_seconds` (required)
  Type: unknown
  
  anyOf:
    Type: number
  
    Type: null

- `questions_analyzed` (required)
  Type: integer

- `top_questions` (required)
  Type: array
  
  Items:
    Reference: [DataService_QuestionStatsDTO](/api-reference/schemas/dataservice-questionstatsdto-7c2abb2676.md); Type: object

- 422: Validation Error

Content type: application/json

Type: object

Schema: [DataService_HTTPValidationError](/api-reference/schemas/dataservice-httpvalidationerror-2b62d4c031.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [DataService_ValidationError](/api-reference/schemas/dataservice-validationerror-be7f37f547.md); Type: object

## Examples

### cURL

```bash
curl -X GET 'http://localhost:8002/api/v1/analytics/responses/summary/550e8400-e29b-41d4-a716-446655440000'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8002/api/v1/analytics/responses/summary/550e8400-e29b-41d4-a716-446655440000', {
  method: 'GET',
});

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

### Python

```python
import requests

response = requests.get('http://localhost:8002/api/v1/analytics/responses/summary/550e8400-e29b-41d4-a716-446655440000')
print(response.text)
```


## Get Dashboard Metrics

`GET /api/v1/analytics/dashboard`

Get consolidated dashboard metrics for the Operations Center.

Returns:
- active_forms: count of published surveys visible to user (0 - use survey-service)
- active_enumerators: distinct users with successful submissions in last 24h
- submissions_today: count of submitted/completed responses today (effective-IANA local day)
- failed_submissions: count of failed push attempts today (0 - use sync-service)
- latest_submission_times: per-survey latest timestamps (for "Last Submission" column)
- timezone_context: timezone used for date calculations (UTC fallback)

Authentication: no security requirement declared for this operation.

Parameters:

- `timezone_context` (query, unknown, optional) - IANA timezone for calendar-day bucketing
  Type: unknown
  
  IANA timezone for calendar-day bucketing
  
  anyOf:
    Type: string
  
    Type: null

Responses:

- 200: Successful Response

Content type: application/json

Type: object

Schema: [DataService_DashboardMetricsDTO](/api-reference/schemas/dataservice-dashboardmetricsdto-e8c4c9ad5b.md)

- `active_forms` (required)
  Type: integer

- `active_enumerators` (required)
  Type: integer

- `submissions_today` (required)
  Type: integer

- `failed_submissions` (required)
  Type: integer

- `latest_submission_times` (required)
  Type: array
  
  Items:
    Reference: [DataService_SurveyLatestSubmissionDTO](/api-reference/schemas/dataservice-surveylatestsubmissiondto-d34afcc8d1.md); Type: object

- `timezone_context` (required)
  Type: string

- 422: Validation Error

Content type: application/json

Type: object

Schema: [DataService_HTTPValidationError](/api-reference/schemas/dataservice-httpvalidationerror-2b62d4c031.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [DataService_ValidationError](/api-reference/schemas/dataservice-validationerror-be7f37f547.md); Type: object

## Examples

### cURL

```bash
curl -X GET 'http://localhost:8002/api/v1/analytics/dashboard'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8002/api/v1/analytics/dashboard', {
  method: 'GET',
});

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

### Python

```python
import requests

response = requests.get('http://localhost:8002/api/v1/analytics/dashboard')
print(response.text)
```


## Get Dashboard Data

`GET /api/v1/analytics/dashboard/{survey_id}`

Get all analytics data for a dashboard view.

Combines stats, timeseries, and question data in one call.

Authentication: no security requirement declared for this operation.

Parameters:

- `survey_id` (path, string, uuid, required)
  Type: string, uuid

- `timezone_context` (query, unknown, optional) - IANA timezone for calendar-day bucketing
  Type: unknown
  
  IANA timezone for calendar-day bucketing
  
  anyOf:
    Type: string
  
    Type: null

Responses:

- 200: Successful Response

Content type: application/json

Type: unknown

- 422: Validation Error

Content type: application/json

Type: object

Schema: [DataService_HTTPValidationError](/api-reference/schemas/dataservice-httpvalidationerror-2b62d4c031.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [DataService_ValidationError](/api-reference/schemas/dataservice-validationerror-be7f37f547.md); Type: object

## Examples

### cURL

```bash
curl -X GET 'http://localhost:8002/api/v1/analytics/dashboard/550e8400-e29b-41d4-a716-446655440000'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8002/api/v1/analytics/dashboard/550e8400-e29b-41d4-a716-446655440000', {
  method: 'GET',
});

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

### Python

```python
import requests

response = requests.get('http://localhost:8002/api/v1/analytics/dashboard/550e8400-e29b-41d4-a716-446655440000')
print(response.text)
```


## Generate Random Sample

`POST /api/v1/sampling/generate`

Generate a random sample from an uploaded CSV or Excel file.

- **file**: CSV or Excel file (.csv, .xlsx, .xls)
- **sample_size**: Number of rows to sample (must be <= total rows)
- **output_format**: Output format: csv (default), xlsx, or json

Authentication: no security requirement declared for this operation.

Request body: multipart/form-data (required)

Type: object

Schema: [DataService_Body_generate_random_sample_api_v1_sampling_generate_post](/api-reference/schemas/dataservice-body-generate-random-sample-api-v1-sampling-generate-post-3bd4a7c7c2.md)

- `file` (required)
  Type: string

- `sample_size` (required)
  Type: integer

- `output_format` (optional)
  Type: string
  
  default: "csv"

Responses:

- 200: Successful Response

Content type: application/json

Type: unknown

- 422: Validation Error

Content type: application/json

Type: object

Schema: [DataService_HTTPValidationError](/api-reference/schemas/dataservice-httpvalidationerror-2b62d4c031.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [DataService_ValidationError](/api-reference/schemas/dataservice-validationerror-be7f37f547.md); Type: object

## Examples

### cURL

```bash
curl -X POST 'http://localhost:8002/api/v1/sampling/generate' \
  --form-string 'file=string' \
  --form-string 'sample_size=0' \
  --form-string 'output_format=csv'
```

### JavaScript

```javascript
const form = new FormData();
form.append('file', 'string');
form.append('sample_size', '0');
form.append('output_format', 'csv');
const response = await fetch('http://localhost:8002/api/v1/sampling/generate', {
  method: 'POST',
  headers: {},
  body: form,
});
console.log(await response.text());
```

### Python

```python
import requests
from contextlib import ExitStack

with ExitStack() as stack:
    files = [
        ('file', (None, 'string')),
        ('sample_size', (None, '0')),
        ('output_format', (None, 'csv')),
    ]
    response = requests.request('POST', 'http://localhost:8002/api/v1/sampling/generate', headers={}, files=files)
    print(response.text)
```


## Generate Random Sample

`POST /api/v1/data/sampling/generate`

Generate a random sample from an uploaded CSV or Excel file.

- **file**: CSV or Excel file (.csv, .xlsx, .xls)
- **sample_size**: Number of rows to sample (must be <= total rows)
- **output_format**: Output format: csv (default), xlsx, or json

Authentication: no security requirement declared for this operation.

Request body: multipart/form-data (required)

Type: object

Schema: [DataService_Body_generate_random_sample_api_v1_data_sampling_generate_post](/api-reference/schemas/dataservice-body-generate-random-sample-api-v1-data-sampling-generate-post-cfa6a9f524.md)

- `file` (required)
  Type: string

- `sample_size` (required)
  Type: integer

- `output_format` (optional)
  Type: string
  
  default: "csv"

Responses:

- 200: Successful Response

Content type: application/json

Type: unknown

- 422: Validation Error

Content type: application/json

Type: object

Schema: [DataService_HTTPValidationError](/api-reference/schemas/dataservice-httpvalidationerror-2b62d4c031.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [DataService_ValidationError](/api-reference/schemas/dataservice-validationerror-be7f37f547.md); Type: object

## Examples

### cURL

```bash
curl -X POST 'http://localhost:8002/api/v1/data/sampling/generate' \
  --form-string 'file=string' \
  --form-string 'sample_size=0' \
  --form-string 'output_format=csv'
```

### JavaScript

```javascript
const form = new FormData();
form.append('file', 'string');
form.append('sample_size', '0');
form.append('output_format', 'csv');
const response = await fetch('http://localhost:8002/api/v1/data/sampling/generate', {
  method: 'POST',
  headers: {},
  body: form,
});
console.log(await response.text());
```

### Python

```python
import requests
from contextlib import ExitStack

with ExitStack() as stack:
    files = [
        ('file', (None, 'string')),
        ('sample_size', (None, '0')),
        ('output_format', (None, 'csv')),
    ]
    response = requests.request('POST', 'http://localhost:8002/api/v1/data/sampling/generate', headers={}, files=files)
    print(response.text)
```


## Health Check

`GET /api/v1/sync/health`

Health check endpoint.

Authentication: no security requirement declared for this operation.

Responses:

- 200: Successful Response

Content type: application/json

Type: object

Schema: [SyncService_HealthResponseDTO](/api-reference/schemas/syncservice-healthresponsedto-697d0eceb2.md)

- `status` (required)
  Type: string

- `service` (required)
  Type: string

- `version` (required)
  Type: string

- `timestamp` (required)
  Type: string, date-time

- `database` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

## Examples

### cURL

```bash
curl -X GET 'http://localhost:8003/api/v1/sync/health'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8003/api/v1/sync/health', {
  method: 'GET',
});

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

### Python

```python
import requests

response = requests.get('http://localhost:8003/api/v1/sync/health')
print(response.text)
```


## List User Devices

`GET /api/v1/sync/devices`

List all devices registered for the current user.

Authentication (security requirement alternatives):

```json
[
  {
    "JWT": []
  }
]
```

- JWT: http (bearer). JWT Token Authentication

Responses:

- 200: Successful Response

Content type: application/json

Type: object

List of devices response.

Schema: [SyncService_DeviceListDTO](/api-reference/schemas/syncservice-devicelistdto-ccfb481d80.md)

- `items` (required)
  Type: array
  
  Items:
    Reference: [SyncService_DeviceResponseDTO](/api-reference/schemas/syncservice-deviceresponsedto-e133ad3447.md); Type: object
    
    Device response.

- `total` (required)
  Type: integer

- `skip` (optional)
  Type: integer
  
  default: 0

- `limit` (optional)
  Type: integer
  
  default: 100

- `has_next` (optional)
  Type: boolean
  
  default: false

- `has_previous` (optional)
  Type: boolean
  
  default: false

## Examples

### cURL

```bash
curl -X GET 'http://localhost:8003/api/v1/sync/devices' \
  -H 'Authorization: Bearer YOUR_TOKEN'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8003/api/v1/sync/devices', {
  method: 'GET',
  headers: {
    'Authorization': 'Bearer YOUR_TOKEN',
  },
});

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

### Python

```python
import requests

response = requests.get(
    'http://localhost:8003/api/v1/sync/devices',
    headers={
        'Authorization': 'Bearer YOUR_TOKEN',
    },
)
print(response.text)
```


## Register Device

`POST /api/v1/sync/devices`

Register a new device for the current user.

- One device per user per platform
- If device already exists, updates registration
- Sets new device as primary

Authentication (security requirement alternatives):

```json
[
  {
    "JWT": []
  }
]
```

- JWT: http (bearer). JWT Token Authentication

Request body: application/json (required)

Type: object

Device registration request.

Schema: [SyncService_DeviceRegistrationDTO](/api-reference/schemas/syncservice-deviceregistrationdto-e971e161c2.md)

- `device_id` (required)
  Type: string
  
  Unique device identifier
  
  minLength: 1
  
  maxLength: 255

- `platform` (required)
  Type: string
  
  Device platform (ios, android, web, desktop)

- `device_name` (optional)
  Type: unknown
  
  anyOf:
    Type: string
    
    maxLength: 255
  
    Type: null

- `device_model` (optional)
  Type: unknown
  
  anyOf:
    Type: string
    
    maxLength: 255
  
    Type: null

- `os_version` (optional)
  Type: unknown
  
  anyOf:
    Type: string
    
    maxLength: 50
  
    Type: null

- `app_version` (optional)
  Type: unknown
  
  anyOf:
    Type: string
    
    maxLength: 50
  
    Type: null

- `push_token` (optional)
  Type: unknown
  
  anyOf:
    Type: string
    
    maxLength: 500
  
    Type: null

Responses:

- 201: Successful Response

Content type: application/json

Type: object

Device response.

Schema: [SyncService_DeviceResponseDTO](/api-reference/schemas/syncservice-deviceresponsedto-e133ad3447.md)

- `id` (required)
  Type: string

- `device_id` (required)
  Type: string

- `platform` (required)
  Type: string

- `device_name` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `device_model` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `os_version` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `app_version` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `status` (required)
  Type: string

- `is_primary` (required)
  Type: boolean

- `last_active_at` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `created_at` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- 422: Validation Error

Content type: application/json

Type: object

Schema: [SyncService_HTTPValidationError](/api-reference/schemas/syncservice-httpvalidationerror-37f685d848.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [SyncService_ValidationError](/api-reference/schemas/syncservice-validationerror-74e4de623a.md); Type: object

## Examples

### cURL

```bash
curl -X POST 'http://localhost:8003/api/v1/sync/devices' \
  -H 'Authorization: Bearer YOUR_TOKEN' \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "device_id": "string",
  "platform": "string",
  "device_name": "string",
  "device_model": "string",
  "os_version": "string",
  "app_version": "string",
  "push_token": "string"
}'
```

### JavaScript

```javascript
const body = `{
  "device_id": "string",
  "platform": "string",
  "device_name": "string",
  "device_model": "string",
  "os_version": "string",
  "app_version": "string",
  "push_token": "string"
}`;

const response = await fetch('http://localhost:8003/api/v1/sync/devices', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer YOUR_TOKEN',
    'Content-Type': 'application/json',
  },
  body,
});

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

### Python

```python
import requests

body = '''{
  "device_id": "string",
  "platform": "string",
  "device_name": "string",
  "device_model": "string",
  "os_version": "string",
  "app_version": "string",
  "push_token": "string"
}'''

response = requests.post(
    'http://localhost:8003/api/v1/sync/devices',
    data=body.encode('utf-8'),
    headers={
        'Authorization': 'Bearer YOUR_TOKEN',
        'Content-Type': 'application/json',
    },
)
print(response.text)
```


## Get Device

`GET /api/v1/sync/devices/{device_id}`

Get device details by device ID.

Authentication (security requirement alternatives):

```json
[
  {
    "JWT": []
  }
]
```

- JWT: http (bearer). JWT Token Authentication

Parameters:

- `device_id` (path, string, required)
  Type: string

Responses:

- 200: Successful Response

Content type: application/json

Type: object

Device response.

Schema: [SyncService_DeviceResponseDTO](/api-reference/schemas/syncservice-deviceresponsedto-e133ad3447.md)

- `id` (required)
  Type: string

- `device_id` (required)
  Type: string

- `platform` (required)
  Type: string

- `device_name` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `device_model` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `os_version` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `app_version` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `status` (required)
  Type: string

- `is_primary` (required)
  Type: boolean

- `last_active_at` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `created_at` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- 422: Validation Error

Content type: application/json

Type: object

Schema: [SyncService_HTTPValidationError](/api-reference/schemas/syncservice-httpvalidationerror-37f685d848.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [SyncService_ValidationError](/api-reference/schemas/syncservice-validationerror-74e4de623a.md); Type: object

## Examples

### cURL

```bash
curl -X GET 'http://localhost:8003/api/v1/sync/devices/string' \
  -H 'Authorization: Bearer YOUR_TOKEN'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8003/api/v1/sync/devices/string', {
  method: 'GET',
  headers: {
    'Authorization': 'Bearer YOUR_TOKEN',
  },
});

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

### Python

```python
import requests

response = requests.get(
    'http://localhost:8003/api/v1/sync/devices/string',
    headers={
        'Authorization': 'Bearer YOUR_TOKEN',
    },
)
print(response.text)
```


## Update Device

`PUT /api/v1/sync/devices/{device_id}`

Update device information.

Authentication (security requirement alternatives):

```json
[
  {
    "JWT": []
  }
]
```

- JWT: http (bearer). JWT Token Authentication

Parameters:

- `device_id` (path, string, required)
  Type: string

Request body: application/json (required)

Type: object

Device update request.

Schema: [SyncService_DeviceUpdateDTO](/api-reference/schemas/syncservice-deviceupdatedto-632de1793c.md)

- `device_name` (optional)
  Type: unknown
  
  anyOf:
    Type: string
    
    maxLength: 255
  
    Type: null

- `device_model` (optional)
  Type: unknown
  
  anyOf:
    Type: string
    
    maxLength: 255
  
    Type: null

- `os_version` (optional)
  Type: unknown
  
  anyOf:
    Type: string
    
    maxLength: 50
  
    Type: null

- `app_version` (optional)
  Type: unknown
  
  anyOf:
    Type: string
    
    maxLength: 50
  
    Type: null

- `push_token` (optional)
  Type: unknown
  
  anyOf:
    Type: string
    
    maxLength: 500
  
    Type: null

Responses:

- 200: Successful Response

Content type: application/json

Type: object

Device response.

Schema: [SyncService_DeviceResponseDTO](/api-reference/schemas/syncservice-deviceresponsedto-e133ad3447.md)

- `id` (required)
  Type: string

- `device_id` (required)
  Type: string

- `platform` (required)
  Type: string

- `device_name` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `device_model` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `os_version` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `app_version` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `status` (required)
  Type: string

- `is_primary` (required)
  Type: boolean

- `last_active_at` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `created_at` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- 422: Validation Error

Content type: application/json

Type: object

Schema: [SyncService_HTTPValidationError](/api-reference/schemas/syncservice-httpvalidationerror-37f685d848.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [SyncService_ValidationError](/api-reference/schemas/syncservice-validationerror-74e4de623a.md); Type: object

## Examples

### cURL

```bash
curl -X PUT 'http://localhost:8003/api/v1/sync/devices/string' \
  -H 'Authorization: Bearer YOUR_TOKEN' \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "device_name": "string",
  "device_model": "string",
  "os_version": "string",
  "app_version": "string",
  "push_token": "string"
}'
```

### JavaScript

```javascript
const body = `{
  "device_name": "string",
  "device_model": "string",
  "os_version": "string",
  "app_version": "string",
  "push_token": "string"
}`;

const response = await fetch('http://localhost:8003/api/v1/sync/devices/string', {
  method: 'PUT',
  headers: {
    'Authorization': 'Bearer YOUR_TOKEN',
    'Content-Type': 'application/json',
  },
  body,
});

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

### Python

```python
import requests

body = '''{
  "device_name": "string",
  "device_model": "string",
  "os_version": "string",
  "app_version": "string",
  "push_token": "string"
}'''

response = requests.put(
    'http://localhost:8003/api/v1/sync/devices/string',
    data=body.encode('utf-8'),
    headers={
        'Authorization': 'Bearer YOUR_TOKEN',
        'Content-Type': 'application/json',
    },
)
print(response.text)
```


## Deregister Device

`DELETE /api/v1/sync/devices/{device_id}`

Deregister a device.

Authentication (security requirement alternatives):

```json
[
  {
    "JWT": []
  }
]
```

- JWT: http (bearer). JWT Token Authentication

Parameters:

- `device_id` (path, string, required)
  Type: string

Responses:

- 204: Successful Response

- 422: Validation Error

Content type: application/json

Type: object

Schema: [SyncService_HTTPValidationError](/api-reference/schemas/syncservice-httpvalidationerror-37f685d848.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [SyncService_ValidationError](/api-reference/schemas/syncservice-validationerror-74e4de623a.md); Type: object

## Examples

### cURL

```bash
curl -X DELETE 'http://localhost:8003/api/v1/sync/devices/string' \
  -H 'Authorization: Bearer YOUR_TOKEN'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8003/api/v1/sync/devices/string', {
  method: 'DELETE',
  headers: {
    'Authorization': 'Bearer YOUR_TOKEN',
  },
});

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

### Python

```python
import requests

response = requests.delete(
    'http://localhost:8003/api/v1/sync/devices/string',
    headers={
        'Authorization': 'Bearer YOUR_TOKEN',
    },
)
print(response.text)
```


## Update Push Token

`PATCH /api/v1/sync/devices/{device_id}/push-token`

Update device push token.

Authentication (security requirement alternatives):

```json
[
  {
    "JWT": []
  }
]
```

- JWT: http (bearer). JWT Token Authentication

Parameters:

- `device_id` (path, string, required)
  Type: string

Request body: application/json (required)

Type: object

Push token update request.

Schema: [SyncService_PushTokenUpdateDTO](/api-reference/schemas/syncservice-pushtokenupdatedto-43ffdcb755.md)

- `push_token` (required)
  Type: string
  
  minLength: 1
  
  maxLength: 500

Responses:

- 200: Successful Response

Content type: application/json

Type: object

Device response.

Schema: [SyncService_DeviceResponseDTO](/api-reference/schemas/syncservice-deviceresponsedto-e133ad3447.md)

- `id` (required)
  Type: string

- `device_id` (required)
  Type: string

- `platform` (required)
  Type: string

- `device_name` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `device_model` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `os_version` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `app_version` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `status` (required)
  Type: string

- `is_primary` (required)
  Type: boolean

- `last_active_at` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `created_at` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- 422: Validation Error

Content type: application/json

Type: object

Schema: [SyncService_HTTPValidationError](/api-reference/schemas/syncservice-httpvalidationerror-37f685d848.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [SyncService_ValidationError](/api-reference/schemas/syncservice-validationerror-74e4de623a.md); Type: object

## Examples

### cURL

```bash
curl -X PATCH 'http://localhost:8003/api/v1/sync/devices/string/push-token' \
  -H 'Authorization: Bearer YOUR_TOKEN' \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "push_token": "string"
}'
```

### JavaScript

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

const response = await fetch('http://localhost:8003/api/v1/sync/devices/string/push-token', {
  method: 'PATCH',
  headers: {
    'Authorization': 'Bearer YOUR_TOKEN',
    'Content-Type': 'application/json',
  },
  body,
});

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

### Python

```python
import requests

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

response = requests.patch(
    'http://localhost:8003/api/v1/sync/devices/string/push-token',
    data=body.encode('utf-8'),
    headers={
        'Authorization': 'Bearer YOUR_TOKEN',
        'Content-Type': 'application/json',
    },
)
print(response.text)
```


## Set Primary Device

`POST /api/v1/sync/devices/{device_id}/set-primary`

Set device as primary for the user.

Authentication (security requirement alternatives):

```json
[
  {
    "JWT": []
  }
]
```

- JWT: http (bearer). JWT Token Authentication

Parameters:

- `device_id` (path, string, required)
  Type: string

Responses:

- 200: Successful Response

Content type: application/json

Type: object

Device response.

Schema: [SyncService_DeviceResponseDTO](/api-reference/schemas/syncservice-deviceresponsedto-e133ad3447.md)

- `id` (required)
  Type: string

- `device_id` (required)
  Type: string

- `platform` (required)
  Type: string

- `device_name` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `device_model` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `os_version` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `app_version` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `status` (required)
  Type: string

- `is_primary` (required)
  Type: boolean

- `last_active_at` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `created_at` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- 422: Validation Error

Content type: application/json

Type: object

Schema: [SyncService_HTTPValidationError](/api-reference/schemas/syncservice-httpvalidationerror-37f685d848.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [SyncService_ValidationError](/api-reference/schemas/syncservice-validationerror-74e4de623a.md); Type: object

## Examples

### cURL

```bash
curl -X POST 'http://localhost:8003/api/v1/sync/devices/string/set-primary' \
  -H 'Authorization: Bearer YOUR_TOKEN'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8003/api/v1/sync/devices/string/set-primary', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer YOUR_TOKEN',
  },
});

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

### Python

```python
import requests

response = requests.post(
    'http://localhost:8003/api/v1/sync/devices/string/set-primary',
    headers={
        'Authorization': 'Bearer YOUR_TOKEN',
    },
)
print(response.text)
```


## Pull Sync

`POST /api/v1/sync/pull`

Pull synchronized data from the server.

- **Delta-based**: Only returns changes since last_sync_token / last checkpoint.
- **Surveys**: Fetched from survey-service, filtered by `updated_after` timestamp.
- **Checkpoint updated**: `last_survey_sync_at` is advanced after a successful pull.
- **New sync_token** returned for the device to use in the next call.

Authentication (security requirement alternatives):

```json
[
  {
    "JWT": []
  }
]
```

- JWT: http (bearer). JWT Token Authentication

Request body: application/json (required)

Type: object

Pull sync request.

Schema: [SyncService_SyncPullRequestDTO](/api-reference/schemas/syncservice-syncpullrequestdto-a513103abd.md)

- `device_id` (required)
  Type: string
  
  Device identifier
  
  minLength: 1
  
  maxLength: 255

- `last_sync_token` (optional)
  Type: unknown
  
  Token from previous sync
  
  anyOf:
    Type: string
  
    Type: null

- `survey_version` (optional)
  Type: unknown
  
  Last known survey version (semver string)
  
  anyOf:
    Type: string
  
    Type: null

- `include_surveys` (optional)
  Type: boolean
  
  Include survey data
  
  default: true

- `include_metadata` (optional)
  Type: boolean
  
  Include sync metadata
  
  default: true

Responses:

- 200: Successful Response

Content type: application/json

Type: object

Pull sync response.

Schema: [SyncService_SyncPullResponseDTO](/api-reference/schemas/syncservice-syncpullresponsedto-9180ff81cc.md)

- `sync_token` (required)
  Type: string

- `surveys` (required)
  Type: array
  
  Items:
    Reference: [SyncService_SurveySyncDTO](/api-reference/schemas/syncservice-surveysyncdto-2daae3b3af.md); Type: object
    
    Survey sync data — a descriptor, not a content channel (D-11).
    
    `schema_hash` is the **server's persisted content address** for this
    version's canonical schema artifact: a 64-character lowercase SHA-256 over
    the canonical UTF-8 JSON bytes. It is forwarded verbatim from survey-service
    and is the value a client verifies against. It is nullable only because a
    legacy version published before the integrity backfill may have none; a
    client must treat a missing value as "cannot be verified", never as
    "trust me".
    
    `questions` and `settings` remain as a **legacy schema fragment**. They are
    not a verifiable artifact (no digest covers them) and mobile ignores them;
    they exist so an older client does not hard-fail on a schema shape it knows.
    Content is fetched from the version's artifact endpoint, not from here.

- `metadata` (required)
  Reference: [SyncService_SyncMetadataDTO](/api-reference/schemas/syncservice-syncmetadatadto-dec4bd83a0.md); Type: object
  
  Sync metadata response.

- `server_timestamp` (required)
  Type: string

- `role` (optional)
  Type: unknown
  
  anyOf:
    Reference: [SyncService_RoleSyncDTO](/api-reference/schemas/syncservice-rolesyncdto-f46d7e73d8.md); Type: object
    
    Role and permissions descriptor for sync pull response.
  
    Type: null

- 422: Validation Error

Content type: application/json

Type: object

Schema: [SyncService_HTTPValidationError](/api-reference/schemas/syncservice-httpvalidationerror-37f685d848.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [SyncService_ValidationError](/api-reference/schemas/syncservice-validationerror-74e4de623a.md); Type: object

## Examples

### cURL

```bash
curl -X POST 'http://localhost:8003/api/v1/sync/pull' \
  -H 'Authorization: Bearer YOUR_TOKEN' \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "device_id": "string",
  "last_sync_token": "string",
  "survey_version": "string",
  "include_surveys": true,
  "include_metadata": true
}'
```

### JavaScript

```javascript
const body = `{
  "device_id": "string",
  "last_sync_token": "string",
  "survey_version": "string",
  "include_surveys": true,
  "include_metadata": true
}`;

const response = await fetch('http://localhost:8003/api/v1/sync/pull', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer YOUR_TOKEN',
    'Content-Type': 'application/json',
  },
  body,
});

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

### Python

```python
import requests

body = '''{
  "device_id": "string",
  "last_sync_token": "string",
  "survey_version": "string",
  "include_surveys": true,
  "include_metadata": true
}'''

response = requests.post(
    'http://localhost:8003/api/v1/sync/pull',
    data=body.encode('utf-8'),
    headers={
        'Authorization': 'Bearer YOUR_TOKEN',
        'Content-Type': 'application/json',
    },
)
print(response.text)
```


## Acknowledge Form Download

`POST /api/v1/sync/downloads/acknowledge`

Record a form download after the mobile client persisted its schema.

Authentication (security requirement alternatives):

```json
[
  {
    "JWT": []
  }
]
```

- JWT: http (bearer). JWT Token Authentication

Request body: application/json (required)

Type: object

Client acknowledgement emitted only after a schema is persisted locally.

Schema: [SyncService_FormDownloadAcknowledgementDTO](/api-reference/schemas/syncservice-formdownloadacknowledgementdto-ad9119ecce.md)

- `survey_id` (required)
  Type: string, uuid

- `survey_version_id` (required)
  Type: string, uuid

- `survey_version` (required)
  Type: string
  
  minLength: 1
  
  maxLength: 100

- `survey_title` (optional)
  Type: unknown
  
  anyOf:
    Type: string
    
    maxLength: 500
  
    Type: null

- `schema_hash` (optional)
  Type: unknown
  
  anyOf:
    Type: string
    
    maxLength: 128
  
    Type: null

- `device_id` (required)
  Type: string
  
  minLength: 1
  
  maxLength: 255

- `download_id` (required)
  Type: string, uuid

- `platform` (optional)
  Type: unknown
  
  anyOf:
    Type: string
    
    maxLength: 50
  
    Type: null

- `app_version` (optional)
  Type: unknown
  
  anyOf:
    Type: string
    
    maxLength: 50
  
    Type: null

- `app_build` (optional)
  Type: unknown
  
  anyOf:
    Type: string
    
    maxLength: 50
  
    Type: null

- `os_version` (optional)
  Type: unknown
  
  anyOf:
    Type: string
    
    maxLength: 255
  
    Type: null

- `persisted_at` (optional)
  Type: unknown
  
  anyOf:
    Type: string, date-time
  
    Type: null

Responses:

- 202: Successful Response

Content type: application/json

Type: unknown

- 422: Validation Error

Content type: application/json

Type: object

Schema: [SyncService_HTTPValidationError](/api-reference/schemas/syncservice-httpvalidationerror-37f685d848.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [SyncService_ValidationError](/api-reference/schemas/syncservice-validationerror-74e4de623a.md); Type: object

## Examples

### cURL

```bash
curl -X POST 'http://localhost:8003/api/v1/sync/downloads/acknowledge' \
  -H 'Authorization: Bearer YOUR_TOKEN' \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "survey_id": "550e8400-e29b-41d4-a716-446655440000",
  "survey_version_id": "550e8400-e29b-41d4-a716-446655440000",
  "survey_version": "string",
  "survey_title": "string",
  "schema_hash": "string",
  "device_id": "string",
  "download_id": "550e8400-e29b-41d4-a716-446655440000",
  "platform": "string",
  "app_version": "string",
  "app_build": "string",
  "os_version": "string",
  "persisted_at": "2024-01-15T09:30:00Z"
}'
```

### JavaScript

```javascript
const body = `{
  "survey_id": "550e8400-e29b-41d4-a716-446655440000",
  "survey_version_id": "550e8400-e29b-41d4-a716-446655440000",
  "survey_version": "string",
  "survey_title": "string",
  "schema_hash": "string",
  "device_id": "string",
  "download_id": "550e8400-e29b-41d4-a716-446655440000",
  "platform": "string",
  "app_version": "string",
  "app_build": "string",
  "os_version": "string",
  "persisted_at": "2024-01-15T09:30:00Z"
}`;

const response = await fetch('http://localhost:8003/api/v1/sync/downloads/acknowledge', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer YOUR_TOKEN',
    'Content-Type': 'application/json',
  },
  body,
});

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

### Python

```python
import requests

body = '''{
  "survey_id": "550e8400-e29b-41d4-a716-446655440000",
  "survey_version_id": "550e8400-e29b-41d4-a716-446655440000",
  "survey_version": "string",
  "survey_title": "string",
  "schema_hash": "string",
  "device_id": "string",
  "download_id": "550e8400-e29b-41d4-a716-446655440000",
  "platform": "string",
  "app_version": "string",
  "app_build": "string",
  "os_version": "string",
  "persisted_at": "2024-01-15T09:30:00Z"
}'''

response = requests.post(
    'http://localhost:8003/api/v1/sync/downloads/acknowledge',
    data=body.encode('utf-8'),
    headers={
        'Authorization': 'Bearer YOUR_TOKEN',
        'Content-Type': 'application/json',
    },
)
print(response.text)
```


## Get Sync Status

`GET /api/v1/sync/status`

Get sync status for all devices of the current user.

Authentication (security requirement alternatives):

```json
[
  {
    "JWT": []
  }
]
```

- JWT: http (bearer). JWT Token Authentication

Responses:

- 200: Successful Response

Content type: application/json

Type: array

Items:
  Reference: [SyncService_SyncStatusDTO](/api-reference/schemas/syncservice-syncstatusdto-ca2dadecbc.md); Type: object
  
  Sync status response.

## Examples

### cURL

```bash
curl -X GET 'http://localhost:8003/api/v1/sync/status' \
  -H 'Authorization: Bearer YOUR_TOKEN'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8003/api/v1/sync/status', {
  method: 'GET',
  headers: {
    'Authorization': 'Bearer YOUR_TOKEN',
  },
});

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

### Python

```python
import requests

response = requests.get(
    'http://localhost:8003/api/v1/sync/status',
    headers={
        'Authorization': 'Bearer YOUR_TOKEN',
    },
)
print(response.text)
```


## Get Device Sync Status

`GET /api/v1/sync/status/{device_id}`

Get sync status for a specific device.

Authentication (security requirement alternatives):

```json
[
  {
    "JWT": []
  }
]
```

- JWT: http (bearer). JWT Token Authentication

Parameters:

- `device_id` (path, string, required)
  Type: string

Responses:

- 200: Successful Response

Content type: application/json

Type: object

Sync status response.

Schema: [SyncService_SyncStatusDTO](/api-reference/schemas/syncservice-syncstatusdto-ca2dadecbc.md)

- `device_id` (required)
  Type: string

- `last_sync_at` (optional)
  Type: unknown
  
  anyOf:
    Type: string, date-time
  
    Type: null

- `sync_status` (required)
  Type: string

- `last_survey_sync_at` (optional)
  Type: unknown
  
  anyOf:
    Type: string, date-time
  
    Type: null

- `last_response_sync_at` (optional)
  Type: unknown
  
  anyOf:
    Type: string, date-time
  
    Type: null

- `sync_token` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `surveys_synced` (optional)
  Type: integer
  
  default: 0

- `responses_synced` (optional)
  Type: integer
  
  default: 0

- `server_time` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `server_time_offset` (optional)
  Type: unknown
  
  default: 0
  
  anyOf:
    Type: integer
  
    Type: null

- `rid_blocks` (optional)
  Type: array
  
  Items:
    Type: object
    
    Additional properties: true

- 422: Validation Error

Content type: application/json

Type: object

Schema: [SyncService_HTTPValidationError](/api-reference/schemas/syncservice-httpvalidationerror-37f685d848.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [SyncService_ValidationError](/api-reference/schemas/syncservice-validationerror-74e4de623a.md); Type: object

## Examples

### cURL

```bash
curl -X GET 'http://localhost:8003/api/v1/sync/status/string' \
  -H 'Authorization: Bearer YOUR_TOKEN'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8003/api/v1/sync/status/string', {
  method: 'GET',
  headers: {
    'Authorization': 'Bearer YOUR_TOKEN',
  },
});

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

### Python

```python
import requests

response = requests.get(
    'http://localhost:8003/api/v1/sync/status/string',
    headers={
        'Authorization': 'Bearer YOUR_TOKEN',
    },
)
print(response.text)
```


## Initialize Sync

`POST /api/v1/sync/initialize`

Initialize sync for a new device.

Authentication (security requirement alternatives):

```json
[
  {
    "JWT": []
  }
]
```

- JWT: http (bearer). JWT Token Authentication

Request body: application/json (required)

Type: object

Initial sync request.

Schema: [SyncService_InitialSyncRequestDTO](/api-reference/schemas/syncservice-initialsyncrequestdto-46a37d29a1.md)

- `device_id` (required)
  Type: string
  
  minLength: 1
  
  maxLength: 255

- `platform` (optional)
  Type: unknown
  
  Device platform
  
  default: "unknown"
  
  anyOf:
    Type: string
  
    Type: null

Responses:

- 200: Successful Response

Content type: application/json

Type: object

Sync status response.

Schema: [SyncService_SyncStatusDTO](/api-reference/schemas/syncservice-syncstatusdto-ca2dadecbc.md)

- `device_id` (required)
  Type: string

- `last_sync_at` (optional)
  Type: unknown
  
  anyOf:
    Type: string, date-time
  
    Type: null

- `sync_status` (required)
  Type: string

- `last_survey_sync_at` (optional)
  Type: unknown
  
  anyOf:
    Type: string, date-time
  
    Type: null

- `last_response_sync_at` (optional)
  Type: unknown
  
  anyOf:
    Type: string, date-time
  
    Type: null

- `sync_token` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `surveys_synced` (optional)
  Type: integer
  
  default: 0

- `responses_synced` (optional)
  Type: integer
  
  default: 0

- `server_time` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `server_time_offset` (optional)
  Type: unknown
  
  default: 0
  
  anyOf:
    Type: integer
  
    Type: null

- `rid_blocks` (optional)
  Type: array
  
  Items:
    Type: object
    
    Additional properties: true

- 422: Validation Error

Content type: application/json

Type: object

Schema: [SyncService_HTTPValidationError](/api-reference/schemas/syncservice-httpvalidationerror-37f685d848.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [SyncService_ValidationError](/api-reference/schemas/syncservice-validationerror-74e4de623a.md); Type: object

## Examples

### cURL

```bash
curl -X POST 'http://localhost:8003/api/v1/sync/initialize' \
  -H 'Authorization: Bearer YOUR_TOKEN' \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "device_id": "string",
  "platform": "unknown"
}'
```

### JavaScript

```javascript
const body = `{
  "device_id": "string",
  "platform": "unknown"
}`;

const response = await fetch('http://localhost:8003/api/v1/sync/initialize', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer YOUR_TOKEN',
    'Content-Type': 'application/json',
  },
  body,
});

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

### Python

```python
import requests

body = '''{
  "device_id": "string",
  "platform": "unknown"
}'''

response = requests.post(
    'http://localhost:8003/api/v1/sync/initialize',
    data=body.encode('utf-8'),
    headers={
        'Authorization': 'Bearer YOUR_TOKEN',
        'Content-Type': 'application/json',
    },
)
print(response.text)
```


## Delete Device Sync

`DELETE /api/v1/sync/device/{device_id}`

Delete sync record for a device.

Authentication (security requirement alternatives):

```json
[
  {
    "JWT": []
  }
]
```

- JWT: http (bearer). JWT Token Authentication

Parameters:

- `device_id` (path, string, required)
  Type: string

Responses:

- 204: Successful Response

- 422: Validation Error

Content type: application/json

Type: object

Schema: [SyncService_HTTPValidationError](/api-reference/schemas/syncservice-httpvalidationerror-37f685d848.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [SyncService_ValidationError](/api-reference/schemas/syncservice-validationerror-74e4de623a.md); Type: object

## Examples

### cURL

```bash
curl -X DELETE 'http://localhost:8003/api/v1/sync/device/string' \
  -H 'Authorization: Bearer YOUR_TOKEN'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8003/api/v1/sync/device/string', {
  method: 'DELETE',
  headers: {
    'Authorization': 'Bearer YOUR_TOKEN',
  },
});

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

### Python

```python
import requests

response = requests.delete(
    'http://localhost:8003/api/v1/sync/device/string',
    headers={
        'Authorization': 'Bearer YOUR_TOKEN',
    },
)
print(response.text)
```


## Push Single Response

`POST /api/v1/sync/push`

Push a single survey response to the server.

- Idempotent: Same idempotency_key returns same result
- Persists record before forwarding to data-service
- Returns push record ID for tracking

Authentication (security requirement alternatives):

```json
[
  {
    "JWT": []
  }
]
```

- JWT: http (bearer). JWT Token Authentication

Request body: application/json (required)

Type: object

Push sync request for single response.

Schema: [SyncService_SyncPushRequestDTO](/api-reference/schemas/syncservice-syncpushrequestdto-7adf1d0ea0.md)

- `idempotency_key` (required)
  Type: string
  
  Unique key for idempotency
  
  minLength: 1
  
  maxLength: 255

- `survey_id` (required)
  Type: string, uuid
  
  Survey ID

- `survey_version_id` (optional)
  Type: unknown
  
  Survey version ID for version-pinned response
  
  anyOf:
    Type: string, uuid
  
    Type: null

- `interview_id` (optional)
  Type: unknown
  
  Interview execution ID — links this response to its interview lifecycle (Track A)
  
  anyOf:
    Type: string, uuid
  
    Type: null

- `interview_rid` (optional)
  Type: unknown
  
  Response RID allocated for interview
  
  anyOf:
    Type: string
    
    maxLength: 255
  
    Type: null

- `respondent_id` (optional)
  Type: unknown
  
  Respondent identifier
  
  anyOf:
    Type: string
    
    maxLength: 255
  
    Type: null

- `answers` (required)
  Type: array
  
  Survey answers
  
  Items:
    Reference: [SyncService_ResponseAnswerDTO](/api-reference/schemas/syncservice-responseanswerdto-61c896b1aa.md); Type: object
    
    Response answer data.

- `metadata` (optional)
  Type: unknown
  
  Additional metadata
  
  anyOf:
    Type: object
    
    Additional properties: true
  
    Type: null

- `device_id` (required)
  Type: string
  
  Device that collected the response
  
  minLength: 1
  
  maxLength: 255

- `collected_at` (optional)
  Type: unknown
  
  When response was collected on device
  
  anyOf:
    Type: string, date-time
  
    Type: null

- `response_language` (optional)
  Type: unknown
  
  Language code used for submission (e.g., 'en', 'es')
  
  anyOf:
    Type: string
    
    maxLength: 10
  
    Type: null

- `submission_mode` (optional)
  Type: unknown
  
  Submission mode: 'complete', 'terminated_partial', or 'draft'
  
  anyOf:
    Type: string
  
    Type: null

Responses:

- 202: Successful Response

Content type: application/json

Type: object

Push sync response.

Schema: [SyncService_SyncPushResponseDTO](/api-reference/schemas/syncservice-syncpushresponsedto-4f0c60b804.md)

- `id` (required)
  Type: string

- `idempotency_key` (required)
  Type: string

- `status` (required)
  Type: string

- `response_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `created_at` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `lifecycle_code` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- 422: Validation Error

Content type: application/json

Type: object

Schema: [SyncService_HTTPValidationError](/api-reference/schemas/syncservice-httpvalidationerror-37f685d848.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [SyncService_ValidationError](/api-reference/schemas/syncservice-validationerror-74e4de623a.md); Type: object

## Examples

### cURL

```bash
curl -X POST 'http://localhost:8003/api/v1/sync/push' \
  -H 'Authorization: Bearer YOUR_TOKEN' \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "idempotency_key": "string",
  "survey_id": "550e8400-e29b-41d4-a716-446655440000",
  "survey_version_id": "550e8400-e29b-41d4-a716-446655440000",
  "interview_id": "550e8400-e29b-41d4-a716-446655440000",
  "interview_rid": "string",
  "respondent_id": "string",
  "answers": [
    {
      "question_id": "string"
    }
  ],
  "metadata": {},
  "device_id": "string",
  "collected_at": "2024-01-15T09:30:00Z",
  "response_language": "string",
  "submission_mode": "string"
}'
```

### JavaScript

```javascript
const body = `{
  "idempotency_key": "string",
  "survey_id": "550e8400-e29b-41d4-a716-446655440000",
  "survey_version_id": "550e8400-e29b-41d4-a716-446655440000",
  "interview_id": "550e8400-e29b-41d4-a716-446655440000",
  "interview_rid": "string",
  "respondent_id": "string",
  "answers": [
    {
      "question_id": "string"
    }
  ],
  "metadata": {},
  "device_id": "string",
  "collected_at": "2024-01-15T09:30:00Z",
  "response_language": "string",
  "submission_mode": "string"
}`;

const response = await fetch('http://localhost:8003/api/v1/sync/push', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer YOUR_TOKEN',
    'Content-Type': 'application/json',
  },
  body,
});

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

### Python

```python
import requests

body = '''{
  "idempotency_key": "string",
  "survey_id": "550e8400-e29b-41d4-a716-446655440000",
  "survey_version_id": "550e8400-e29b-41d4-a716-446655440000",
  "interview_id": "550e8400-e29b-41d4-a716-446655440000",
  "interview_rid": "string",
  "respondent_id": "string",
  "answers": [
    {
      "question_id": "string"
    }
  ],
  "metadata": {},
  "device_id": "string",
  "collected_at": "2024-01-15T09:30:00Z",
  "response_language": "string",
  "submission_mode": "string"
}'''

response = requests.post(
    'http://localhost:8003/api/v1/sync/push',
    data=body.encode('utf-8'),
    headers={
        'Authorization': 'Bearer YOUR_TOKEN',
        'Content-Type': 'application/json',
    },
)
print(response.text)
```


## Push Bulk Responses

`POST /api/v1/sync/push/bulk`

Push multiple survey responses in a batch.

- Max 50 responses per batch
- Partial success: Failed items don't block successful ones
- Idempotent per item
- Persists each record

Authentication (security requirement alternatives):

```json
[
  {
    "JWT": []
  }
]
```

- JWT: http (bearer). JWT Token Authentication

Request body: application/json (required)

Type: object

Bulk push sync request.

Schema: [SyncService_BulkSyncPushRequestDTO](/api-reference/schemas/syncservice-bulksyncpushrequestdto-2e2a495459.md)

- `responses` (required)
  Type: array
  
  Max 50 responses per batch
  
  maxItems: 50
  
  Items:
    Reference: [SyncService_SyncPushRequestDTO](/api-reference/schemas/syncservice-syncpushrequestdto-7adf1d0ea0.md); Type: object
    
    Push sync request for single response.

Responses:

- 202: Successful Response

Content type: application/json

Type: object

Bulk push sync response.

Schema: [SyncService_BulkSyncPushResponseDTO](/api-reference/schemas/syncservice-bulksyncpushresponsedto-256c360ea3.md)

- `total` (required)
  Type: integer

- `accepted` (required)
  Type: integer

- `rejected` (required)
  Type: integer

- `results` (required)
  Type: array
  
  Items:
    Reference: [SyncService_SyncPushResponseDTO](/api-reference/schemas/syncservice-syncpushresponsedto-4f0c60b804.md); Type: object
    
    Push sync response.

- 422: Validation Error

Content type: application/json

Type: object

Schema: [SyncService_HTTPValidationError](/api-reference/schemas/syncservice-httpvalidationerror-37f685d848.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [SyncService_ValidationError](/api-reference/schemas/syncservice-validationerror-74e4de623a.md); Type: object

## Examples

### cURL

```bash
curl -X POST 'http://localhost:8003/api/v1/sync/push/bulk' \
  -H 'Authorization: Bearer YOUR_TOKEN' \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "responses": [
    {
      "idempotency_key": "string",
      "survey_id": "550e8400-e29b-41d4-a716-446655440000",
      "survey_version_id": "550e8400-e29b-41d4-a716-446655440000",
      "interview_id": "550e8400-e29b-41d4-a716-446655440000",
      "interview_rid": "string",
      "respondent_id": "string",
      "answers": [
        {
          "question_id": "string"
        }
      ],
      "metadata": {},
      "device_id": "string",
      "collected_at": "2024-01-15T09:30:00Z",
      "response_language": "string",
      "submission_mode": "string"
    }
  ]
}'
```

### JavaScript

```javascript
const body = `{
  "responses": [
    {
      "idempotency_key": "string",
      "survey_id": "550e8400-e29b-41d4-a716-446655440000",
      "survey_version_id": "550e8400-e29b-41d4-a716-446655440000",
      "interview_id": "550e8400-e29b-41d4-a716-446655440000",
      "interview_rid": "string",
      "respondent_id": "string",
      "answers": [
        {
          "question_id": "string"
        }
      ],
      "metadata": {},
      "device_id": "string",
      "collected_at": "2024-01-15T09:30:00Z",
      "response_language": "string",
      "submission_mode": "string"
    }
  ]
}`;

const response = await fetch('http://localhost:8003/api/v1/sync/push/bulk', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer YOUR_TOKEN',
    'Content-Type': 'application/json',
  },
  body,
});

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

### Python

```python
import requests

body = '''{
  "responses": [
    {
      "idempotency_key": "string",
      "survey_id": "550e8400-e29b-41d4-a716-446655440000",
      "survey_version_id": "550e8400-e29b-41d4-a716-446655440000",
      "interview_id": "550e8400-e29b-41d4-a716-446655440000",
      "interview_rid": "string",
      "respondent_id": "string",
      "answers": [
        {
          "question_id": "string"
        }
      ],
      "metadata": {},
      "device_id": "string",
      "collected_at": "2024-01-15T09:30:00Z",
      "response_language": "string",
      "submission_mode": "string"
    }
  ]
}'''

response = requests.post(
    'http://localhost:8003/api/v1/sync/push/bulk',
    data=body.encode('utf-8'),
    headers={
        'Authorization': 'Bearer YOUR_TOKEN',
        'Content-Type': 'application/json',
    },
)
print(response.text)
```


## Get Push Status

`GET /api/v1/sync/push/status/{push_id}`

Get status of a push operation.

Authentication (security requirement alternatives):

```json
[
  {
    "JWT": []
  }
]
```

- JWT: http (bearer). JWT Token Authentication

Parameters:

- `push_id` (path, string, required)
  Type: string

Responses:

- 200: Successful Response

Content type: application/json

Type: object

Push sync response.

Schema: [SyncService_SyncPushResponseDTO](/api-reference/schemas/syncservice-syncpushresponsedto-4f0c60b804.md)

- `id` (required)
  Type: string

- `idempotency_key` (required)
  Type: string

- `status` (required)
  Type: string

- `response_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `created_at` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `lifecycle_code` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- 422: Validation Error

Content type: application/json

Type: object

Schema: [SyncService_HTTPValidationError](/api-reference/schemas/syncservice-httpvalidationerror-37f685d848.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [SyncService_ValidationError](/api-reference/schemas/syncservice-validationerror-74e4de623a.md); Type: object

## Examples

### cURL

```bash
curl -X GET 'http://localhost:8003/api/v1/sync/push/status/string' \
  -H 'Authorization: Bearer YOUR_TOKEN'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8003/api/v1/sync/push/status/string', {
  method: 'GET',
  headers: {
    'Authorization': 'Bearer YOUR_TOKEN',
  },
});

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

### Python

```python
import requests

response = requests.get(
    'http://localhost:8003/api/v1/sync/push/status/string',
    headers={
        'Authorization': 'Bearer YOUR_TOKEN',
    },
)
print(response.text)
```


## Get Pending Pushes

`GET /api/v1/sync/push/pending`

Get all pending/failed push operations for retry.

Authentication (security requirement alternatives):

```json
[
  {
    "JWT": []
  }
]
```

- JWT: http (bearer). JWT Token Authentication

Responses:

- 200: Successful Response

Content type: application/json

Type: array

Items:
  Reference: [SyncService_SyncPushResponseDTO](/api-reference/schemas/syncservice-syncpushresponsedto-4f0c60b804.md); Type: object
  
  Push sync response.

## Examples

### cURL

```bash
curl -X GET 'http://localhost:8003/api/v1/sync/push/pending' \
  -H 'Authorization: Bearer YOUR_TOKEN'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8003/api/v1/sync/push/pending', {
  method: 'GET',
  headers: {
    'Authorization': 'Bearer YOUR_TOKEN',
  },
});

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

### Python

```python
import requests

response = requests.get(
    'http://localhost:8003/api/v1/sync/push/pending',
    headers={
        'Authorization': 'Bearer YOUR_TOKEN',
    },
)
print(response.text)
```


## Get Failed Submissions Today

`GET /api/v1/sync/dashboard/failed-submissions`

Get count of failed submission attempts today.

Counts FAILED and CONFLICT status push records created on or after the
start of the effective-IANA local calendar day. ``timezone_context``
selects the zone; invalid values fall back to UTC. This provides accurate
failed-submission metrics for the Operations Center dashboard.

Authentication (security requirement alternatives):

```json
[
  {
    "JWT": []
  }
]
```

- JWT: http (bearer). JWT Token Authentication

Parameters:

- `timezone_context` (query, unknown, optional) - IANA timezone for the 'today' boundary
  Type: unknown
  
  IANA timezone for the 'today' boundary
  
  anyOf:
    Type: string
  
    Type: null

Responses:

- 200: Successful Response

Content type: application/json

Type: object

Schema: [SyncService_FailedSubmissionsDTO](/api-reference/schemas/syncservice-failedsubmissionsdto-896a4a5dd6.md)

- `count` (required)
  Type: integer

- 422: Validation Error

Content type: application/json

Type: object

Schema: [SyncService_HTTPValidationError](/api-reference/schemas/syncservice-httpvalidationerror-37f685d848.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [SyncService_ValidationError](/api-reference/schemas/syncservice-validationerror-74e4de623a.md); Type: object

## Examples

### cURL

```bash
curl -X GET 'http://localhost:8003/api/v1/sync/dashboard/failed-submissions' \
  -H 'Authorization: Bearer YOUR_TOKEN'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8003/api/v1/sync/dashboard/failed-submissions', {
  method: 'GET',
  headers: {
    'Authorization': 'Bearer YOUR_TOKEN',
  },
});

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

### Python

```python
import requests

response = requests.get(
    'http://localhost:8003/api/v1/sync/dashboard/failed-submissions',
    headers={
        'Authorization': 'Bearer YOUR_TOKEN',
    },
)
print(response.text)
```


## List Unresolved Conflicts

`GET /api/v1/sync/conflicts`

Get all unresolved sync conflicts for the tenant.

Authentication (security requirement alternatives):

```json
[
  {
    "JWT": []
  }
]
```

- JWT: http (bearer). JWT Token Authentication

Responses:

- 200: Successful Response

Content type: application/json

Type: object

List of sync conflicts.

Schema: [SyncService_ConflictListDTO](/api-reference/schemas/syncservice-conflictlistdto-20ab3ce8f0.md)

- `items` (required)
  Type: array
  
  Items:
    Reference: [SyncService_ConflictDTO](/api-reference/schemas/syncservice-conflictdto-f94912064e.md); Type: object
    
    Sync conflict information.

- `total` (required)
  Type: integer

- `skip` (optional)
  Type: integer
  
  default: 0

- `limit` (optional)
  Type: integer
  
  default: 100

- `has_next` (optional)
  Type: boolean
  
  default: false

- `has_previous` (optional)
  Type: boolean
  
  default: false

## Examples

### cURL

```bash
curl -X GET 'http://localhost:8003/api/v1/sync/conflicts' \
  -H 'Authorization: Bearer YOUR_TOKEN'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8003/api/v1/sync/conflicts', {
  method: 'GET',
  headers: {
    'Authorization': 'Bearer YOUR_TOKEN',
  },
});

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

### Python

```python
import requests

response = requests.get(
    'http://localhost:8003/api/v1/sync/conflicts',
    headers={
        'Authorization': 'Bearer YOUR_TOKEN',
    },
)
print(response.text)
```


## Get Conflict

`GET /api/v1/sync/conflicts/{conflict_id}`

Get a specific conflict by ID.

Authentication (security requirement alternatives):

```json
[
  {
    "JWT": []
  }
]
```

- JWT: http (bearer). JWT Token Authentication

Parameters:

- `conflict_id` (path, string, required)
  Type: string

Responses:

- 200: Successful Response

Content type: application/json

Type: object

Sync conflict information.

Schema: [SyncService_ConflictDTO](/api-reference/schemas/syncservice-conflictdto-f94912064e.md)

- `id` (required)
  Type: string, uuid

- `tenant_id` (required)
  Type: string, uuid

- `device_id` (required)
  Type: string

- `response_id` (required)
  Type: string

- `conflict_type` (required)
  Type: string

- `server_version` (optional)
  Type: unknown
  
  anyOf:
    Type: object
    
    Additional properties: true
  
    Type: null

- `client_version` (optional)
  Type: unknown
  
  anyOf:
    Type: object
    
    Additional properties: true
  
    Type: null

- `resolution` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `resolved_at` (optional)
  Type: unknown
  
  anyOf:
    Type: string, date-time
  
    Type: null

- `resolved_by` (optional)
  Type: unknown
  
  anyOf:
    Type: string, uuid
  
    Type: null

- `created_at` (required)
  Type: string, date-time

- 422: Validation Error

Content type: application/json

Type: object

Schema: [SyncService_HTTPValidationError](/api-reference/schemas/syncservice-httpvalidationerror-37f685d848.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [SyncService_ValidationError](/api-reference/schemas/syncservice-validationerror-74e4de623a.md); Type: object

## Examples

### cURL

```bash
curl -X GET 'http://localhost:8003/api/v1/sync/conflicts/string' \
  -H 'Authorization: Bearer YOUR_TOKEN'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8003/api/v1/sync/conflicts/string', {
  method: 'GET',
  headers: {
    'Authorization': 'Bearer YOUR_TOKEN',
  },
});

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

### Python

```python
import requests

response = requests.get(
    'http://localhost:8003/api/v1/sync/conflicts/string',
    headers={
        'Authorization': 'Bearer YOUR_TOKEN',
    },
)
print(response.text)
```


## Resolve Conflict

`POST /api/v1/sync/conflicts/{conflict_id}/resolve`

Resolve a sync conflict using a specified strategy (server_wins, client_wins).

Authentication (security requirement alternatives):

```json
[
  {
    "JWT": []
  }
]
```

- JWT: http (bearer). JWT Token Authentication

Parameters:

- `conflict_id` (path, string, required)
  Type: string

Request body: application/json (required)

Type: object

Request to resolve a sync conflict.

Schema: [SyncService_ConflictResolutionRequestDTO](/api-reference/schemas/syncservice-conflictresolutionrequestdto-bad7c04c2f.md)

- `strategy` (required)
  Type: string
  
  Resolution strategy: server_wins, client_wins, or manual

- `merged_data` (optional)
  Type: unknown
  
  Merged data if manual strategy is used
  
  anyOf:
    Type: object
    
    Additional properties: true
  
    Type: null

Responses:

- 200: Successful Response

Content type: application/json

Type: unknown

- 422: Validation Error

Content type: application/json

Type: object

Schema: [SyncService_HTTPValidationError](/api-reference/schemas/syncservice-httpvalidationerror-37f685d848.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [SyncService_ValidationError](/api-reference/schemas/syncservice-validationerror-74e4de623a.md); Type: object

## Examples

### cURL

```bash
curl -X POST 'http://localhost:8003/api/v1/sync/conflicts/string/resolve' \
  -H 'Authorization: Bearer YOUR_TOKEN' \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "strategy": "string",
  "merged_data": {}
}'
```

### JavaScript

```javascript
const body = `{
  "strategy": "string",
  "merged_data": {}
}`;

const response = await fetch('http://localhost:8003/api/v1/sync/conflicts/string/resolve', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer YOUR_TOKEN',
    'Content-Type': 'application/json',
  },
  body,
});

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

### Python

```python
import requests

body = '''{
  "strategy": "string",
  "merged_data": {}
}'''

response = requests.post(
    'http://localhost:8003/api/v1/sync/conflicts/string/resolve',
    data=body.encode('utf-8'),
    headers={
        'Authorization': 'Bearer YOUR_TOKEN',
        'Content-Type': 'application/json',
    },
)
print(response.text)
```


## List Response Changes

`GET /api/v1/sync/responses/changes`

Discover response status/answer-schema changes since a client-held cursor.

Authentication (security requirement alternatives):

```json
[
  {
    "JWT": []
  }
]
```

- JWT: http (bearer). JWT Token Authentication

Parameters:

- `since` (query, string, optional) - Watermark returned by a previous page; held and resent by the client
  Type: string
  
  Watermark returned by a previous page; held and resent by the client
  
  default: "0"

- `limit` (query, integer, optional)
  Type: integer
  
  default: 100
  
  minimum: 1
  
  maximum: 1000

Responses:

- 200: Successful Response

Content type: application/json

Type: unknown

- 422: Validation Error

Content type: application/json

Type: object

Schema: [SyncService_HTTPValidationError](/api-reference/schemas/syncservice-httpvalidationerror-37f685d848.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [SyncService_ValidationError](/api-reference/schemas/syncservice-validationerror-74e4de623a.md); Type: object

## Examples

### cURL

```bash
curl -X GET 'http://localhost:8003/api/v1/sync/responses/changes?since=0&limit=100' \
  -H 'Authorization: Bearer YOUR_TOKEN'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8003/api/v1/sync/responses/changes?since=0&limit=100', {
  method: 'GET',
  headers: {
    'Authorization': 'Bearer YOUR_TOKEN',
  },
});

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

### Python

```python
import requests

response = requests.get(
    'http://localhost:8003/api/v1/sync/responses/changes?since=0&limit=100',
    headers={
        'Authorization': 'Bearer YOUR_TOKEN',
    },
)
print(response.text)
```


## Correct Response

`POST /api/v1/sync/responses/{response_id}/correct`

Resubmit a corrected (previously rejected) response against its existing ID.

Authentication (security requirement alternatives):

```json
[
  {
    "JWT": []
  }
]
```

- JWT: http (bearer). JWT Token Authentication

Parameters:

- `response_id` (path, string, uuid, required)
  Type: string, uuid

Responses:

- 200: Successful Response

Content type: application/json

Type: unknown

- 422: Validation Error

Content type: application/json

Type: object

Schema: [SyncService_HTTPValidationError](/api-reference/schemas/syncservice-httpvalidationerror-37f685d848.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [SyncService_ValidationError](/api-reference/schemas/syncservice-validationerror-74e4de623a.md); Type: object

## Examples

### cURL

```bash
curl -X POST 'http://localhost:8003/api/v1/sync/responses/550e8400-e29b-41d4-a716-446655440000/correct' \
  -H 'Authorization: Bearer YOUR_TOKEN'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8003/api/v1/sync/responses/550e8400-e29b-41d4-a716-446655440000/correct', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer YOUR_TOKEN',
  },
});

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

### Python

```python
import requests

response = requests.post(
    'http://localhost:8003/api/v1/sync/responses/550e8400-e29b-41d4-a716-446655440000/correct',
    headers={
        'Authorization': 'Bearer YOUR_TOKEN',
    },
)
print(response.text)
```


## Reconcile Revoked Work

`POST /api/v1/sync/reconcile`

Server-Authorized Reconciliation Endpoint (R17 & R22).

Validates that responses collected prior to access revocation are legitimate
and eligible for governed ingestion. Rejects responses collected after revocation
or collected without assignment with HTTP 403 Forbidden.

Authentication (security requirement alternatives):

```json
[
  {
    "JWT": []
  }
]
```

- JWT: http (bearer). JWT Token Authentication

Request body: application/json (required)

Type: object

Server-authorized reconciliation request for responses predating access revocation (R17 & R22).

Schema: [SyncService_SyncReconciliationRequestDTO](/api-reference/schemas/syncservice-syncreconciliationrequestdto-1c0ada8e5e.md)

- `intent` (required)
  Type: string
  
  Explicit intent: must be 'reconcile_revoked_work'

- `idempotency_key` (required)
  Type: string
  
  Unique key for idempotency
  
  minLength: 1
  
  maxLength: 255

- `survey_id` (required)
  Type: string, uuid
  
  Survey ID

- `survey_version_id` (optional)
  Type: unknown
  
  Survey version ID for version pinning
  
  anyOf:
    Type: string, uuid
  
    Type: null

- `device_id` (required)
  Type: string
  
  Device that collected the response
  
  minLength: 1
  
  maxLength: 255

- `collected_at` (required)
  Type: string, date-time
  
  Device-reported capture timestamp (mandatory for reconciliation)

- `answers` (required)
  Type: array
  
  Survey answers
  
  Items:
    Reference: [SyncService_ResponseAnswerDTO](/api-reference/schemas/syncservice-responseanswerdto-61c896b1aa.md); Type: object
    
    Response answer data.

- `respondent_id` (optional)
  Type: unknown
  
  Respondent identifier
  
  anyOf:
    Type: string
    
    maxLength: 255
  
    Type: null

- `interview_id` (optional)
  Type: unknown
  
  Interview execution ID
  
  anyOf:
    Type: string, uuid
  
    Type: null

- `interview_rid` (optional)
  Type: unknown
  
  Allocated RID
  
  anyOf:
    Type: string
    
    maxLength: 255
  
    Type: null

- `metadata` (optional)
  Type: unknown
  
  Additional metadata
  
  anyOf:
    Type: object
    
    Additional properties: true
  
    Type: null

- `response_language` (optional)
  Type: unknown
  
  Language code
  
  anyOf:
    Type: string
    
    maxLength: 10
  
    Type: null

- `submission_mode` (optional)
  Type: unknown
  
  Submission mode: 'complete' or 'terminated_partial'
  
  default: "complete"
  
  anyOf:
    Type: string
  
    Type: null

- `duration_seconds` (optional)
  Type: unknown
  
  Duration in seconds
  
  anyOf:
    Type: integer
    
    minimum: 0
  
    Type: null

- `sync_batch_id` (optional)
  Type: unknown
  
  Batch ID
  
  anyOf:
    Type: string, uuid
  
    Type: null

Responses:

- 200: Successful Response

Content type: application/json

Type: object

Server-authorized reconciliation response.

Schema: [SyncService_SyncReconciliationResponseDTO](/api-reference/schemas/syncservice-syncreconciliationresponsedto-207ca37ffc.md)

- `status` (required)
  Type: string
  
  'reconciled', 'duplicate', or 'rejected'

- `response_id` (optional)
  Type: unknown
  
  Persisted SurveyResponse ID in data-service
  
  anyOf:
    Type: string
  
    Type: null

- `reconciliation_grant_id` (optional)
  Type: unknown
  
  Historical grant UUID that authorized this work
  
  anyOf:
    Type: string
  
    Type: null

- `reconciled_at` (optional)
  Type: unknown
  
  ISO timestamp when reconciliation completed
  
  anyOf:
    Type: string
  
    Type: null

- `reason` (optional)
  Type: unknown
  
  Reason code if rejected (e.g. 'work_postdates_revocation', 'user_never_assigned')
  
  anyOf:
    Type: string
  
    Type: null

- `message` (required)
  Type: string
  
  Human-readable status summary

- 422: Validation Error

Content type: application/json

Type: object

Schema: [SyncService_HTTPValidationError](/api-reference/schemas/syncservice-httpvalidationerror-37f685d848.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [SyncService_ValidationError](/api-reference/schemas/syncservice-validationerror-74e4de623a.md); Type: object

## Examples

### cURL

```bash
curl -X POST 'http://localhost:8003/api/v1/sync/reconcile' \
  -H 'Authorization: Bearer YOUR_TOKEN' \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "intent": "string",
  "idempotency_key": "string",
  "survey_id": "550e8400-e29b-41d4-a716-446655440000",
  "survey_version_id": "550e8400-e29b-41d4-a716-446655440000",
  "device_id": "string",
  "collected_at": "2024-01-15T09:30:00Z",
  "answers": [
    {
      "question_id": "string"
    }
  ],
  "respondent_id": "string",
  "interview_id": "550e8400-e29b-41d4-a716-446655440000",
  "interview_rid": "string",
  "metadata": {},
  "response_language": "string",
  "submission_mode": "complete",
  "duration_seconds": 0,
  "sync_batch_id": "550e8400-e29b-41d4-a716-446655440000"
}'
```

### JavaScript

```javascript
const body = `{
  "intent": "string",
  "idempotency_key": "string",
  "survey_id": "550e8400-e29b-41d4-a716-446655440000",
  "survey_version_id": "550e8400-e29b-41d4-a716-446655440000",
  "device_id": "string",
  "collected_at": "2024-01-15T09:30:00Z",
  "answers": [
    {
      "question_id": "string"
    }
  ],
  "respondent_id": "string",
  "interview_id": "550e8400-e29b-41d4-a716-446655440000",
  "interview_rid": "string",
  "metadata": {},
  "response_language": "string",
  "submission_mode": "complete",
  "duration_seconds": 0,
  "sync_batch_id": "550e8400-e29b-41d4-a716-446655440000"
}`;

const response = await fetch('http://localhost:8003/api/v1/sync/reconcile', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer YOUR_TOKEN',
    'Content-Type': 'application/json',
  },
  body,
});

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

### Python

```python
import requests

body = '''{
  "intent": "string",
  "idempotency_key": "string",
  "survey_id": "550e8400-e29b-41d4-a716-446655440000",
  "survey_version_id": "550e8400-e29b-41d4-a716-446655440000",
  "device_id": "string",
  "collected_at": "2024-01-15T09:30:00Z",
  "answers": [
    {
      "question_id": "string"
    }
  ],
  "respondent_id": "string",
  "interview_id": "550e8400-e29b-41d4-a716-446655440000",
  "interview_rid": "string",
  "metadata": {},
  "response_language": "string",
  "submission_mode": "complete",
  "duration_seconds": 0,
  "sync_batch_id": "550e8400-e29b-41d4-a716-446655440000"
}'''

response = requests.post(
    'http://localhost:8003/api/v1/sync/reconcile',
    data=body.encode('utf-8'),
    headers={
        'Authorization': 'Bearer YOUR_TOKEN',
        'Content-Type': 'application/json',
    },
)
print(response.text)
```


## Get Dashboard Summary

`GET /api/v1/analytics/custom-dashboards/summary`

Get dashboard summary metrics for the tenant.

Cached for 5 minutes. Tenant-scoped.

Authentication: no security requirement declared for this operation.

Parameters:

- `period` (query, string, optional)
  Type: string
  
  default: "7d"
  
  pattern: "^(24h|7d|30d|90d)$"

Responses:

- 200: Successful Response

Content type: application/json

Type: object

Dashboard summary metrics.

Schema: [AnalyticsService_DashboardSummaryDTO](/api-reference/schemas/analyticsservice-dashboardsummarydto-50102923ed.md)

- `tenant_id` (required)
  Type: string

- `period_start` (required)
  Type: string, date-time

- `period_end` (required)
  Type: string, date-time

- `total_surveys` (required)
  Type: integer

- `active_surveys` (required)
  Type: integer

- `total_responses` (required)
  Type: integer

- `completion_rate_avg` (required)
  Type: number

- `average_response_time` (required)
  Type: unknown
  
  anyOf:
    Type: number
  
    Type: null

- `responses_trend` (required)
  Type: array
  
  Items:
    Type: object
    
    Additional properties: true

- `top_surveys` (required)
  Type: array
  
  Items:
    Type: object
    
    Additional properties: true

- `generated_at` (required)
  Type: string, date-time

- 422: Validation Error

Content type: application/json

Type: object

Schema: [AnalyticsService_HTTPValidationError](/api-reference/schemas/analyticsservice-httpvalidationerror-f43c0b92b8.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [AnalyticsService_ValidationError](/api-reference/schemas/analyticsservice-validationerror-190b0412bc.md); Type: object

## Examples

### cURL

```bash
curl -X GET 'http://localhost:8004/api/v1/analytics/custom-dashboards/summary?period=7d'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8004/api/v1/analytics/custom-dashboards/summary?period=7d', {
  method: 'GET',
});

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

### Python

```python
import requests

response = requests.get('http://localhost:8004/api/v1/analytics/custom-dashboards/summary?period=7d')
print(response.text)
```


## Get Survey Performance

`GET /api/v1/analytics/custom-dashboards/surveys/performance`

Get survey performance metrics.

Cached for 5 minutes. Tenant-scoped.

Authentication: no security requirement declared for this operation.

Parameters:

- `limit` (query, integer, optional)
  Type: integer
  
  default: 10
  
  minimum: 1
  
  maximum: 100

- `period` (query, string, optional)
  Type: string
  
  default: "7d"
  
  pattern: "^(24h|7d|30d)$"

Responses:

- 200: Successful Response

Content type: application/json

Type: array

Items:
  Reference: [AnalyticsService_SurveyPerformanceDTO](/api-reference/schemas/analyticsservice-surveyperformancedto-8ee7c2d09d.md); Type: object
  
  Survey performance metrics.

- 422: Validation Error

Content type: application/json

Type: object

Schema: [AnalyticsService_HTTPValidationError](/api-reference/schemas/analyticsservice-httpvalidationerror-f43c0b92b8.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [AnalyticsService_ValidationError](/api-reference/schemas/analyticsservice-validationerror-190b0412bc.md); Type: object

## Examples

### cURL

```bash
curl -X GET 'http://localhost:8004/api/v1/analytics/custom-dashboards/surveys/performance?limit=10&period=7d'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8004/api/v1/analytics/custom-dashboards/surveys/performance?limit=10&period=7d', {
  method: 'GET',
});

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

### Python

```python
import requests

response = requests.get('http://localhost:8004/api/v1/analytics/custom-dashboards/surveys/performance?limit=10&period=7d')
print(response.text)
```


## Get Response Metrics

`GET /api/v1/analytics/custom-dashboards/responses/metrics`

Get response metrics over time.

Cached for 5 minutes. Tenant-scoped.

Authentication: no security requirement declared for this operation.

Parameters:

- `period` (query, string, optional)
  Type: string
  
  default: "7d"
  
  pattern: "^(24h|7d|30d)$"

Responses:

- 200: Successful Response

Content type: application/json

Type: array

Items:
  Reference: [AnalyticsService_ResponseMetricsDTO](/api-reference/schemas/analyticsservice-responsemetricsdto-97442b3e66.md); Type: object
  
  Response metrics for a date range.

- 422: Validation Error

Content type: application/json

Type: object

Schema: [AnalyticsService_HTTPValidationError](/api-reference/schemas/analyticsservice-httpvalidationerror-f43c0b92b8.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [AnalyticsService_ValidationError](/api-reference/schemas/analyticsservice-validationerror-190b0412bc.md); Type: object

## Examples

### cURL

```bash
curl -X GET 'http://localhost:8004/api/v1/analytics/custom-dashboards/responses/metrics?period=7d'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8004/api/v1/analytics/custom-dashboards/responses/metrics?period=7d', {
  method: 'GET',
});

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

### Python

```python
import requests

response = requests.get('http://localhost:8004/api/v1/analytics/custom-dashboards/responses/metrics?period=7d')
print(response.text)
```


## Invalidate Dashboard Cache

`POST /api/v1/analytics/custom-dashboards/invalidate-cache`

Invalidate all dashboard cache for the tenant.

Useful after significant data changes.

Authentication: no security requirement declared for this operation.

Responses:

- 200: Successful Response

Content type: application/json

Type: unknown

## Examples

### cURL

```bash
curl -X POST 'http://localhost:8004/api/v1/analytics/custom-dashboards/invalidate-cache'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8004/api/v1/analytics/custom-dashboards/invalidate-cache', {
  method: 'POST',
});

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

### Python

```python
import requests

response = requests.post('http://localhost:8004/api/v1/analytics/custom-dashboards/invalidate-cache')
print(response.text)
```


## List Dashboards

`GET /api/v1/analytics/custom-dashboards`

List all dashboards for the tenant.

Authentication: no security requirement declared for this operation.

Parameters:

- `skip` (query, integer, optional)
  Type: integer
  
  default: 0
  
  minimum: 0

- `limit` (query, integer, optional)
  Type: integer
  
  default: 20
  
  minimum: 1
  
  maximum: 100

Responses:

- 200: Successful Response

Content type: application/json

Type: object

Schema: [AnalyticsService_DashboardListDTO](/api-reference/schemas/analyticsservice-dashboardlistdto-55951fb19f.md)

- `items` (required)
  Type: array
  
  Items:
    Reference: [AnalyticsService_DashboardResponseDTO](/api-reference/schemas/analyticsservice-dashboardresponsedto-2b81aef221.md); Type: object
    
    Dashboard response.

- `total` (required)
  Type: integer

- `skip` (required)
  Type: integer

- `limit` (required)
  Type: integer

- `has_next` (required)
  Type: boolean

- `has_previous` (required)
  Type: boolean

- 422: Validation Error

Content type: application/json

Type: object

Schema: [AnalyticsService_HTTPValidationError](/api-reference/schemas/analyticsservice-httpvalidationerror-f43c0b92b8.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [AnalyticsService_ValidationError](/api-reference/schemas/analyticsservice-validationerror-190b0412bc.md); Type: object

## Examples

### cURL

```bash
curl -X GET 'http://localhost:8004/api/v1/analytics/custom-dashboards?skip=0&limit=20'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8004/api/v1/analytics/custom-dashboards?skip=0&limit=20', {
  method: 'GET',
});

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

### Python

```python
import requests

response = requests.get('http://localhost:8004/api/v1/analytics/custom-dashboards?skip=0&limit=20')
print(response.text)
```


## Create Dashboard

`POST /api/v1/analytics/custom-dashboards`

Create a new dashboard.

Authentication: no security requirement declared for this operation.

Request body: application/json (required)

Type: object

Create dashboard request.

Schema: [AnalyticsService_CreateDashboardDTO](/api-reference/schemas/analyticsservice-createdashboarddto-018b6dd91e.md)

- `title` (required)
  Type: string
  
  minLength: 1
  
  maxLength: 255

- `description` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `is_default` (optional)
  Type: boolean
  
  default: false

- `survey_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `dashboard_type` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `layout_config` (optional)
  Type: unknown
  
  anyOf:
    Type: object
    
    Additional properties: true
  
    Type: null

Responses:

- 201: Successful Response

Content type: application/json

Type: object

Dashboard response.

Schema: [AnalyticsService_DashboardResponseDTO](/api-reference/schemas/analyticsservice-dashboardresponsedto-2b81aef221.md)

- `id` (required)
  Type: string

- `title` (required)
  Type: string

- `description` (required)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `is_default` (required)
  Type: boolean

- `layout_config` (required)
  Type: unknown
  
  anyOf:
    Type: object
    
    Additional properties: true
  
    Type: null

- `created_by` (required)
  Type: string

- `created_at` (required)
  Type: string, date-time

- `updated_at` (required)
  Type: unknown
  
  anyOf:
    Type: string, date-time
  
    Type: null

- `widgets` (optional)
  Type: unknown
  
  anyOf:
    Type: array
    
    Items:
      Reference: [AnalyticsService_WidgetResponseDTO](/api-reference/schemas/analyticsservice-widgetresponsedto-2c5efd8617.md); Type: object
      
      Widget response.
  
    Type: null

- `survey_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `dashboard_type` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `is_user_modified` (optional)
  Type: unknown
  
  anyOf:
    Type: boolean
  
    Type: null

- `generated_by_system` (optional)
  Type: unknown
  
  anyOf:
    Type: boolean
  
    Type: null

- `source_survey_version` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `generator_version` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- 422: Validation Error

Content type: application/json

Type: object

Schema: [AnalyticsService_HTTPValidationError](/api-reference/schemas/analyticsservice-httpvalidationerror-f43c0b92b8.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [AnalyticsService_ValidationError](/api-reference/schemas/analyticsservice-validationerror-190b0412bc.md); Type: object

## Examples

### cURL

```bash
curl -X POST 'http://localhost:8004/api/v1/analytics/custom-dashboards' \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "title": "string",
  "description": "string",
  "is_default": false,
  "survey_id": "string",
  "dashboard_type": "string",
  "layout_config": {}
}'
```

### JavaScript

```javascript
const body = `{
  "title": "string",
  "description": "string",
  "is_default": false,
  "survey_id": "string",
  "dashboard_type": "string",
  "layout_config": {}
}`;

const response = await fetch('http://localhost:8004/api/v1/analytics/custom-dashboards', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
  },
  body,
});

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

### Python

```python
import requests

body = '''{
  "title": "string",
  "description": "string",
  "is_default": false,
  "survey_id": "string",
  "dashboard_type": "string",
  "layout_config": {}
}'''

response = requests.post(
    'http://localhost:8004/api/v1/analytics/custom-dashboards',
    data=body.encode('utf-8'),
    headers={
        'Content-Type': 'application/json',
    },
)
print(response.text)
```


## Get Dashboard

`GET /api/v1/analytics/custom-dashboards/{dashboard_id}`

Get a dashboard by ID with its widgets.

Authentication: no security requirement declared for this operation.

Parameters:

- `dashboard_id` (path, string, required)
  Type: string

Responses:

- 200: Successful Response

Content type: application/json

Type: object

Dashboard response.

Schema: [AnalyticsService_DashboardResponseDTO](/api-reference/schemas/analyticsservice-dashboardresponsedto-2b81aef221.md)

- `id` (required)
  Type: string

- `title` (required)
  Type: string

- `description` (required)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `is_default` (required)
  Type: boolean

- `layout_config` (required)
  Type: unknown
  
  anyOf:
    Type: object
    
    Additional properties: true
  
    Type: null

- `created_by` (required)
  Type: string

- `created_at` (required)
  Type: string, date-time

- `updated_at` (required)
  Type: unknown
  
  anyOf:
    Type: string, date-time
  
    Type: null

- `widgets` (optional)
  Type: unknown
  
  anyOf:
    Type: array
    
    Items:
      Reference: [AnalyticsService_WidgetResponseDTO](/api-reference/schemas/analyticsservice-widgetresponsedto-2c5efd8617.md); Type: object
      
      Widget response.
  
    Type: null

- `survey_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `dashboard_type` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `is_user_modified` (optional)
  Type: unknown
  
  anyOf:
    Type: boolean
  
    Type: null

- `generated_by_system` (optional)
  Type: unknown
  
  anyOf:
    Type: boolean
  
    Type: null

- `source_survey_version` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `generator_version` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- 422: Validation Error

Content type: application/json

Type: object

Schema: [AnalyticsService_HTTPValidationError](/api-reference/schemas/analyticsservice-httpvalidationerror-f43c0b92b8.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [AnalyticsService_ValidationError](/api-reference/schemas/analyticsservice-validationerror-190b0412bc.md); Type: object

## Examples

### cURL

```bash
curl -X GET 'http://localhost:8004/api/v1/analytics/custom-dashboards/string'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8004/api/v1/analytics/custom-dashboards/string', {
  method: 'GET',
});

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

### Python

```python
import requests

response = requests.get('http://localhost:8004/api/v1/analytics/custom-dashboards/string')
print(response.text)
```


## Update Dashboard

`PUT /api/v1/analytics/custom-dashboards/{dashboard_id}`

Update a dashboard.

Authentication: no security requirement declared for this operation.

Parameters:

- `dashboard_id` (path, string, required)
  Type: string

Request body: application/json (required)

Type: object

Update dashboard request.

Schema: [AnalyticsService_UpdateDashboardDTO](/api-reference/schemas/analyticsservice-updatedashboarddto-c21889ac74.md)

- `title` (optional)
  Type: unknown
  
  anyOf:
    Type: string
    
    minLength: 1
    
    maxLength: 255
  
    Type: null

- `description` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `is_default` (optional)
  Type: unknown
  
  anyOf:
    Type: boolean
  
    Type: null

- `layout_config` (optional)
  Type: unknown
  
  anyOf:
    Type: object
    
    Additional properties: true
  
    Type: null

- `is_user_modified` (optional)
  Type: unknown
  
  anyOf:
    Type: boolean
  
    Type: null

Responses:

- 200: Successful Response

Content type: application/json

Type: object

Dashboard response.

Schema: [AnalyticsService_DashboardResponseDTO](/api-reference/schemas/analyticsservice-dashboardresponsedto-2b81aef221.md)

- `id` (required)
  Type: string

- `title` (required)
  Type: string

- `description` (required)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `is_default` (required)
  Type: boolean

- `layout_config` (required)
  Type: unknown
  
  anyOf:
    Type: object
    
    Additional properties: true
  
    Type: null

- `created_by` (required)
  Type: string

- `created_at` (required)
  Type: string, date-time

- `updated_at` (required)
  Type: unknown
  
  anyOf:
    Type: string, date-time
  
    Type: null

- `widgets` (optional)
  Type: unknown
  
  anyOf:
    Type: array
    
    Items:
      Reference: [AnalyticsService_WidgetResponseDTO](/api-reference/schemas/analyticsservice-widgetresponsedto-2c5efd8617.md); Type: object
      
      Widget response.
  
    Type: null

- `survey_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `dashboard_type` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `is_user_modified` (optional)
  Type: unknown
  
  anyOf:
    Type: boolean
  
    Type: null

- `generated_by_system` (optional)
  Type: unknown
  
  anyOf:
    Type: boolean
  
    Type: null

- `source_survey_version` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `generator_version` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- 422: Validation Error

Content type: application/json

Type: object

Schema: [AnalyticsService_HTTPValidationError](/api-reference/schemas/analyticsservice-httpvalidationerror-f43c0b92b8.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [AnalyticsService_ValidationError](/api-reference/schemas/analyticsservice-validationerror-190b0412bc.md); Type: object

## Examples

### cURL

```bash
curl -X PUT 'http://localhost:8004/api/v1/analytics/custom-dashboards/string' \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "title": "string",
  "description": "string",
  "is_default": true,
  "layout_config": {},
  "is_user_modified": true
}'
```

### JavaScript

```javascript
const body = `{
  "title": "string",
  "description": "string",
  "is_default": true,
  "layout_config": {},
  "is_user_modified": true
}`;

const response = await fetch('http://localhost:8004/api/v1/analytics/custom-dashboards/string', {
  method: 'PUT',
  headers: {
    'Content-Type': 'application/json',
  },
  body,
});

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

### Python

```python
import requests

body = '''{
  "title": "string",
  "description": "string",
  "is_default": true,
  "layout_config": {},
  "is_user_modified": true
}'''

response = requests.put(
    'http://localhost:8004/api/v1/analytics/custom-dashboards/string',
    data=body.encode('utf-8'),
    headers={
        'Content-Type': 'application/json',
    },
)
print(response.text)
```


## Delete Dashboard

`DELETE /api/v1/analytics/custom-dashboards/{dashboard_id}`

Delete a dashboard and all its widgets.

Authentication: no security requirement declared for this operation.

Parameters:

- `dashboard_id` (path, string, required)
  Type: string

Responses:

- 204: Successful Response

- 422: Validation Error

Content type: application/json

Type: object

Schema: [AnalyticsService_HTTPValidationError](/api-reference/schemas/analyticsservice-httpvalidationerror-f43c0b92b8.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [AnalyticsService_ValidationError](/api-reference/schemas/analyticsservice-validationerror-190b0412bc.md); Type: object

## Examples

### cURL

```bash
curl -X DELETE 'http://localhost:8004/api/v1/analytics/custom-dashboards/string'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8004/api/v1/analytics/custom-dashboards/string', {
  method: 'DELETE',
});

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

### Python

```python
import requests

response = requests.delete('http://localhost:8004/api/v1/analytics/custom-dashboards/string')
print(response.text)
```


## Create Widget

`POST /api/v1/analytics/custom-dashboards/{dashboard_id}/widgets`

Add a widget to a dashboard.

Authentication: no security requirement declared for this operation.

Parameters:

- `dashboard_id` (path, string, required)
  Type: string

Request body: application/json (required)

Type: object

Create widget request.

Schema: [AnalyticsService_CreateWidgetDTO](/api-reference/schemas/analyticsservice-createwidgetdto-a1a87edd85.md)

- `widget_type` (required)
  Type: string
  
  maxLength: 50

- `title` (required)
  Type: string
  
  minLength: 1
  
  maxLength: 255

- `chart_type` (required)
  Type: string
  
  maxLength: 50

- `data_source` (optional)
  Type: string
  
  default: "snapshot"
  
  maxLength: 50

- `query_config` (optional)
  Type: unknown
  
  anyOf:
    Type: object
    
    Additional properties: true
  
    Type: null

- `position_x` (optional)
  Type: integer
  
  default: 0

- `position_y` (optional)
  Type: integer
  
  default: 0

- `width` (optional)
  Type: integer
  
  default: 4

- `height` (optional)
  Type: integer
  
  default: 3

- `config` (optional)
  Type: unknown
  
  anyOf:
    Type: object
    
    Additional properties: true
  
    Type: null

- `filters` (optional)
  Type: unknown
  
  anyOf:
    Type: object
    
    Additional properties: true
  
    Type: null

- `refresh_interval` (optional)
  Type: integer
  
  default: 300

Responses:

- 201: Successful Response

Content type: application/json

Type: object

Widget response.

Schema: [AnalyticsService_WidgetResponseDTO](/api-reference/schemas/analyticsservice-widgetresponsedto-2c5efd8617.md)

- `id` (required)
  Type: string

- `dashboard_id` (required)
  Type: string

- `widget_type` (required)
  Type: string

- `title` (required)
  Type: string

- `title_key` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `chart_type` (required)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `data_source` (required)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `query_config` (required)
  Type: unknown
  
  anyOf:
    Type: object
    
    Additional properties: true
  
    Type: null

- `position_x` (required)
  Type: integer

- `position_y` (required)
  Type: integer

- `width` (required)
  Type: integer

- `height` (required)
  Type: integer

- `config` (required)
  Type: unknown
  
  anyOf:
    Type: object
    
    Additional properties: true
  
    Type: null

- `filters` (required)
  Type: unknown
  
  anyOf:
    Type: object
    
    Additional properties: true
  
    Type: null

- `refresh_interval` (required)
  Type: integer

- `created_at` (required)
  Type: string, date-time

- `updated_at` (required)
  Type: unknown
  
  anyOf:
    Type: string, date-time
  
    Type: null

- 422: Validation Error

Content type: application/json

Type: object

Schema: [AnalyticsService_HTTPValidationError](/api-reference/schemas/analyticsservice-httpvalidationerror-f43c0b92b8.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [AnalyticsService_ValidationError](/api-reference/schemas/analyticsservice-validationerror-190b0412bc.md); Type: object

## Examples

### cURL

```bash
curl -X POST 'http://localhost:8004/api/v1/analytics/custom-dashboards/string/widgets' \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "widget_type": "string",
  "title": "string",
  "chart_type": "string",
  "data_source": "snapshot",
  "query_config": {},
  "position_x": 0,
  "position_y": 0,
  "width": 4,
  "height": 3,
  "config": {},
  "filters": {},
  "refresh_interval": 300
}'
```

### JavaScript

```javascript
const body = `{
  "widget_type": "string",
  "title": "string",
  "chart_type": "string",
  "data_source": "snapshot",
  "query_config": {},
  "position_x": 0,
  "position_y": 0,
  "width": 4,
  "height": 3,
  "config": {},
  "filters": {},
  "refresh_interval": 300
}`;

const response = await fetch('http://localhost:8004/api/v1/analytics/custom-dashboards/string/widgets', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
  },
  body,
});

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

### Python

```python
import requests

body = '''{
  "widget_type": "string",
  "title": "string",
  "chart_type": "string",
  "data_source": "snapshot",
  "query_config": {},
  "position_x": 0,
  "position_y": 0,
  "width": 4,
  "height": 3,
  "config": {},
  "filters": {},
  "refresh_interval": 300
}'''

response = requests.post(
    'http://localhost:8004/api/v1/analytics/custom-dashboards/string/widgets',
    data=body.encode('utf-8'),
    headers={
        'Content-Type': 'application/json',
    },
)
print(response.text)
```


## Update Widget

`PUT /api/v1/analytics/custom-dashboards/{dashboard_id}/widgets/{widget_id}`

Update a widget.

Authentication: no security requirement declared for this operation.

Parameters:

- `dashboard_id` (path, string, required)
  Type: string

- `widget_id` (path, string, required)
  Type: string

Request body: application/json (required)

Type: object

Update widget request.

Schema: [AnalyticsService_UpdateWidgetDTO](/api-reference/schemas/analyticsservice-updatewidgetdto-cdf10a9b61.md)

- `title` (optional)
  Type: unknown
  
  anyOf:
    Type: string
    
    minLength: 1
    
    maxLength: 255
  
    Type: null

- `chart_type` (optional)
  Type: unknown
  
  anyOf:
    Type: string
    
    maxLength: 50
  
    Type: null

- `data_source` (optional)
  Type: unknown
  
  anyOf:
    Type: string
    
    maxLength: 50
  
    Type: null

- `query_config` (optional)
  Type: unknown
  
  anyOf:
    Type: object
    
    Additional properties: true
  
    Type: null

- `position_x` (optional)
  Type: unknown
  
  anyOf:
    Type: integer
  
    Type: null

- `position_y` (optional)
  Type: unknown
  
  anyOf:
    Type: integer
  
    Type: null

- `width` (optional)
  Type: unknown
  
  anyOf:
    Type: integer
  
    Type: null

- `height` (optional)
  Type: unknown
  
  anyOf:
    Type: integer
  
    Type: null

- `config` (optional)
  Type: unknown
  
  anyOf:
    Type: object
    
    Additional properties: true
  
    Type: null

- `filters` (optional)
  Type: unknown
  
  anyOf:
    Type: object
    
    Additional properties: true
  
    Type: null

- `refresh_interval` (optional)
  Type: unknown
  
  anyOf:
    Type: integer
  
    Type: null

Responses:

- 200: Successful Response

Content type: application/json

Type: object

Widget response.

Schema: [AnalyticsService_WidgetResponseDTO](/api-reference/schemas/analyticsservice-widgetresponsedto-2c5efd8617.md)

- `id` (required)
  Type: string

- `dashboard_id` (required)
  Type: string

- `widget_type` (required)
  Type: string

- `title` (required)
  Type: string

- `title_key` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `chart_type` (required)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `data_source` (required)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `query_config` (required)
  Type: unknown
  
  anyOf:
    Type: object
    
    Additional properties: true
  
    Type: null

- `position_x` (required)
  Type: integer

- `position_y` (required)
  Type: integer

- `width` (required)
  Type: integer

- `height` (required)
  Type: integer

- `config` (required)
  Type: unknown
  
  anyOf:
    Type: object
    
    Additional properties: true
  
    Type: null

- `filters` (required)
  Type: unknown
  
  anyOf:
    Type: object
    
    Additional properties: true
  
    Type: null

- `refresh_interval` (required)
  Type: integer

- `created_at` (required)
  Type: string, date-time

- `updated_at` (required)
  Type: unknown
  
  anyOf:
    Type: string, date-time
  
    Type: null

- 422: Validation Error

Content type: application/json

Type: object

Schema: [AnalyticsService_HTTPValidationError](/api-reference/schemas/analyticsservice-httpvalidationerror-f43c0b92b8.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [AnalyticsService_ValidationError](/api-reference/schemas/analyticsservice-validationerror-190b0412bc.md); Type: object

## Examples

### cURL

```bash
curl -X PUT 'http://localhost:8004/api/v1/analytics/custom-dashboards/string/widgets/string' \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "title": "string",
  "chart_type": "string",
  "data_source": "string",
  "query_config": {},
  "position_x": 0,
  "position_y": 0,
  "width": 0,
  "height": 0,
  "config": {},
  "filters": {},
  "refresh_interval": 0
}'
```

### JavaScript

```javascript
const body = `{
  "title": "string",
  "chart_type": "string",
  "data_source": "string",
  "query_config": {},
  "position_x": 0,
  "position_y": 0,
  "width": 0,
  "height": 0,
  "config": {},
  "filters": {},
  "refresh_interval": 0
}`;

const response = await fetch('http://localhost:8004/api/v1/analytics/custom-dashboards/string/widgets/string', {
  method: 'PUT',
  headers: {
    'Content-Type': 'application/json',
  },
  body,
});

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

### Python

```python
import requests

body = '''{
  "title": "string",
  "chart_type": "string",
  "data_source": "string",
  "query_config": {},
  "position_x": 0,
  "position_y": 0,
  "width": 0,
  "height": 0,
  "config": {},
  "filters": {},
  "refresh_interval": 0
}'''

response = requests.put(
    'http://localhost:8004/api/v1/analytics/custom-dashboards/string/widgets/string',
    data=body.encode('utf-8'),
    headers={
        'Content-Type': 'application/json',
    },
)
print(response.text)
```


## Delete Widget

`DELETE /api/v1/analytics/custom-dashboards/{dashboard_id}/widgets/{widget_id}`

Delete a widget.

Authentication: no security requirement declared for this operation.

Parameters:

- `dashboard_id` (path, string, required)
  Type: string

- `widget_id` (path, string, required)
  Type: string

Responses:

- 204: Successful Response

- 422: Validation Error

Content type: application/json

Type: object

Schema: [AnalyticsService_HTTPValidationError](/api-reference/schemas/analyticsservice-httpvalidationerror-f43c0b92b8.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [AnalyticsService_ValidationError](/api-reference/schemas/analyticsservice-validationerror-190b0412bc.md); Type: object

## Examples

### cURL

```bash
curl -X DELETE 'http://localhost:8004/api/v1/analytics/custom-dashboards/string/widgets/string'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8004/api/v1/analytics/custom-dashboards/string/widgets/string', {
  method: 'DELETE',
});

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

### Python

```python
import requests

response = requests.delete('http://localhost:8004/api/v1/analytics/custom-dashboards/string/widgets/string')
print(response.text)
```


## Get Widget Data

`GET /api/v1/analytics/custom-dashboards/{dashboard_id}/widgets/{widget_id}/data`

Get data for a widget.

Routes to appropriate data source:
- snapshot: Query local analytics_snapshots table
- realtime: Proxy to data-service for live data

Authentication: no security requirement declared for this operation.

Parameters:

- `dashboard_id` (path, string, required)
  Type: string

- `widget_id` (path, string, required)
  Type: string

Responses:

- 200: Successful Response

Content type: application/json

Type: object

Widget data response.

Schema: [AnalyticsService_WidgetDataDTO](/api-reference/schemas/analyticsservice-widgetdatadto-751ea0fa5f.md)

- `widget_id` (required)
  Type: string

- `data_source` (required)
  Type: string

- `data` (required)
  Type: unknown

- `cached` (optional)
  Type: boolean
  
  default: false

- `generated_at` (required)
  Type: string, date-time

- 422: Validation Error

Content type: application/json

Type: object

Schema: [AnalyticsService_HTTPValidationError](/api-reference/schemas/analyticsservice-httpvalidationerror-f43c0b92b8.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [AnalyticsService_ValidationError](/api-reference/schemas/analyticsservice-validationerror-190b0412bc.md); Type: object

## Examples

### cURL

```bash
curl -X GET 'http://localhost:8004/api/v1/analytics/custom-dashboards/string/widgets/string/data'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8004/api/v1/analytics/custom-dashboards/string/widgets/string/data', {
  method: 'GET',
});

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

### Python

```python
import requests

response = requests.get('http://localhost:8004/api/v1/analytics/custom-dashboards/string/widgets/string/data')
print(response.text)
```


## Generate Default Dashboard

`POST /api/v1/analytics/custom-dashboards/generate`

Generate or regenerate a default dashboard for a published survey.

The generator decides whether to create, skip, or regenerate based on
dashboard state and survey version. No force parameter needed.

Authentication: no security requirement declared for this operation.

Request body: application/json (required)

Type: object

Request to generate a default dashboard for a survey.

Schema: [AnalyticsService_GenerateDashboardRequestDTO](/api-reference/schemas/analyticsservice-generatedashboardrequestdto-c331f9ce2f.md)

- `survey_id` (required)
  Type: string

Responses:

- 200: Successful Response

Content type: application/json

Type: object

Response from dashboard generation.

Schema: [AnalyticsService_GenerateDashboardResponseDTO](/api-reference/schemas/analyticsservice-generatedashboardresponsedto-b154c93bb2.md)

- `dashboard_id` (required)
  Type: string

- `status` (required)
  Type: string

- `widget_count` (required)
  Type: integer

- `message` (required)
  Type: string

- 422: Validation Error

Content type: application/json

Type: object

Schema: [AnalyticsService_HTTPValidationError](/api-reference/schemas/analyticsservice-httpvalidationerror-f43c0b92b8.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [AnalyticsService_ValidationError](/api-reference/schemas/analyticsservice-validationerror-190b0412bc.md); Type: object

## Examples

### cURL

```bash
curl -X POST 'http://localhost:8004/api/v1/analytics/custom-dashboards/generate' \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "survey_id": "string"
}'
```

### JavaScript

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

const response = await fetch('http://localhost:8004/api/v1/analytics/custom-dashboards/generate', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
  },
  body,
});

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

### Python

```python
import requests

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

response = requests.post(
    'http://localhost:8004/api/v1/analytics/custom-dashboards/generate',
    data=body.encode('utf-8'),
    headers={
        'Content-Type': 'application/json',
    },
)
print(response.text)
```


## Get Survey Analytics

`GET /api/v1/analytics/surveys/{survey_id}`

Get analytics for a specific survey.

Authentication: no security requirement declared for this operation.

Parameters:

- `survey_id` (path, string, required)
  Type: string

- `start_date` (query, unknown, optional)
  Type: unknown
  
  anyOf:
    Type: string, date-time
  
    Type: null

- `end_date` (query, unknown, optional)
  Type: unknown
  
  anyOf:
    Type: string, date-time
  
    Type: null

Responses:

- 200: Successful Response

Content type: application/json

Type: object

Survey analytics.

Schema: [AnalyticsService_SurveyAnalyticsDTO](/api-reference/schemas/analyticsservice-surveyanalyticsdto-eaa15f0945.md)

- `survey_id` (required)
  Type: string

- `total_responses` (required)
  Type: integer

- `completion_rate` (required)
  Type: number

- `average_time` (required)
  Type: unknown
  
  anyOf:
    Type: number
  
    Type: null

- `questions_count` (required)
  Type: integer

- `responses_by_date` (required)
  Type: array
  
  Items:
    Type: object
    
    Additional properties: true

- 422: Validation Error

Content type: application/json

Type: object

Schema: [AnalyticsService_HTTPValidationError](/api-reference/schemas/analyticsservice-httpvalidationerror-f43c0b92b8.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [AnalyticsService_ValidationError](/api-reference/schemas/analyticsservice-validationerror-190b0412bc.md); Type: object

## Examples

### cURL

```bash
curl -X GET 'http://localhost:8004/api/v1/analytics/surveys/string'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8004/api/v1/analytics/surveys/string', {
  method: 'GET',
});

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

### Python

```python
import requests

response = requests.get('http://localhost:8004/api/v1/analytics/surveys/string')
print(response.text)
```


## Get Analytics Summary

`GET /api/v1/analytics/summary`

Get overall analytics summary for the tenant.

Authentication: no security requirement declared for this operation.

Parameters:

- `start_date` (query, unknown, optional) - Start date for the period
  Type: unknown
  
  Start date for the period
  
  anyOf:
    Type: string, date-time
  
    Type: null

- `end_date` (query, unknown, optional) - End date for the period
  Type: unknown
  
  End date for the period
  
  anyOf:
    Type: string, date-time
  
    Type: null

Responses:

- 200: Successful Response

Content type: application/json

Type: object

Analytics summary.

Schema: [AnalyticsService_AnalyticsSummaryDTO](/api-reference/schemas/analyticsservice-analyticssummarydto-ee32276bd2.md)

- `total_surveys` (required)
  Type: integer

- `total_responses` (required)
  Type: integer

- `active_surveys` (required)
  Type: integer

- `completion_rate_avg` (required)
  Type: number

- `period_start` (required)
  Type: string, date-time

- `period_end` (required)
  Type: string, date-time

- 422: Validation Error

Content type: application/json

Type: object

Schema: [AnalyticsService_HTTPValidationError](/api-reference/schemas/analyticsservice-httpvalidationerror-f43c0b92b8.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [AnalyticsService_ValidationError](/api-reference/schemas/analyticsservice-validationerror-190b0412bc.md); Type: object

## Examples

### cURL

```bash
curl -X GET 'http://localhost:8004/api/v1/analytics/summary'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8004/api/v1/analytics/summary', {
  method: 'GET',
});

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

### Python

```python
import requests

response = requests.get('http://localhost:8004/api/v1/analytics/summary')
print(response.text)
```


## Get Survey Responses

`GET /api/v1/analytics/surveys/{survey_id}/responses`

Get paginated responses for a survey.

Authentication: no security requirement declared for this operation.

Parameters:

- `survey_id` (path, string, required)
  Type: string

- `skip` (query, integer, optional)
  Type: integer
  
  default: 0
  
  minimum: 0

- `limit` (query, integer, optional)
  Type: integer
  
  default: 100
  
  minimum: 1
  
  maximum: 1000

Responses:

- 200: Successful Response

Content type: application/json

Type: object

Paginated list of survey responses for analytics.

Schema: [AnalyticsService_AnalyticsResponseListDTO](/api-reference/schemas/analyticsservice-analyticsresponselistdto-ce7ca15f9c.md)

- `items` (required)
  Type: array
  
  Items:
    Type: object
    
    Additional properties: true

- `total` (required)
  Type: integer

- `skip` (required)
  Type: integer

- `limit` (required)
  Type: integer

- `has_next` (required)
  Type: boolean

- `has_previous` (required)
  Type: boolean

- 422: Validation Error

Content type: application/json

Type: object

Schema: [AnalyticsService_HTTPValidationError](/api-reference/schemas/analyticsservice-httpvalidationerror-f43c0b92b8.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [AnalyticsService_ValidationError](/api-reference/schemas/analyticsservice-validationerror-190b0412bc.md); Type: object

## Examples

### cURL

```bash
curl -X GET 'http://localhost:8004/api/v1/analytics/surveys/string/responses?skip=0&limit=100'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8004/api/v1/analytics/surveys/string/responses?skip=0&limit=100', {
  method: 'GET',
});

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

### Python

```python
import requests

response = requests.get('http://localhost:8004/api/v1/analytics/surveys/string/responses?skip=0&limit=100')
print(response.text)
```


## Get Survey Questions Analytics

`GET /api/v1/analytics/surveys/{survey_id}/questions`

Get analytics per question for a survey.

Authentication: no security requirement declared for this operation.

Parameters:

- `survey_id` (path, string, required)
  Type: string

Responses:

- 200: Successful Response

Content type: application/json

Type: unknown

- 422: Validation Error

Content type: application/json

Type: object

Schema: [AnalyticsService_HTTPValidationError](/api-reference/schemas/analyticsservice-httpvalidationerror-f43c0b92b8.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [AnalyticsService_ValidationError](/api-reference/schemas/analyticsservice-validationerror-190b0412bc.md); Type: object

## Examples

### cURL

```bash
curl -X GET 'http://localhost:8004/api/v1/analytics/surveys/string/questions'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8004/api/v1/analytics/surveys/string/questions', {
  method: 'GET',
});

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

### Python

```python
import requests

response = requests.get('http://localhost:8004/api/v1/analytics/surveys/string/questions')
print(response.text)
```


## Export Survey Analytics

`GET /api/v1/analytics/export/{survey_id}`

Export survey analytics in the specified format.

Authentication: no security requirement declared for this operation.

Parameters:

- `survey_id` (path, string, required)
  Type: string

- `format` (query, string, optional)
  Type: string
  
  default: "json"
  
  pattern: "^(json|csv|xlsx)$"

Responses:

- 200: Successful Response

Content type: application/json

Type: unknown

- 422: Validation Error

Content type: application/json

Type: object

Schema: [AnalyticsService_HTTPValidationError](/api-reference/schemas/analyticsservice-httpvalidationerror-f43c0b92b8.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [AnalyticsService_ValidationError](/api-reference/schemas/analyticsservice-validationerror-190b0412bc.md); Type: object

## Examples

### cURL

```bash
curl -X GET 'http://localhost:8004/api/v1/analytics/export/string?format=json'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8004/api/v1/analytics/export/string?format=json', {
  method: 'GET',
});

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

### Python

```python
import requests

response = requests.get('http://localhost:8004/api/v1/analytics/export/string?format=json')
print(response.text)
```


## Aggregate Survey Data

`POST /api/v1/analytics/aggregate`

Aggregate survey response data for chart visualisation.

Fetches raw responses from data-service, computes aggregation locally,
and caches the result in Redis for 5 minutes.

Aggregation types:
- count / distribution  → frequency per unique value
- average               → numeric histogram with min/max/avg summary
- sum                   → single total value

Authentication: no security requirement declared for this operation.

Request body: application/json (required)

Type: object

Request to aggregate survey response data for a chart panel.

Schema: [AnalyticsService_AggregateRequestDTO](/api-reference/schemas/analyticsservice-aggregaterequestdto-7d8b8a40a5.md)

- `survey_id` (required)
  Type: string

- `question_ids` (required)
  Type: array
  
  Items:
    Type: string

- `chart_type` (required)
  Type: string

- `aggregation` (required)
  Type: string

- `filters` (optional)
  Type: unknown
  
  anyOf:
    Type: object
    
    Additional properties: true
  
    Type: null

- `grouping` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `value_mode` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

Responses:

- 200: Successful Response

Content type: application/json

Type: object

Aggregated chart data response.

Schema: [AnalyticsService_AggregateResponseDTO](/api-reference/schemas/analyticsservice-aggregateresponsedto-1f3e009075.md)

- `survey_id` (required)
  Type: string

- `question_ids` (required)
  Type: array
  
  Items:
    Type: string

- `chart_type` (required)
  Type: string

- `aggregation` (required)
  Type: string

- `data` (required)
  Type: array
  
  Items:
    Reference: [AnalyticsService_AggregateDataPointDTO](/api-reference/schemas/analyticsservice-aggregatedatapointdto-30c0651c6d.md); Type: object
    
    Single data point in aggregated results.

- `summary` (optional)
  Type: unknown
  
  anyOf:
    Type: object
    
    Additional properties: true
  
    Type: null

- `cached` (optional)
  Type: boolean
  
  default: false

- `generated_at` (required)
  Type: string, date-time

- 422: Validation Error

Content type: application/json

Type: object

Schema: [AnalyticsService_HTTPValidationError](/api-reference/schemas/analyticsservice-httpvalidationerror-f43c0b92b8.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [AnalyticsService_ValidationError](/api-reference/schemas/analyticsservice-validationerror-190b0412bc.md); Type: object

## Examples

### cURL

```bash
curl -X POST 'http://localhost:8004/api/v1/analytics/aggregate' \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "survey_id": "string",
  "question_ids": [
    "string"
  ],
  "chart_type": "string",
  "aggregation": "string",
  "filters": {},
  "grouping": "string",
  "value_mode": "string"
}'
```

### JavaScript

```javascript
const body = `{
  "survey_id": "string",
  "question_ids": [
    "string"
  ],
  "chart_type": "string",
  "aggregation": "string",
  "filters": {},
  "grouping": "string",
  "value_mode": "string"
}`;

const response = await fetch('http://localhost:8004/api/v1/analytics/aggregate', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
  },
  body,
});

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

### Python

```python
import requests

body = '''{
  "survey_id": "string",
  "question_ids": [
    "string"
  ],
  "chart_type": "string",
  "aggregation": "string",
  "filters": {},
  "grouping": "string",
  "value_mode": "string"
}'''

response = requests.post(
    'http://localhost:8004/api/v1/analytics/aggregate',
    data=body.encode('utf-8'),
    headers={
        'Content-Type': 'application/json',
    },
)
print(response.text)
```


## List Workspaces

`GET /api/v1/workspaces`

Authentication: no security requirement declared for this operation.

Parameters:

- `skip` (query, integer, optional)
  Type: integer
  
  default: 0
  
  minimum: 0

- `limit` (query, integer, optional)
  Type: integer
  
  default: 20
  
  minimum: 1
  
  maximum: 100

- `status_filter` (query, unknown, optional)
  Type: unknown
  
  anyOf:
    Reference: [WorkspaceService_WorkspaceStatus](/api-reference/schemas/workspaceservice-workspacestatus-652b9c3598.md); Type: string
    
    enum: ["active","archived","suspended","deleted"]
  
    Type: null

- `search` (query, unknown, optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

Responses:

- 200: Successful Response

Content type: application/json

Type: object

Schema: [WorkspaceService_WorkspaceListDTO](/api-reference/schemas/workspaceservice-workspacelistdto-f350822239.md)

- `items` (required)
  Type: array
  
  Items:
    Reference: [WorkspaceService_WorkspaceResponseDTO](/api-reference/schemas/workspaceservice-workspaceresponsedto-4de4578a77.md); Type: object

- `total` (required)
  Type: integer

- `skip` (required)
  Type: integer

- `limit` (required)
  Type: integer

- `has_next` (required)
  Type: boolean

- `has_previous` (required)
  Type: boolean

- 422: Validation Error

Content type: application/json

Type: object

Schema: [WorkspaceService_HTTPValidationError](/api-reference/schemas/workspaceservice-httpvalidationerror-92a261e7a3.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [WorkspaceService_ValidationError](/api-reference/schemas/workspaceservice-validationerror-9662acef93.md); Type: object

## Examples

### cURL

```bash
curl -X GET 'http://localhost:8006/api/v1/workspaces?skip=0&limit=20'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8006/api/v1/workspaces?skip=0&limit=20', {
  method: 'GET',
});

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

### Python

```python
import requests

response = requests.get('http://localhost:8006/api/v1/workspaces?skip=0&limit=20')
print(response.text)
```


## Create Workspace

`POST /api/v1/workspaces`

Authentication: no security requirement declared for this operation.

Request body: application/json (required)

Type: object

Schema: [WorkspaceService_WorkspaceCreateDTO](/api-reference/schemas/workspaceservice-workspacecreatedto-a1f26cbaf5.md)

- `name` (required)
  Type: string
  
  minLength: 1
  
  maxLength: 255

- `description` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

Responses:

- 201: Successful Response

Content type: application/json

Type: object

Schema: [WorkspaceService_WorkspaceResponseDTO](/api-reference/schemas/workspaceservice-workspaceresponsedto-4de4578a77.md)

- `id` (required)
  Type: string, uuid

- `tenant_id` (required)
  Type: string, uuid

- `name` (required)
  Type: string

- `description` (required)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `status` (required)
  Type: string

- `created_at` (required)
  Type: string, date-time

- `updated_at` (required)
  Type: string, date-time

- `created_by` (required)
  Type: string, uuid

- 422: Validation Error

Content type: application/json

Type: object

Schema: [WorkspaceService_HTTPValidationError](/api-reference/schemas/workspaceservice-httpvalidationerror-92a261e7a3.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [WorkspaceService_ValidationError](/api-reference/schemas/workspaceservice-validationerror-9662acef93.md); Type: object

## Examples

### cURL

```bash
curl -X POST 'http://localhost:8006/api/v1/workspaces' \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "name": "string",
  "description": "string"
}'
```

### JavaScript

```javascript
const body = `{
  "name": "string",
  "description": "string"
}`;

const response = await fetch('http://localhost:8006/api/v1/workspaces', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
  },
  body,
});

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

### Python

```python
import requests

body = '''{
  "name": "string",
  "description": "string"
}'''

response = requests.post(
    'http://localhost:8006/api/v1/workspaces',
    data=body.encode('utf-8'),
    headers={
        'Content-Type': 'application/json',
    },
)
print(response.text)
```


## Get Workspace

`GET /api/v1/workspaces/{workspace_id}`

Authentication: no security requirement declared for this operation.

Parameters:

- `workspace_id` (path, string, uuid, required)
  Type: string, uuid

Responses:

- 200: Successful Response

Content type: application/json

Type: object

Schema: [WorkspaceService_WorkspaceResponseDTO](/api-reference/schemas/workspaceservice-workspaceresponsedto-4de4578a77.md)

- `id` (required)
  Type: string, uuid

- `tenant_id` (required)
  Type: string, uuid

- `name` (required)
  Type: string

- `description` (required)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `status` (required)
  Type: string

- `created_at` (required)
  Type: string, date-time

- `updated_at` (required)
  Type: string, date-time

- `created_by` (required)
  Type: string, uuid

- 422: Validation Error

Content type: application/json

Type: object

Schema: [WorkspaceService_HTTPValidationError](/api-reference/schemas/workspaceservice-httpvalidationerror-92a261e7a3.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [WorkspaceService_ValidationError](/api-reference/schemas/workspaceservice-validationerror-9662acef93.md); Type: object

## Examples

### cURL

```bash
curl -X GET 'http://localhost:8006/api/v1/workspaces/550e8400-e29b-41d4-a716-446655440000'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8006/api/v1/workspaces/550e8400-e29b-41d4-a716-446655440000', {
  method: 'GET',
});

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

### Python

```python
import requests

response = requests.get('http://localhost:8006/api/v1/workspaces/550e8400-e29b-41d4-a716-446655440000')
print(response.text)
```


## Update Workspace

`PUT /api/v1/workspaces/{workspace_id}`

Authentication: no security requirement declared for this operation.

Parameters:

- `workspace_id` (path, string, uuid, required)
  Type: string, uuid

Request body: application/json (required)

Type: object

Schema: [WorkspaceService_WorkspaceUpdateDTO](/api-reference/schemas/workspaceservice-workspaceupdatedto-67c3d9a327.md)

- `name` (optional)
  Type: unknown
  
  anyOf:
    Type: string
    
    minLength: 1
    
    maxLength: 255
  
    Type: null

- `description` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `status` (optional)
  Type: unknown
  
  anyOf:
    Reference: [WorkspaceService_WorkspaceStatus](/api-reference/schemas/workspaceservice-workspacestatus-652b9c3598.md); Type: string
    
    enum: ["active","archived","suspended","deleted"]
  
    Type: null

Responses:

- 200: Successful Response

Content type: application/json

Type: object

Schema: [WorkspaceService_WorkspaceResponseDTO](/api-reference/schemas/workspaceservice-workspaceresponsedto-4de4578a77.md)

- `id` (required)
  Type: string, uuid

- `tenant_id` (required)
  Type: string, uuid

- `name` (required)
  Type: string

- `description` (required)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `status` (required)
  Type: string

- `created_at` (required)
  Type: string, date-time

- `updated_at` (required)
  Type: string, date-time

- `created_by` (required)
  Type: string, uuid

- 422: Validation Error

Content type: application/json

Type: object

Schema: [WorkspaceService_HTTPValidationError](/api-reference/schemas/workspaceservice-httpvalidationerror-92a261e7a3.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [WorkspaceService_ValidationError](/api-reference/schemas/workspaceservice-validationerror-9662acef93.md); Type: object

## Examples

### cURL

```bash
curl -X PUT 'http://localhost:8006/api/v1/workspaces/550e8400-e29b-41d4-a716-446655440000' \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "name": "string",
  "description": "string",
  "status": "active"
}'
```

### JavaScript

```javascript
const body = `{
  "name": "string",
  "description": "string",
  "status": "active"
}`;

const response = await fetch('http://localhost:8006/api/v1/workspaces/550e8400-e29b-41d4-a716-446655440000', {
  method: 'PUT',
  headers: {
    'Content-Type': 'application/json',
  },
  body,
});

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

### Python

```python
import requests

body = '''{
  "name": "string",
  "description": "string",
  "status": "active"
}'''

response = requests.put(
    'http://localhost:8006/api/v1/workspaces/550e8400-e29b-41d4-a716-446655440000',
    data=body.encode('utf-8'),
    headers={
        'Content-Type': 'application/json',
    },
)
print(response.text)
```


## Delete Workspace

`DELETE /api/v1/workspaces/{workspace_id}`

Authentication: no security requirement declared for this operation.

Parameters:

- `workspace_id` (path, string, uuid, required)
  Type: string, uuid

Responses:

- 202: Successful Response

Content type: application/json

Type: unknown

- 422: Validation Error

Content type: application/json

Type: object

Schema: [WorkspaceService_HTTPValidationError](/api-reference/schemas/workspaceservice-httpvalidationerror-92a261e7a3.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [WorkspaceService_ValidationError](/api-reference/schemas/workspaceservice-validationerror-9662acef93.md); Type: object

## Examples

### cURL

```bash
curl -X DELETE 'http://localhost:8006/api/v1/workspaces/550e8400-e29b-41d4-a716-446655440000'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8006/api/v1/workspaces/550e8400-e29b-41d4-a716-446655440000', {
  method: 'DELETE',
});

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

### Python

```python
import requests

response = requests.delete('http://localhost:8006/api/v1/workspaces/550e8400-e29b-41d4-a716-446655440000')
print(response.text)
```


## List Members

`GET /api/v1/workspaces/{workspace_id}/members`

Authentication: no security requirement declared for this operation.

Parameters:

- `workspace_id` (path, string, uuid, required)
  Type: string, uuid

- `skip` (query, integer, optional)
  Type: integer
  
  default: 0
  
  minimum: 0

- `limit` (query, integer, optional)
  Type: integer
  
  default: 20
  
  minimum: 1
  
  maximum: 100

Responses:

- 200: Successful Response

Content type: application/json

Type: object

Schema: [WorkspaceService_MemberListDTO](/api-reference/schemas/workspaceservice-memberlistdto-fe1eb49881.md)

- `items` (required)
  Type: array
  
  Items:
    Reference: [WorkspaceService_MemberResponseDTO](/api-reference/schemas/workspaceservice-memberresponsedto-e53a9b7ac0.md); Type: object

- `total` (required)
  Type: integer

- `skip` (required)
  Type: integer

- `limit` (required)
  Type: integer

- `has_next` (required)
  Type: boolean

- `has_previous` (required)
  Type: boolean

- 422: Validation Error

Content type: application/json

Type: object

Schema: [WorkspaceService_HTTPValidationError](/api-reference/schemas/workspaceservice-httpvalidationerror-92a261e7a3.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [WorkspaceService_ValidationError](/api-reference/schemas/workspaceservice-validationerror-9662acef93.md); Type: object

## Examples

### cURL

```bash
curl -X GET 'http://localhost:8006/api/v1/workspaces/550e8400-e29b-41d4-a716-446655440000/members?skip=0&limit=20'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8006/api/v1/workspaces/550e8400-e29b-41d4-a716-446655440000/members?skip=0&limit=20', {
  method: 'GET',
});

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

### Python

```python
import requests

response = requests.get('http://localhost:8006/api/v1/workspaces/550e8400-e29b-41d4-a716-446655440000/members?skip=0&limit=20')
print(response.text)
```


## Add Member

`POST /api/v1/workspaces/{workspace_id}/members`

Authentication: no security requirement declared for this operation.

Parameters:

- `workspace_id` (path, string, uuid, required)
  Type: string, uuid

Request body: application/json (required)

Type: object

Schema: [WorkspaceService_MemberAddDTO](/api-reference/schemas/workspaceservice-memberadddto-46f3ade998.md)

- `user_id` (required)
  Type: string

- `role` (optional)
  Reference: [WorkspaceService_WorkspaceMemberRole](/api-reference/schemas/workspaceservice-workspacememberrole-c3d06b523e.md); Type: string
  
  default: "viewer"
  
  enum: ["owner","admin","editor","viewer","responder"]

Responses:

- 201: Successful Response

Content type: application/json

Type: object

Schema: [WorkspaceService_MemberResponseDTO](/api-reference/schemas/workspaceservice-memberresponsedto-e53a9b7ac0.md)

- `id` (required)
  Type: string, uuid

- `workspace_id` (required)
  Type: string, uuid

- `user_id` (required)
  Type: string, uuid

- `tenant_id` (required)
  Type: string, uuid

- `role` (required)
  Type: string

- `invited_by` (required)
  Type: unknown
  
  anyOf:
    Type: string, uuid
  
    Type: null

- `joined_at` (required)
  Type: string, date-time

- `created_at` (required)
  Type: string, date-time

- `updated_at` (required)
  Type: string, date-time

- `user_email` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `user_name` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- 422: Validation Error

Content type: application/json

Type: object

Schema: [WorkspaceService_HTTPValidationError](/api-reference/schemas/workspaceservice-httpvalidationerror-92a261e7a3.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [WorkspaceService_ValidationError](/api-reference/schemas/workspaceservice-validationerror-9662acef93.md); Type: object

## Examples

### cURL

```bash
curl -X POST 'http://localhost:8006/api/v1/workspaces/550e8400-e29b-41d4-a716-446655440000/members' \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "user_id": "string",
  "role": "viewer"
}'
```

### JavaScript

```javascript
const body = `{
  "user_id": "string",
  "role": "viewer"
}`;

const response = await fetch('http://localhost:8006/api/v1/workspaces/550e8400-e29b-41d4-a716-446655440000/members', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
  },
  body,
});

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

### Python

```python
import requests

body = '''{
  "user_id": "string",
  "role": "viewer"
}'''

response = requests.post(
    'http://localhost:8006/api/v1/workspaces/550e8400-e29b-41d4-a716-446655440000/members',
    data=body.encode('utf-8'),
    headers={
        'Content-Type': 'application/json',
    },
)
print(response.text)
```


## Update Member Role

`PUT /api/v1/workspaces/{workspace_id}/members/{member_user_id}`

Authentication: no security requirement declared for this operation.

Parameters:

- `workspace_id` (path, string, uuid, required)
  Type: string, uuid

- `member_user_id` (path, string, uuid, required)
  Type: string, uuid

Request body: application/json (required)

Type: object

Schema: [WorkspaceService_MemberUpdateDTO](/api-reference/schemas/workspaceservice-memberupdatedto-f0ab1bb005.md)

- `role` (required)
  Reference: [WorkspaceService_WorkspaceMemberRole](/api-reference/schemas/workspaceservice-workspacememberrole-c3d06b523e.md); Type: string
  
  enum: ["owner","admin","editor","viewer","responder"]

Responses:

- 200: Successful Response

Content type: application/json

Type: object

Schema: [WorkspaceService_MemberResponseDTO](/api-reference/schemas/workspaceservice-memberresponsedto-e53a9b7ac0.md)

- `id` (required)
  Type: string, uuid

- `workspace_id` (required)
  Type: string, uuid

- `user_id` (required)
  Type: string, uuid

- `tenant_id` (required)
  Type: string, uuid

- `role` (required)
  Type: string

- `invited_by` (required)
  Type: unknown
  
  anyOf:
    Type: string, uuid
  
    Type: null

- `joined_at` (required)
  Type: string, date-time

- `created_at` (required)
  Type: string, date-time

- `updated_at` (required)
  Type: string, date-time

- `user_email` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `user_name` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- 422: Validation Error

Content type: application/json

Type: object

Schema: [WorkspaceService_HTTPValidationError](/api-reference/schemas/workspaceservice-httpvalidationerror-92a261e7a3.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [WorkspaceService_ValidationError](/api-reference/schemas/workspaceservice-validationerror-9662acef93.md); Type: object

## Examples

### cURL

```bash
curl -X PUT 'http://localhost:8006/api/v1/workspaces/550e8400-e29b-41d4-a716-446655440000/members/550e8400-e29b-41d4-a716-446655440000' \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "role": "owner"
}'
```

### JavaScript

```javascript
const body = `{
  "role": "owner"
}`;

const response = await fetch('http://localhost:8006/api/v1/workspaces/550e8400-e29b-41d4-a716-446655440000/members/550e8400-e29b-41d4-a716-446655440000', {
  method: 'PUT',
  headers: {
    'Content-Type': 'application/json',
  },
  body,
});

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

### Python

```python
import requests

body = '''{
  "role": "owner"
}'''

response = requests.put(
    'http://localhost:8006/api/v1/workspaces/550e8400-e29b-41d4-a716-446655440000/members/550e8400-e29b-41d4-a716-446655440000',
    data=body.encode('utf-8'),
    headers={
        'Content-Type': 'application/json',
    },
)
print(response.text)
```


## Remove Member

`DELETE /api/v1/workspaces/{workspace_id}/members/{member_user_id}`

Authentication: no security requirement declared for this operation.

Parameters:

- `workspace_id` (path, string, uuid, required)
  Type: string, uuid

- `member_user_id` (path, string, uuid, required)
  Type: string, uuid

Responses:

- 200: Successful Response

Content type: application/json

Type: unknown

- 422: Validation Error

Content type: application/json

Type: object

Schema: [WorkspaceService_HTTPValidationError](/api-reference/schemas/workspaceservice-httpvalidationerror-92a261e7a3.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [WorkspaceService_ValidationError](/api-reference/schemas/workspaceservice-validationerror-9662acef93.md); Type: object

## Examples

### cURL

```bash
curl -X DELETE 'http://localhost:8006/api/v1/workspaces/550e8400-e29b-41d4-a716-446655440000/members/550e8400-e29b-41d4-a716-446655440000'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8006/api/v1/workspaces/550e8400-e29b-41d4-a716-446655440000/members/550e8400-e29b-41d4-a716-446655440000', {
  method: 'DELETE',
});

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

### Python

```python
import requests

response = requests.delete('http://localhost:8006/api/v1/workspaces/550e8400-e29b-41d4-a716-446655440000/members/550e8400-e29b-41d4-a716-446655440000')
print(response.text)
```


## Get Member Usage

`GET /api/v1/workspaces/members/usage`

Return the tenant-scoped usage snapshot for the enforced member entitlement.

The current backend limit is membership-row based, not unique tenant seats.
A user added to two workspaces consumes two memberships.

Authentication: no security requirement declared for this operation.

Responses:

- 200: Successful Response

Content type: application/json

Type: unknown

## Examples

### cURL

```bash
curl -X GET 'http://localhost:8006/api/v1/workspaces/members/usage'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8006/api/v1/workspaces/members/usage', {
  method: 'GET',
});

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

### Python

```python
import requests

response = requests.get('http://localhost:8006/api/v1/workspaces/members/usage')
print(response.text)
```


## List Projects

`GET /api/v1/workspaces/{workspace_id}/projects`

Authentication: no security requirement declared for this operation.

Parameters:

- `workspace_id` (path, string, uuid, required)
  Type: string, uuid

- `skip` (query, integer, optional)
  Type: integer
  
  default: 0
  
  minimum: 0

- `limit` (query, integer, optional)
  Type: integer
  
  default: 20
  
  minimum: 1
  
  maximum: 100

- `status_filter` (query, unknown, optional)
  Type: unknown
  
  anyOf:
    Reference: [WorkspaceService_ProjectStatus](/api-reference/schemas/workspaceservice-projectstatus-d27a31ff2e.md); Type: string
    
    enum: ["draft","active","completed","archived","deleted"]
  
    Type: null

- `search` (query, unknown, optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

Responses:

- 200: Successful Response

Content type: application/json

Type: object

Schema: [WorkspaceService_ProjectListDTO](/api-reference/schemas/workspaceservice-projectlistdto-a0f0daa6c6.md)

- `items` (required)
  Type: array
  
  Items:
    Reference: [WorkspaceService_ProjectResponseDTO](/api-reference/schemas/workspaceservice-projectresponsedto-4a7146f3a1.md); Type: object

- `total` (required)
  Type: integer

- `skip` (required)
  Type: integer

- `limit` (required)
  Type: integer

- `has_next` (required)
  Type: boolean

- `has_previous` (required)
  Type: boolean

- 422: Validation Error

Content type: application/json

Type: object

Schema: [WorkspaceService_HTTPValidationError](/api-reference/schemas/workspaceservice-httpvalidationerror-92a261e7a3.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [WorkspaceService_ValidationError](/api-reference/schemas/workspaceservice-validationerror-9662acef93.md); Type: object

## Examples

### cURL

```bash
curl -X GET 'http://localhost:8006/api/v1/workspaces/550e8400-e29b-41d4-a716-446655440000/projects?skip=0&limit=20'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8006/api/v1/workspaces/550e8400-e29b-41d4-a716-446655440000/projects?skip=0&limit=20', {
  method: 'GET',
});

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

### Python

```python
import requests

response = requests.get('http://localhost:8006/api/v1/workspaces/550e8400-e29b-41d4-a716-446655440000/projects?skip=0&limit=20')
print(response.text)
```


## Create Project

`POST /api/v1/workspaces/{workspace_id}/projects`

Authentication: no security requirement declared for this operation.

Parameters:

- `workspace_id` (path, string, uuid, required)
  Type: string, uuid

Request body: application/json (required)

Type: object

Schema: [WorkspaceService_ProjectCreateDTO](/api-reference/schemas/workspaceservice-projectcreatedto-e7bed61243.md)

- `name` (required)
  Type: string
  
  minLength: 1
  
  maxLength: 255

- `description` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

Responses:

- 201: Successful Response

Content type: application/json

Type: object

Schema: [WorkspaceService_ProjectResponseDTO](/api-reference/schemas/workspaceservice-projectresponsedto-4a7146f3a1.md)

- `id` (required)
  Type: string, uuid

- `workspace_id` (required)
  Type: string, uuid

- `tenant_id` (required)
  Type: string, uuid

- `name` (required)
  Type: string

- `description` (required)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `status` (required)
  Type: string

- `has_production_activity` (optional)
  Type: boolean
  
  default: false

- `production_activity_at` (optional)
  Type: unknown
  
  anyOf:
    Type: string, date-time
  
    Type: null

- `created_at` (required)
  Type: string, date-time

- `updated_at` (required)
  Type: string, date-time

- `created_by` (required)
  Type: string, uuid

- 422: Validation Error

Content type: application/json

Type: object

Schema: [WorkspaceService_HTTPValidationError](/api-reference/schemas/workspaceservice-httpvalidationerror-92a261e7a3.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [WorkspaceService_ValidationError](/api-reference/schemas/workspaceservice-validationerror-9662acef93.md); Type: object

## Examples

### cURL

```bash
curl -X POST 'http://localhost:8006/api/v1/workspaces/550e8400-e29b-41d4-a716-446655440000/projects' \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "name": "string",
  "description": "string"
}'
```

### JavaScript

```javascript
const body = `{
  "name": "string",
  "description": "string"
}`;

const response = await fetch('http://localhost:8006/api/v1/workspaces/550e8400-e29b-41d4-a716-446655440000/projects', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
  },
  body,
});

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

### Python

```python
import requests

body = '''{
  "name": "string",
  "description": "string"
}'''

response = requests.post(
    'http://localhost:8006/api/v1/workspaces/550e8400-e29b-41d4-a716-446655440000/projects',
    data=body.encode('utf-8'),
    headers={
        'Content-Type': 'application/json',
    },
)
print(response.text)
```


## Get Project By Workspace

`GET /api/v1/workspaces/{workspace_id}/projects/{project_id}`

Authentication: no security requirement declared for this operation.

Parameters:

- `workspace_id` (path, string, uuid, required)
  Type: string, uuid

- `project_id` (path, string, uuid, required)
  Type: string, uuid

Responses:

- 200: Successful Response

Content type: application/json

Type: object

Schema: [WorkspaceService_ProjectResponseDTO](/api-reference/schemas/workspaceservice-projectresponsedto-4a7146f3a1.md)

- `id` (required)
  Type: string, uuid

- `workspace_id` (required)
  Type: string, uuid

- `tenant_id` (required)
  Type: string, uuid

- `name` (required)
  Type: string

- `description` (required)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `status` (required)
  Type: string

- `has_production_activity` (optional)
  Type: boolean
  
  default: false

- `production_activity_at` (optional)
  Type: unknown
  
  anyOf:
    Type: string, date-time
  
    Type: null

- `created_at` (required)
  Type: string, date-time

- `updated_at` (required)
  Type: string, date-time

- `created_by` (required)
  Type: string, uuid

- 422: Validation Error

Content type: application/json

Type: object

Schema: [WorkspaceService_HTTPValidationError](/api-reference/schemas/workspaceservice-httpvalidationerror-92a261e7a3.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [WorkspaceService_ValidationError](/api-reference/schemas/workspaceservice-validationerror-9662acef93.md); Type: object

## Examples

### cURL

```bash
curl -X GET 'http://localhost:8006/api/v1/workspaces/550e8400-e29b-41d4-a716-446655440000/projects/550e8400-e29b-41d4-a716-446655440000'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8006/api/v1/workspaces/550e8400-e29b-41d4-a716-446655440000/projects/550e8400-e29b-41d4-a716-446655440000', {
  method: 'GET',
});

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

### Python

```python
import requests

response = requests.get('http://localhost:8006/api/v1/workspaces/550e8400-e29b-41d4-a716-446655440000/projects/550e8400-e29b-41d4-a716-446655440000')
print(response.text)
```


## Update Project By Workspace

`PUT /api/v1/workspaces/{workspace_id}/projects/{project_id}`

Authentication: no security requirement declared for this operation.

Parameters:

- `workspace_id` (path, string, uuid, required)
  Type: string, uuid

- `project_id` (path, string, uuid, required)
  Type: string, uuid

Request body: application/json (required)

Type: object

Schema: [WorkspaceService_ProjectUpdateDTO](/api-reference/schemas/workspaceservice-projectupdatedto-f68dedb1d5.md)

- `name` (optional)
  Type: unknown
  
  anyOf:
    Type: string
    
    minLength: 1
    
    maxLength: 255
  
    Type: null

- `description` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `status` (optional)
  Type: unknown
  
  anyOf:
    Reference: [WorkspaceService_ProjectStatus](/api-reference/schemas/workspaceservice-projectstatus-d27a31ff2e.md); Type: string
    
    enum: ["draft","active","completed","archived","deleted"]
  
    Type: null

Responses:

- 200: Successful Response

Content type: application/json

Type: object

Schema: [WorkspaceService_ProjectResponseDTO](/api-reference/schemas/workspaceservice-projectresponsedto-4a7146f3a1.md)

- `id` (required)
  Type: string, uuid

- `workspace_id` (required)
  Type: string, uuid

- `tenant_id` (required)
  Type: string, uuid

- `name` (required)
  Type: string

- `description` (required)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `status` (required)
  Type: string

- `has_production_activity` (optional)
  Type: boolean
  
  default: false

- `production_activity_at` (optional)
  Type: unknown
  
  anyOf:
    Type: string, date-time
  
    Type: null

- `created_at` (required)
  Type: string, date-time

- `updated_at` (required)
  Type: string, date-time

- `created_by` (required)
  Type: string, uuid

- 422: Validation Error

Content type: application/json

Type: object

Schema: [WorkspaceService_HTTPValidationError](/api-reference/schemas/workspaceservice-httpvalidationerror-92a261e7a3.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [WorkspaceService_ValidationError](/api-reference/schemas/workspaceservice-validationerror-9662acef93.md); Type: object

## Examples

### cURL

```bash
curl -X PUT 'http://localhost:8006/api/v1/workspaces/550e8400-e29b-41d4-a716-446655440000/projects/550e8400-e29b-41d4-a716-446655440000' \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "name": "string",
  "description": "string",
  "status": "draft"
}'
```

### JavaScript

```javascript
const body = `{
  "name": "string",
  "description": "string",
  "status": "draft"
}`;

const response = await fetch('http://localhost:8006/api/v1/workspaces/550e8400-e29b-41d4-a716-446655440000/projects/550e8400-e29b-41d4-a716-446655440000', {
  method: 'PUT',
  headers: {
    'Content-Type': 'application/json',
  },
  body,
});

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

### Python

```python
import requests

body = '''{
  "name": "string",
  "description": "string",
  "status": "draft"
}'''

response = requests.put(
    'http://localhost:8006/api/v1/workspaces/550e8400-e29b-41d4-a716-446655440000/projects/550e8400-e29b-41d4-a716-446655440000',
    data=body.encode('utf-8'),
    headers={
        'Content-Type': 'application/json',
    },
)
print(response.text)
```


## Delete Project By Workspace

`DELETE /api/v1/workspaces/{workspace_id}/projects/{project_id}`

Authentication: no security requirement declared for this operation.

Parameters:

- `workspace_id` (path, string, uuid, required)
  Type: string, uuid

- `project_id` (path, string, uuid, required)
  Type: string, uuid

Responses:

- 202: Successful Response

Content type: application/json

Type: unknown

- 422: Validation Error

Content type: application/json

Type: object

Schema: [WorkspaceService_HTTPValidationError](/api-reference/schemas/workspaceservice-httpvalidationerror-92a261e7a3.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [WorkspaceService_ValidationError](/api-reference/schemas/workspaceservice-validationerror-9662acef93.md); Type: object

## Examples

### cURL

```bash
curl -X DELETE 'http://localhost:8006/api/v1/workspaces/550e8400-e29b-41d4-a716-446655440000/projects/550e8400-e29b-41d4-a716-446655440000'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8006/api/v1/workspaces/550e8400-e29b-41d4-a716-446655440000/projects/550e8400-e29b-41d4-a716-446655440000', {
  method: 'DELETE',
});

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

### Python

```python
import requests

response = requests.delete('http://localhost:8006/api/v1/workspaces/550e8400-e29b-41d4-a716-446655440000/projects/550e8400-e29b-41d4-a716-446655440000')
print(response.text)
```


## Get Project Lifecycle

`GET /api/v1/workspaces/{workspace_id}/projects/{project_id}/lifecycle`

Read the lifecycle state of a project (internal).

Returns status + the monotonic production-activity invariant WITHOUT any
user-RBAC requirement, so peer services can gate production operations for
enumerator-context callers (who lack PROJECT_READ). Service-token auth only.

Authentication: no security requirement declared for this operation.

Parameters:

- `workspace_id` (path, string, uuid, required)
  Type: string, uuid

- `project_id` (path, string, uuid, required)
  Type: string, uuid

Responses:

- 200: Successful Response

Content type: application/json

Type: unknown

- 422: Validation Error

Content type: application/json

Type: object

Schema: [WorkspaceService_HTTPValidationError](/api-reference/schemas/workspaceservice-httpvalidationerror-92a261e7a3.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [WorkspaceService_ValidationError](/api-reference/schemas/workspaceservice-validationerror-9662acef93.md); Type: object

## Examples

### cURL

```bash
curl -X GET 'http://localhost:8006/api/v1/workspaces/550e8400-e29b-41d4-a716-446655440000/projects/550e8400-e29b-41d4-a716-446655440000/lifecycle'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8006/api/v1/workspaces/550e8400-e29b-41d4-a716-446655440000/projects/550e8400-e29b-41d4-a716-446655440000/lifecycle', {
  method: 'GET',
});

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

### Python

```python
import requests

response = requests.get('http://localhost:8006/api/v1/workspaces/550e8400-e29b-41d4-a716-446655440000/projects/550e8400-e29b-41d4-a716-446655440000/lifecycle')
print(response.text)
```


## Mark Production Activity

`POST /api/v1/workspaces/{workspace_id}/projects/{project_id}/production-activity`

Mark that production collection has begun for a project (internal).

Sets the durable monotonic invariant `has_production_activity` — called by
peer services (via the survey-service broker) at the first production
interview/response/media event. Idempotent; set-only; never cleared.

- Project DRAFT     -> 409 project_not_active (collection cannot begin)
- Project COMPLETED/ARCHIVED with invariant FALSE -> 409 collection_closed
- Project ACTIVE    -> invariant set to TRUE (no-op if already set)

Authentication: no security requirement declared for this operation.

Parameters:

- `workspace_id` (path, string, uuid, required)
  Type: string, uuid

- `project_id` (path, string, uuid, required)
  Type: string, uuid

Responses:

- 200: Successful Response

Content type: application/json

Type: unknown

- 422: Validation Error

Content type: application/json

Type: object

Schema: [WorkspaceService_HTTPValidationError](/api-reference/schemas/workspaceservice-httpvalidationerror-92a261e7a3.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [WorkspaceService_ValidationError](/api-reference/schemas/workspaceservice-validationerror-9662acef93.md); Type: object

## Examples

### cURL

```bash
curl -X POST 'http://localhost:8006/api/v1/workspaces/550e8400-e29b-41d4-a716-446655440000/projects/550e8400-e29b-41d4-a716-446655440000/production-activity'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8006/api/v1/workspaces/550e8400-e29b-41d4-a716-446655440000/projects/550e8400-e29b-41d4-a716-446655440000/production-activity', {
  method: 'POST',
});

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

### Python

```python
import requests

response = requests.post('http://localhost:8006/api/v1/workspaces/550e8400-e29b-41d4-a716-446655440000/projects/550e8400-e29b-41d4-a716-446655440000/production-activity')
print(response.text)
```


## List Subscriptions

`GET /api/v1/webhooks/subscriptions`

List all webhook subscriptions for the tenant.

Authentication: no security requirement declared for this operation.

Parameters:

- `skip` (query, integer, optional)
  Type: integer
  
  default: 0
  
  minimum: 0

- `limit` (query, integer, optional)
  Type: integer
  
  default: 20
  
  minimum: 1
  
  maximum: 100

- `is_active` (query, unknown, optional)
  Type: unknown
  
  anyOf:
    Type: boolean
  
    Type: null

Responses:

- 200: Successful Response

Content type: application/json

Type: object

DTO for list of webhook subscriptions.

Schema: [WebhookService_SubscriptionListDTO](/api-reference/schemas/webhookservice-subscriptionlistdto-96134a4012.md)

- `items` (required)
  Type: array
  
  Items:
    Reference: [WebhookService_SubscriptionResponseDTO](/api-reference/schemas/webhookservice-subscriptionresponsedto-ad3230cd18.md); Type: object
    
    DTO for webhook subscription response.

- `total` (required)
  Type: integer

- `skip` (required)
  Type: integer

- `limit` (required)
  Type: integer

- `has_next` (required)
  Type: boolean

- `has_previous` (required)
  Type: boolean

- 422: Validation Error

Content type: application/json

Type: object

Schema: [WebhookService_HTTPValidationError](/api-reference/schemas/webhookservice-httpvalidationerror-119a4c7db4.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [WebhookService_ValidationError](/api-reference/schemas/webhookservice-validationerror-f46d3ea8f8.md); Type: object

## Examples

### cURL

```bash
curl -X GET 'http://localhost:8007/api/v1/webhooks/subscriptions?skip=0&limit=20'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8007/api/v1/webhooks/subscriptions?skip=0&limit=20', {
  method: 'GET',
});

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

### Python

```python
import requests

response = requests.get('http://localhost:8007/api/v1/webhooks/subscriptions?skip=0&limit=20')
print(response.text)
```


## Create Subscription

`POST /api/v1/webhooks/subscriptions`

Create a new webhook subscription.

Authentication: no security requirement declared for this operation.

Request body: application/json (required)

Type: object

DTO for creating a webhook subscription.

Schema: [WebhookService_CreateSubscriptionDTO](/api-reference/schemas/webhookservice-createsubscriptiondto-5be2bbdf3a.md)

- `name` (required)
  Type: string
  
  minLength: 1
  
  maxLength: 255

- `url` (required)
  Type: string
  
  maxLength: 2048

- `event_types` (required)
  Type: array
  
  minItems: 1
  
  Items:
    Type: string

- `survey_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `project_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `workspace_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `secret` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

Responses:

- 201: Successful Response

Content type: application/json

Type: object

DTO for webhook subscription response.

Schema: [WebhookService_SubscriptionResponseDTO](/api-reference/schemas/webhookservice-subscriptionresponsedto-ad3230cd18.md)

- `id` (required)
  Type: string

- `name` (required)
  Type: string

- `url` (required)
  Type: string

- `event_types` (required)
  Type: array
  
  Items:
    Type: string

- `survey_id` (required)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `project_id` (required)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `workspace_id` (required)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `is_active` (required)
  Type: boolean

- `created_at` (required)
  Type: string, date-time

- `updated_at` (required)
  Type: string, date-time

- 422: Validation Error

Content type: application/json

Type: object

Schema: [WebhookService_HTTPValidationError](/api-reference/schemas/webhookservice-httpvalidationerror-119a4c7db4.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [WebhookService_ValidationError](/api-reference/schemas/webhookservice-validationerror-f46d3ea8f8.md); Type: object

## Examples

### cURL

```bash
curl -X POST 'http://localhost:8007/api/v1/webhooks/subscriptions' \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "name": "string",
  "url": "string",
  "event_types": [
    "string"
  ],
  "survey_id": "string",
  "project_id": "string",
  "workspace_id": "string",
  "secret": "string"
}'
```

### JavaScript

```javascript
const body = `{
  "name": "string",
  "url": "string",
  "event_types": [
    "string"
  ],
  "survey_id": "string",
  "project_id": "string",
  "workspace_id": "string",
  "secret": "string"
}`;

const response = await fetch('http://localhost:8007/api/v1/webhooks/subscriptions', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
  },
  body,
});

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

### Python

```python
import requests

body = '''{
  "name": "string",
  "url": "string",
  "event_types": [
    "string"
  ],
  "survey_id": "string",
  "project_id": "string",
  "workspace_id": "string",
  "secret": "string"
}'''

response = requests.post(
    'http://localhost:8007/api/v1/webhooks/subscriptions',
    data=body.encode('utf-8'),
    headers={
        'Content-Type': 'application/json',
    },
)
print(response.text)
```


## Get Subscription

`GET /api/v1/webhooks/subscriptions/{subscription_id}`

Get a specific webhook subscription.

Authentication: no security requirement declared for this operation.

Parameters:

- `subscription_id` (path, string, required)
  Type: string

Responses:

- 200: Successful Response

Content type: application/json

Type: object

DTO for webhook subscription response.

Schema: [WebhookService_SubscriptionResponseDTO](/api-reference/schemas/webhookservice-subscriptionresponsedto-ad3230cd18.md)

- `id` (required)
  Type: string

- `name` (required)
  Type: string

- `url` (required)
  Type: string

- `event_types` (required)
  Type: array
  
  Items:
    Type: string

- `survey_id` (required)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `project_id` (required)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `workspace_id` (required)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `is_active` (required)
  Type: boolean

- `created_at` (required)
  Type: string, date-time

- `updated_at` (required)
  Type: string, date-time

- 422: Validation Error

Content type: application/json

Type: object

Schema: [WebhookService_HTTPValidationError](/api-reference/schemas/webhookservice-httpvalidationerror-119a4c7db4.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [WebhookService_ValidationError](/api-reference/schemas/webhookservice-validationerror-f46d3ea8f8.md); Type: object

## Examples

### cURL

```bash
curl -X GET 'http://localhost:8007/api/v1/webhooks/subscriptions/string'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8007/api/v1/webhooks/subscriptions/string', {
  method: 'GET',
});

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

### Python

```python
import requests

response = requests.get('http://localhost:8007/api/v1/webhooks/subscriptions/string')
print(response.text)
```


## Update Subscription

`PUT /api/v1/webhooks/subscriptions/{subscription_id}`

Update a webhook subscription.

Authentication: no security requirement declared for this operation.

Parameters:

- `subscription_id` (path, string, required)
  Type: string

Request body: application/json (required)

Type: object

DTO for updating a webhook subscription.

Schema: [WebhookService_UpdateSubscriptionDTO](/api-reference/schemas/webhookservice-updatesubscriptiondto-65db636053.md)

- `name` (optional)
  Type: unknown
  
  anyOf:
    Type: string
    
    maxLength: 255
  
    Type: null

- `url` (optional)
  Type: unknown
  
  anyOf:
    Type: string
    
    maxLength: 2048
  
    Type: null

- `event_types` (optional)
  Type: unknown
  
  anyOf:
    Type: array
    
    Items:
      Type: string
  
    Type: null

- `is_active` (optional)
  Type: unknown
  
  anyOf:
    Type: boolean
  
    Type: null

Responses:

- 200: Successful Response

Content type: application/json

Type: object

DTO for webhook subscription response.

Schema: [WebhookService_SubscriptionResponseDTO](/api-reference/schemas/webhookservice-subscriptionresponsedto-ad3230cd18.md)

- `id` (required)
  Type: string

- `name` (required)
  Type: string

- `url` (required)
  Type: string

- `event_types` (required)
  Type: array
  
  Items:
    Type: string

- `survey_id` (required)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `project_id` (required)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `workspace_id` (required)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `is_active` (required)
  Type: boolean

- `created_at` (required)
  Type: string, date-time

- `updated_at` (required)
  Type: string, date-time

- 422: Validation Error

Content type: application/json

Type: object

Schema: [WebhookService_HTTPValidationError](/api-reference/schemas/webhookservice-httpvalidationerror-119a4c7db4.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [WebhookService_ValidationError](/api-reference/schemas/webhookservice-validationerror-f46d3ea8f8.md); Type: object

## Examples

### cURL

```bash
curl -X PUT 'http://localhost:8007/api/v1/webhooks/subscriptions/string' \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "name": "string",
  "url": "string",
  "event_types": [
    "string"
  ],
  "is_active": true
}'
```

### JavaScript

```javascript
const body = `{
  "name": "string",
  "url": "string",
  "event_types": [
    "string"
  ],
  "is_active": true
}`;

const response = await fetch('http://localhost:8007/api/v1/webhooks/subscriptions/string', {
  method: 'PUT',
  headers: {
    'Content-Type': 'application/json',
  },
  body,
});

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

### Python

```python
import requests

body = '''{
  "name": "string",
  "url": "string",
  "event_types": [
    "string"
  ],
  "is_active": true
}'''

response = requests.put(
    'http://localhost:8007/api/v1/webhooks/subscriptions/string',
    data=body.encode('utf-8'),
    headers={
        'Content-Type': 'application/json',
    },
)
print(response.text)
```


## Delete Subscription

`DELETE /api/v1/webhooks/subscriptions/{subscription_id}`

Delete a webhook subscription.

Authentication: no security requirement declared for this operation.

Parameters:

- `subscription_id` (path, string, required)
  Type: string

Responses:

- 204: Successful Response

- 422: Validation Error

Content type: application/json

Type: object

Schema: [WebhookService_HTTPValidationError](/api-reference/schemas/webhookservice-httpvalidationerror-119a4c7db4.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [WebhookService_ValidationError](/api-reference/schemas/webhookservice-validationerror-f46d3ea8f8.md); Type: object

## Examples

### cURL

```bash
curl -X DELETE 'http://localhost:8007/api/v1/webhooks/subscriptions/string'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8007/api/v1/webhooks/subscriptions/string', {
  method: 'DELETE',
});

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

### Python

```python
import requests

response = requests.delete('http://localhost:8007/api/v1/webhooks/subscriptions/string')
print(response.text)
```


## Toggle Subscription

`POST /api/v1/webhooks/subscriptions/{subscription_id}/toggle`

Toggle subscription active status.

Authentication: no security requirement declared for this operation.

Parameters:

- `subscription_id` (path, string, required)
  Type: string

Responses:

- 200: Successful Response

Content type: application/json

Type: unknown

- 422: Validation Error

Content type: application/json

Type: object

Schema: [WebhookService_HTTPValidationError](/api-reference/schemas/webhookservice-httpvalidationerror-119a4c7db4.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [WebhookService_ValidationError](/api-reference/schemas/webhookservice-validationerror-f46d3ea8f8.md); Type: object

## Examples

### cURL

```bash
curl -X POST 'http://localhost:8007/api/v1/webhooks/subscriptions/string/toggle'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8007/api/v1/webhooks/subscriptions/string/toggle', {
  method: 'POST',
});

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

### Python

```python
import requests

response = requests.post('http://localhost:8007/api/v1/webhooks/subscriptions/string/toggle')
print(response.text)
```


## Rotate Secret

`POST /api/v1/webhooks/subscriptions/{subscription_id}/rotate-secret`

Rotate the secret for a webhook subscription.

Authentication: no security requirement declared for this operation.

Parameters:

- `subscription_id` (path, string, required)
  Type: string

Responses:

- 200: Successful Response

Content type: application/json

Type: unknown

- 422: Validation Error

Content type: application/json

Type: object

Schema: [WebhookService_HTTPValidationError](/api-reference/schemas/webhookservice-httpvalidationerror-119a4c7db4.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [WebhookService_ValidationError](/api-reference/schemas/webhookservice-validationerror-f46d3ea8f8.md); Type: object

## Examples

### cURL

```bash
curl -X POST 'http://localhost:8007/api/v1/webhooks/subscriptions/string/rotate-secret'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8007/api/v1/webhooks/subscriptions/string/rotate-secret', {
  method: 'POST',
});

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

### Python

```python
import requests

response = requests.post('http://localhost:8007/api/v1/webhooks/subscriptions/string/rotate-secret')
print(response.text)
```


## Test Webhook

`POST /api/v1/webhooks/subscriptions/{subscription_id}/test`

Trigger a test event for a specific webhook subscription.

Authentication: no security requirement declared for this operation.

Parameters:

- `subscription_id` (path, string, required)
  Type: string

Responses:

- 200: Successful Response

Content type: application/json

Type: unknown

- 422: Validation Error

Content type: application/json

Type: object

Schema: [WebhookService_HTTPValidationError](/api-reference/schemas/webhookservice-httpvalidationerror-119a4c7db4.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [WebhookService_ValidationError](/api-reference/schemas/webhookservice-validationerror-f46d3ea8f8.md); Type: object

## Examples

### cURL

```bash
curl -X POST 'http://localhost:8007/api/v1/webhooks/subscriptions/string/test'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8007/api/v1/webhooks/subscriptions/string/test', {
  method: 'POST',
});

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

### Python

```python
import requests

response = requests.post('http://localhost:8007/api/v1/webhooks/subscriptions/string/test')
print(response.text)
```


## List Deliveries

`GET /api/v1/webhooks/deliveries`

List webhook deliveries for the tenant.

Authentication: no security requirement declared for this operation.

Parameters:

- `subscription_id` (query, unknown, optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `status` (query, unknown, optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `event_type` (query, unknown, optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `skip` (query, integer, optional)
  Type: integer
  
  default: 0
  
  minimum: 0

- `limit` (query, integer, optional)
  Type: integer
  
  default: 20
  
  minimum: 1
  
  maximum: 100

Responses:

- 200: Successful Response

Content type: application/json

Type: object

DTO for list of webhook deliveries.

Schema: [WebhookService_DeliveryListDTO](/api-reference/schemas/webhookservice-deliverylistdto-0b5fb8ee1b.md)

- `items` (required)
  Type: array
  
  Items:
    Reference: [WebhookService_DeliveryResponseDTO](/api-reference/schemas/webhookservice-deliveryresponsedto-6b960b3b2e.md); Type: object
    
    DTO for webhook delivery response.

- `total` (required)
  Type: integer

- `skip` (required)
  Type: integer

- `limit` (required)
  Type: integer

- `has_next` (required)
  Type: boolean

- `has_previous` (required)
  Type: boolean

- 422: Validation Error

Content type: application/json

Type: object

Schema: [WebhookService_HTTPValidationError](/api-reference/schemas/webhookservice-httpvalidationerror-119a4c7db4.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [WebhookService_ValidationError](/api-reference/schemas/webhookservice-validationerror-f46d3ea8f8.md); Type: object

## Examples

### cURL

```bash
curl -X GET 'http://localhost:8007/api/v1/webhooks/deliveries?skip=0&limit=20'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8007/api/v1/webhooks/deliveries?skip=0&limit=20', {
  method: 'GET',
});

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

### Python

```python
import requests

response = requests.get('http://localhost:8007/api/v1/webhooks/deliveries?skip=0&limit=20')
print(response.text)
```


## Get Delivery

`GET /api/v1/webhooks/deliveries/{delivery_id}`

Get details of a specific webhook delivery.

Authentication: no security requirement declared for this operation.

Parameters:

- `delivery_id` (path, string, required)
  Type: string

Responses:

- 200: Successful Response

Content type: application/json

Type: object

DTO for webhook delivery response.

Schema: [WebhookService_DeliveryResponseDTO](/api-reference/schemas/webhookservice-deliveryresponsedto-6b960b3b2e.md)

- `id` (required)
  Type: string

- `subscription_id` (required)
  Type: string

- `event_id` (required)
  Type: string

- `event_type` (required)
  Type: string

- `status` (required)
  Type: string

- `http_status` (required)
  Type: unknown
  
  anyOf:
    Type: integer
  
    Type: null

- `retry_count` (required)
  Type: integer

- `attempted_at` (required)
  Type: unknown
  
  anyOf:
    Type: string, date-time
  
    Type: null

- `delivered_at` (required)
  Type: unknown
  
  anyOf:
    Type: string, date-time
  
    Type: null

- `error_message` (required)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `created_at` (required)
  Type: string, date-time

- 422: Validation Error

Content type: application/json

Type: object

Schema: [WebhookService_HTTPValidationError](/api-reference/schemas/webhookservice-httpvalidationerror-119a4c7db4.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [WebhookService_ValidationError](/api-reference/schemas/webhookservice-validationerror-f46d3ea8f8.md); Type: object

## Examples

### cURL

```bash
curl -X GET 'http://localhost:8007/api/v1/webhooks/deliveries/string'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8007/api/v1/webhooks/deliveries/string', {
  method: 'GET',
});

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

### Python

```python
import requests

response = requests.get('http://localhost:8007/api/v1/webhooks/deliveries/string')
print(response.text)
```


## Retry Delivery

`POST /api/v1/webhooks/deliveries/{delivery_id}/retry`

Manually retry a failed webhook delivery.

Authentication: no security requirement declared for this operation.

Parameters:

- `delivery_id` (path, string, required)
  Type: string

Responses:

- 200: Successful Response

Content type: application/json

Type: unknown

- 422: Validation Error

Content type: application/json

Type: object

Schema: [WebhookService_HTTPValidationError](/api-reference/schemas/webhookservice-httpvalidationerror-119a4c7db4.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [WebhookService_ValidationError](/api-reference/schemas/webhookservice-validationerror-f46d3ea8f8.md); Type: object

## Examples

### cURL

```bash
curl -X POST 'http://localhost:8007/api/v1/webhooks/deliveries/string/retry'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8007/api/v1/webhooks/deliveries/string/retry', {
  method: 'POST',
});

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

### Python

```python
import requests

response = requests.post('http://localhost:8007/api/v1/webhooks/deliveries/string/retry')
print(response.text)
```


## Get Delivery Stats

`GET /api/v1/webhooks/deliveries/stats/overview`

Get delivery statistics for the tenant.

Authentication: no security requirement declared for this operation.

Responses:

- 200: Successful Response

Content type: application/json

Type: unknown

## Examples

### cURL

```bash
curl -X GET 'http://localhost:8007/api/v1/webhooks/deliveries/stats/overview'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8007/api/v1/webhooks/deliveries/stats/overview', {
  method: 'GET',
});

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

### Python

```python
import requests

response = requests.get('http://localhost:8007/api/v1/webhooks/deliveries/stats/overview')
print(response.text)
```


## Health Check

`GET /health`

Health check endpoint.

Also served by Quota Service at http://localhost:6380.

Authentication: no security requirement declared for this operation.

Responses:

- 200: Successful Response

Content type: application/json

Type: object

Additional properties: true

## Examples

### cURL

```bash
curl -X GET 'http://localhost:8009/health'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8009/health', {
  method: 'GET',
});

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

### Python

```python
import requests

response = requests.get('http://localhost:8009/health')
print(response.text)
```


## List Forms

`GET /formList`

OpenRosa Form List API
Returns XML list of available forms for the device/user

Authentication: no security requirement declared for this operation.

Parameters:

- `formID` (query, string, optional)
  Type: string

- `verbose` (query, boolean, optional)
  Type: boolean
  
  default: true

Responses:

- 200: Successful Response

Content type: application/json

Type: unknown

- 422: Validation Error

Content type: application/json

Type: object

Schema: [OdkBridge_HTTPValidationError](/api-reference/schemas/odkbridge-httpvalidationerror-4a5630f462.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [OdkBridge_ValidationError](/api-reference/schemas/odkbridge-validationerror-b831ec1b45.md); Type: object

## Examples

### cURL

```bash
curl -X GET 'http://localhost:8009/formList?verbose=true'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8009/formList?verbose=true', {
  method: 'GET',
});

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

### Python

```python
import requests

response = requests.get('http://localhost:8009/formList?verbose=true')
print(response.text)
```


## Download Form

`GET /download/{form_id}`

Download XForm definition (XML)
Converts internal survey schema to ODK XForm format

Authentication: no security requirement declared for this operation.

Parameters:

- `form_id` (path, string, required)
  Type: string

Responses:

- 200: Successful Response

Content type: application/json

Type: unknown

- 422: Validation Error

Content type: application/json

Type: object

Schema: [OdkBridge_HTTPValidationError](/api-reference/schemas/odkbridge-httpvalidationerror-4a5630f462.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [OdkBridge_ValidationError](/api-reference/schemas/odkbridge-validationerror-b831ec1b45.md); Type: object

## Examples

### cURL

```bash
curl -X GET 'http://localhost:8009/download/string'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8009/download/string', {
  method: 'GET',
});

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

### Python

```python
import requests

response = requests.get('http://localhost:8009/download/string')
print(response.text)
```


## Submit Form

`POST /submission`

OpenRosa Form Submission API
Accepts XML submission with optional media attachments

Authentication: no security requirement declared for this operation.

Request body: multipart/form-data (required)

Type: object

Schema: [OdkBridge_Body_submit_form_submission_post](/api-reference/schemas/odkbridge-body-submit-form-submission-post-dde00f2180.md)

- `xml_submission_file` (required)
  Type: string

- `attachments` (optional)
  Type: array
  
  default: []
  
  Items:
    Type: string

Responses:

- 200: Successful Response

Content type: application/json

Type: unknown

- 422: Validation Error

Content type: application/json

Type: object

Schema: [OdkBridge_HTTPValidationError](/api-reference/schemas/odkbridge-httpvalidationerror-4a5630f462.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [OdkBridge_ValidationError](/api-reference/schemas/odkbridge-validationerror-b831ec1b45.md); Type: object

## Examples

### cURL

```bash
curl -X POST 'http://localhost:8009/submission' \
  --form-string 'xml_submission_file=string'
```

### JavaScript

```javascript
const form = new FormData();
form.append('xml_submission_file', 'string');
const response = await fetch('http://localhost:8009/submission', {
  method: 'POST',
  headers: {},
  body: form,
});
console.log(await response.text());
```

### Python

```python
import requests
from contextlib import ExitStack

with ExitStack() as stack:
    files = [
        ('xml_submission_file', (None, 'string')),
    ]
    response = requests.request('POST', 'http://localhost:8009/submission', headers={}, files=files)
    print(response.text)
```


## Pull From Central

`POST /pull-from-central`

Trigger a pull of new submissions from ODK Central.
1. Connects to Central API
2. Fetches new submissions since last sync
3. Processes each and pushes to data-service

Authentication: no security requirement declared for this operation.

Parameters:

- `form_id` (query, unknown, optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

Responses:

- 200: Successful Response

Content type: application/json

Type: unknown

- 422: Validation Error

Content type: application/json

Type: object

Schema: [OdkBridge_HTTPValidationError](/api-reference/schemas/odkbridge-httpvalidationerror-4a5630f462.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [OdkBridge_ValidationError](/api-reference/schemas/odkbridge-validationerror-b831ec1b45.md); Type: object

## Examples

### cURL

```bash
curl -X POST 'http://localhost:8009/pull-from-central'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8009/pull-from-central', {
  method: 'POST',
});

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

### Python

```python
import requests

response = requests.post('http://localhost:8009/pull-from-central')
print(response.text)
```


## Readiness Check

`GET /api/v1/health/ready`

Readiness check for Kubernetes/container orchestration.

Returns 200 if the service is ready to accept traffic.

Also served by Media Service at http://localhost:8011.

Also served by Notification Service at http://localhost:8012.

Also served by Audit Service at http://localhost:8013.

Also served by Feature Flags Service at http://localhost:8014.

Authentication: no security requirement declared for this operation.

Responses:

- 200: Successful Response

Content type: application/json

Type: unknown

## Examples

### cURL

```bash
curl -X GET 'http://localhost:8010/api/v1/health/ready'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8010/api/v1/health/ready', {
  method: 'GET',
});

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

### Python

```python
import requests

response = requests.get('http://localhost:8010/api/v1/health/ready')
print(response.text)
```


## Liveness Check

`GET /api/v1/health/live`

Liveness check for Kubernetes/container orchestration.

Returns 200 if the service is alive.

Also served by Media Service at http://localhost:8011.

Also served by Notification Service at http://localhost:8012.

Also served by Audit Service at http://localhost:8013.

Also served by Feature Flags Service at http://localhost:8014.

Authentication: no security requirement declared for this operation.

Responses:

- 200: Successful Response

Content type: application/json

Type: unknown

## Examples

### cURL

```bash
curl -X GET 'http://localhost:8010/api/v1/health/live'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8010/api/v1/health/live', {
  method: 'GET',
});

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

### Python

```python
import requests

response = requests.get('http://localhost:8010/api/v1/health/live')
print(response.text)
```


## Render form for filling

`GET /api/v1/forms/{survey_id}/render`

Render a survey form for user to fill. Creates a new session or continues an existing interview session.

Authentication (security requirement alternatives):

```json
[
  {
    "HTTPBearer": []
  }
]
```

- HTTPBearer: http (bearer)

Parameters:

- `survey_id` (path, string, uuid, required)
  Type: string, uuid

- `version_id` (query, unknown, optional) - Specific version to render
  Type: unknown
  
  Specific version to render
  
  anyOf:
    Type: string, uuid
  
    Type: null

- `language` (query, string, optional) - Form language
  Type: string
  
  Form language
  
  default: "en"

- `prefill` (query, unknown, optional) - JSON-encoded prefill data
  Type: unknown
  
  JSON-encoded prefill data
  
  anyOf:
    Type: string
  
    Type: null

- `prefill_respondent_id` (query, unknown, optional) - Pre-fill from latest response by this respondent_id
  Type: unknown
  
  Pre-fill from latest response by this respondent_id
  
  anyOf:
    Type: string
  
    Type: null

- `prefill_unique_id` (query, unknown, optional) - Pre-fill from response matching this unique_id
  Type: unknown
  
  Pre-fill from response matching this unique_id
  
  anyOf:
    Type: string
  
    Type: null

- `interview_id` (query, unknown, optional) - Continue an existing interview session
  Type: unknown
  
  Continue an existing interview session
  
  anyOf:
    Type: string, uuid
  
    Type: null

Responses:

- 200: Successful Response

Content type: application/json

Type: object

Response containing rendered form data.

Schema: [FormService_FormRenderResponse](/api-reference/schemas/formservice-formrenderresponse-6f753a5814.md)

- `session_id` (required)
  Type: string, uuid

- `session_token` (required)
  Type: string

- `survey_id` (required)
  Type: string, uuid

- `survey_version_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string, uuid
  
    Type: null

- `form_schema` (required)
  Type: object
  
  Additional properties: true

- `form_html` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `prefill_data` (optional)
  Type: unknown
  
  anyOf:
    Type: object
    
    Additional properties: true
  
    Type: null

- `total_pages` (required)
  Type: integer

- `current_page` (optional)
  Type: integer
  
  default: 0

- `expires_at` (required)
  Type: string, date-time

- `supports_offline` (optional)
  Type: boolean
  
  default: false

- `lookup_data` (optional)
  Type: unknown
  
  anyOf:
    Type: object
    
    Additional properties: 
      Type: object
      
      Additional properties: 
        Type: object
        
        Additional properties: true
  
    Type: null

- `trigger_questions` (optional)
  Type: array
  
  default: []
  
  Items:
    Type: string

- `referee_questions` (optional)
  Type: object
  
  default: {}
  
  Additional properties: 
    Type: array
    
    Items:
      Type: string

- 422: Validation Error

Content type: application/json

Type: object

Schema: [FormService_HTTPValidationError](/api-reference/schemas/formservice-httpvalidationerror-8e8725ba52.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [FormService_ValidationError](/api-reference/schemas/formservice-validationerror-e235b81cf9.md); Type: object

## Examples

### cURL

```bash
curl -X GET 'http://localhost:8010/api/v1/forms/550e8400-e29b-41d4-a716-446655440000/render?language=en' \
  -H 'Authorization: Bearer YOUR_TOKEN'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8010/api/v1/forms/550e8400-e29b-41d4-a716-446655440000/render?language=en', {
  method: 'GET',
  headers: {
    'Authorization': 'Bearer YOUR_TOKEN',
  },
});

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

### Python

```python
import requests

response = requests.get(
    'http://localhost:8010/api/v1/forms/550e8400-e29b-41d4-a716-446655440000/render?language=en',
    headers={
        'Authorization': 'Bearer YOUR_TOKEN',
    },
)
print(response.text)
```


## Get pre-fill data from previous response

`GET /api/v1/forms/{survey_id}/prefill`

Fetch pre-fill data from a previous response by respondent_id or unique_id.

Authentication (security requirement alternatives):

```json
[
  {
    "HTTPBearer": []
  }
]
```

- HTTPBearer: http (bearer)

Parameters:

- `survey_id` (path, string, uuid, required)
  Type: string, uuid

- `respondent_id` (query, unknown, optional) - Respondent identifier for repeat respondent pre-fill
  Type: unknown
  
  Respondent identifier for repeat respondent pre-fill
  
  anyOf:
    Type: string
  
    Type: null

- `unique_id` (query, unknown, optional) - Unique ID value from previous response
  Type: unknown
  
  Unique ID value from previous response
  
  anyOf:
    Type: string
  
    Type: null

Responses:

- 200: Successful Response

Content type: application/json

Type: object

Response containing pre-fill data from a previous response.

Schema: [FormService_PrefillResponse](/api-reference/schemas/formservice-prefillresponse-9b65bda96c.md)

- `prefill_data` (optional)
  Type: object
  
  Field name to value mapping for pre-fill
  
  Additional properties: true

- `source_response_id` (required)
  Type: string
  
  ID of the source response

- `source_submitted_at` (optional)
  Type: unknown
  
  When the source response was submitted
  
  anyOf:
    Type: string
  
    Type: null

- `prefill_fields` (optional)
  Type: array
  
  List of field names that were pre-filled
  
  Items:
    Type: string

- 422: Validation Error

Content type: application/json

Type: object

Schema: [FormService_HTTPValidationError](/api-reference/schemas/formservice-httpvalidationerror-8e8725ba52.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [FormService_ValidationError](/api-reference/schemas/formservice-validationerror-e235b81cf9.md); Type: object

## Examples

### cURL

```bash
curl -X GET 'http://localhost:8010/api/v1/forms/550e8400-e29b-41d4-a716-446655440000/prefill' \
  -H 'Authorization: Bearer YOUR_TOKEN'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8010/api/v1/forms/550e8400-e29b-41d4-a716-446655440000/prefill', {
  method: 'GET',
  headers: {
    'Authorization': 'Bearer YOUR_TOKEN',
  },
});

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

### Python

```python
import requests

response = requests.get(
    'http://localhost:8010/api/v1/forms/550e8400-e29b-41d4-a716-446655440000/prefill',
    headers={
        'Authorization': 'Bearer YOUR_TOKEN',
    },
)
print(response.text)
```


## Preview form without session

`GET /api/v1/forms/{survey_id}/preview`

Preview a form schema without creating a session.

Authentication (security requirement alternatives):

```json
[
  {
    "HTTPBearer": []
  }
]
```

- HTTPBearer: http (bearer)

Parameters:

- `survey_id` (path, string, uuid, required)
  Type: string, uuid

- `version_id` (query, unknown, optional)
  Type: unknown
  
  anyOf:
    Type: string, uuid
  
    Type: null

- `language` (query, string, optional)
  Type: string
  
  default: "en"

Responses:

- 200: Successful Response

Content type: application/json

Type: unknown

- 422: Validation Error

Content type: application/json

Type: object

Schema: [FormService_HTTPValidationError](/api-reference/schemas/formservice-httpvalidationerror-8e8725ba52.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [FormService_ValidationError](/api-reference/schemas/formservice-validationerror-e235b81cf9.md); Type: object

## Examples

### cURL

```bash
curl -X GET 'http://localhost:8010/api/v1/forms/550e8400-e29b-41d4-a716-446655440000/preview?language=en' \
  -H 'Authorization: Bearer YOUR_TOKEN'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8010/api/v1/forms/550e8400-e29b-41d4-a716-446655440000/preview?language=en', {
  method: 'GET',
  headers: {
    'Authorization': 'Bearer YOUR_TOKEN',
  },
});

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

### Python

```python
import requests

response = requests.get(
    'http://localhost:8010/api/v1/forms/550e8400-e29b-41d4-a716-446655440000/preview?language=en',
    headers={
        'Authorization': 'Bearer YOUR_TOKEN',
    },
)
print(response.text)
```


## Get offline manifest

`GET /api/v1/forms/{survey_id}/manifest`

Get manifest for offline form support (service worker).

Authentication (security requirement alternatives):

```json
[
  {
    "HTTPBearer": []
  }
]
```

- HTTPBearer: http (bearer)

Parameters:

- `survey_id` (path, string, uuid, required)
  Type: string, uuid

- `version_id` (query, unknown, optional)
  Type: unknown
  
  anyOf:
    Type: string, uuid
  
    Type: null

Responses:

- 200: Successful Response

Content type: application/json

Type: object

Response for offline form manifest.

Schema: [FormService_FormManifestResponse](/api-reference/schemas/formservice-formmanifestresponse-e9f3bc0837.md)

- `survey_id` (required)
  Type: string, uuid

- `version_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string, uuid
  
    Type: null

- `manifest_version` (required)
  Type: string

- `form_files` (required)
  Type: array
  
  Items:
    Type: object
    
    Additional properties: 
      Type: string

- `media_files` (required)
  Type: array
  
  Items:
    Type: object
    
    Additional properties: 
      Type: string

- `last_updated` (required)
  Type: string, date-time

- 422: Validation Error

Content type: application/json

Type: object

Schema: [FormService_HTTPValidationError](/api-reference/schemas/formservice-httpvalidationerror-8e8725ba52.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [FormService_ValidationError](/api-reference/schemas/formservice-validationerror-e235b81cf9.md); Type: object

## Examples

### cURL

```bash
curl -X GET 'http://localhost:8010/api/v1/forms/550e8400-e29b-41d4-a716-446655440000/manifest' \
  -H 'Authorization: Bearer YOUR_TOKEN'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8010/api/v1/forms/550e8400-e29b-41d4-a716-446655440000/manifest', {
  method: 'GET',
  headers: {
    'Authorization': 'Bearer YOUR_TOKEN',
  },
});

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

### Python

```python
import requests

response = requests.get(
    'http://localhost:8010/api/v1/forms/550e8400-e29b-41d4-a716-446655440000/manifest',
    headers={
        'Authorization': 'Bearer YOUR_TOKEN',
    },
)
print(response.text)
```


## Submit completed form

`POST /api/v1/forms/submit`

Submit a completed form response.

Authentication (security requirement alternatives):

```json
[
  {
    "HTTPBearer": []
  }
]
```

- HTTPBearer: http (bearer)

Request body: application/json (required)

Type: object

Request to submit a completed form.

Schema: [FormService_FormSubmitRequest](/api-reference/schemas/formservice-formsubmitrequest-2d8b5b44e8.md)

- `session_token` (required)
  Type: string

- `form_data` (required)
  Type: object
  
  Additional properties: true

- `is_complete` (optional)
  Type: boolean
  
  default: true

- `current_page` (optional)
  Type: unknown
  
  anyOf:
    Type: integer
  
    Type: null

- `client_timestamp` (optional)
  Type: unknown
  
  anyOf:
    Type: string, date-time
  
    Type: null

- `duration_seconds` (optional)
  Type: unknown
  
  Active form filling duration in seconds, excluding paused time
  
  anyOf:
    Type: integer
    
    minimum: 0
    
    maximum: 2592000
  
    Type: null

- `offline_submission` (optional)
  Type: boolean
  
  default: false

- `offline_queued_at` (optional)
  Type: unknown
  
  anyOf:
    Type: string, date-time
  
    Type: null

- `edit_response_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `version_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string, uuid
  
    Type: null

- `interview_id` (optional)
  Type: unknown
  
  Interview execution ID (cross-service correlation)
  
  anyOf:
    Type: string, uuid
  
    Type: null

- `language` (optional)
  Type: unknown
  
  Language code used for this submission (e.g., 'en', 'es', 'fr')
  
  anyOf:
    Type: string
    
    maxLength: 10
  
    Type: null

Responses:

- 200: Successful Response

Content type: application/json

Type: object

Response after form submission.

Schema: [FormService_FormSubmitResponse](/api-reference/schemas/formservice-formsubmitresponse-23adf0d549.md)

- `success` (required)
  Type: boolean

- `response_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string, uuid
  
    Type: null

- `session_id` (required)
  Type: string, uuid

- `version_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string, uuid
  
    Type: null

- `submitted_at` (required)
  Type: string, date-time

- `validation_errors` (optional)
  Type: array
  
  default: []
  
  Items:
    Type: object
    
    Additional properties: true

- `message` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `response_language` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- 422: Validation Error

Content type: application/json

Type: object

Schema: [FormService_HTTPValidationError](/api-reference/schemas/formservice-httpvalidationerror-8e8725ba52.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [FormService_ValidationError](/api-reference/schemas/formservice-validationerror-e235b81cf9.md); Type: object

## Examples

### cURL

```bash
curl -X POST 'http://localhost:8010/api/v1/forms/submit' \
  -H 'Authorization: Bearer YOUR_TOKEN' \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "session_token": "string",
  "form_data": {},
  "is_complete": true,
  "current_page": 0,
  "client_timestamp": "2024-01-15T09:30:00Z",
  "duration_seconds": 0,
  "offline_submission": false,
  "offline_queued_at": "2024-01-15T09:30:00Z",
  "edit_response_id": "string",
  "version_id": "550e8400-e29b-41d4-a716-446655440000",
  "interview_id": "550e8400-e29b-41d4-a716-446655440000",
  "language": "string"
}'
```

### JavaScript

```javascript
const body = `{
  "session_token": "string",
  "form_data": {},
  "is_complete": true,
  "current_page": 0,
  "client_timestamp": "2024-01-15T09:30:00Z",
  "duration_seconds": 0,
  "offline_submission": false,
  "offline_queued_at": "2024-01-15T09:30:00Z",
  "edit_response_id": "string",
  "version_id": "550e8400-e29b-41d4-a716-446655440000",
  "interview_id": "550e8400-e29b-41d4-a716-446655440000",
  "language": "string"
}`;

const response = await fetch('http://localhost:8010/api/v1/forms/submit', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer YOUR_TOKEN',
    'Content-Type': 'application/json',
  },
  body,
});

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

### Python

```python
import requests

body = '''{
  "session_token": "string",
  "form_data": {},
  "is_complete": true,
  "current_page": 0,
  "client_timestamp": "2024-01-15T09:30:00Z",
  "duration_seconds": 0,
  "offline_submission": false,
  "offline_queued_at": "2024-01-15T09:30:00Z",
  "edit_response_id": "string",
  "version_id": "550e8400-e29b-41d4-a716-446655440000",
  "interview_id": "550e8400-e29b-41d4-a716-446655440000",
  "language": "string"
}'''

response = requests.post(
    'http://localhost:8010/api/v1/forms/submit',
    data=body.encode('utf-8'),
    headers={
        'Authorization': 'Bearer YOUR_TOKEN',
        'Content-Type': 'application/json',
    },
)
print(response.text)
```


## Submit offline form

`POST /api/v1/forms/submit/offline`

Submit a form that was filled offline.

Authentication (security requirement alternatives):

```json
[
  {
    "HTTPBearer": []
  }
]
```

- HTTPBearer: http (bearer)

Request body: application/json (required)

Type: object

Request to submit a completed form.

Schema: [FormService_FormSubmitRequest](/api-reference/schemas/formservice-formsubmitrequest-2d8b5b44e8.md)

- `session_token` (required)
  Type: string

- `form_data` (required)
  Type: object
  
  Additional properties: true

- `is_complete` (optional)
  Type: boolean
  
  default: true

- `current_page` (optional)
  Type: unknown
  
  anyOf:
    Type: integer
  
    Type: null

- `client_timestamp` (optional)
  Type: unknown
  
  anyOf:
    Type: string, date-time
  
    Type: null

- `duration_seconds` (optional)
  Type: unknown
  
  Active form filling duration in seconds, excluding paused time
  
  anyOf:
    Type: integer
    
    minimum: 0
    
    maximum: 2592000
  
    Type: null

- `offline_submission` (optional)
  Type: boolean
  
  default: false

- `offline_queued_at` (optional)
  Type: unknown
  
  anyOf:
    Type: string, date-time
  
    Type: null

- `edit_response_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `version_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string, uuid
  
    Type: null

- `interview_id` (optional)
  Type: unknown
  
  Interview execution ID (cross-service correlation)
  
  anyOf:
    Type: string, uuid
  
    Type: null

- `language` (optional)
  Type: unknown
  
  Language code used for this submission (e.g., 'en', 'es', 'fr')
  
  anyOf:
    Type: string
    
    maxLength: 10
  
    Type: null

Responses:

- 200: Successful Response

Content type: application/json

Type: object

Response after form submission.

Schema: [FormService_FormSubmitResponse](/api-reference/schemas/formservice-formsubmitresponse-23adf0d549.md)

- `success` (required)
  Type: boolean

- `response_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string, uuid
  
    Type: null

- `session_id` (required)
  Type: string, uuid

- `version_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string, uuid
  
    Type: null

- `submitted_at` (required)
  Type: string, date-time

- `validation_errors` (optional)
  Type: array
  
  default: []
  
  Items:
    Type: object
    
    Additional properties: true

- `message` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `response_language` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- 422: Validation Error

Content type: application/json

Type: object

Schema: [FormService_HTTPValidationError](/api-reference/schemas/formservice-httpvalidationerror-8e8725ba52.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [FormService_ValidationError](/api-reference/schemas/formservice-validationerror-e235b81cf9.md); Type: object

## Examples

### cURL

```bash
curl -X POST 'http://localhost:8010/api/v1/forms/submit/offline' \
  -H 'Authorization: Bearer YOUR_TOKEN' \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "session_token": "string",
  "form_data": {},
  "is_complete": true,
  "current_page": 0,
  "client_timestamp": "2024-01-15T09:30:00Z",
  "duration_seconds": 0,
  "offline_submission": false,
  "offline_queued_at": "2024-01-15T09:30:00Z",
  "edit_response_id": "string",
  "version_id": "550e8400-e29b-41d4-a716-446655440000",
  "interview_id": "550e8400-e29b-41d4-a716-446655440000",
  "language": "string"
}'
```

### JavaScript

```javascript
const body = `{
  "session_token": "string",
  "form_data": {},
  "is_complete": true,
  "current_page": 0,
  "client_timestamp": "2024-01-15T09:30:00Z",
  "duration_seconds": 0,
  "offline_submission": false,
  "offline_queued_at": "2024-01-15T09:30:00Z",
  "edit_response_id": "string",
  "version_id": "550e8400-e29b-41d4-a716-446655440000",
  "interview_id": "550e8400-e29b-41d4-a716-446655440000",
  "language": "string"
}`;

const response = await fetch('http://localhost:8010/api/v1/forms/submit/offline', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer YOUR_TOKEN',
    'Content-Type': 'application/json',
  },
  body,
});

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

### Python

```python
import requests

body = '''{
  "session_token": "string",
  "form_data": {},
  "is_complete": true,
  "current_page": 0,
  "client_timestamp": "2024-01-15T09:30:00Z",
  "duration_seconds": 0,
  "offline_submission": false,
  "offline_queued_at": "2024-01-15T09:30:00Z",
  "edit_response_id": "string",
  "version_id": "550e8400-e29b-41d4-a716-446655440000",
  "interview_id": "550e8400-e29b-41d4-a716-446655440000",
  "language": "string"
}'''

response = requests.post(
    'http://localhost:8010/api/v1/forms/submit/offline',
    data=body.encode('utf-8'),
    headers={
        'Authorization': 'Bearer YOUR_TOKEN',
        'Content-Type': 'application/json',
    },
)
print(response.text)
```


## Validate form data

`POST /api/v1/forms/validate`

Validate form data without submitting.

Authentication (security requirement alternatives):

```json
[
  {
    "HTTPBearer": []
  }
]
```

- HTTPBearer: http (bearer)

Request body: application/json (required)

Type: object

Request to validate form data without submitting.

Schema: [FormService_FormValidateRequest](/api-reference/schemas/formservice-formvalidaterequest-a151812b3b.md)

- `session_token` (required)
  Type: string

- `form_data` (required)
  Type: object
  
  Additional properties: true

- `validate_all` (optional)
  Type: boolean
  
  default: false

- `fields_to_validate` (optional)
  Type: unknown
  
  anyOf:
    Type: array
    
    Items:
      Type: string
  
    Type: null

Responses:

- 200: Successful Response

Content type: application/json

Type: object

Response with validation results.

Schema: [FormService_FormValidateResponse](/api-reference/schemas/formservice-formvalidateresponse-394c496878.md)

- `is_valid` (required)
  Type: boolean

- `errors` (optional)
  Type: array
  
  default: []
  
  Items:
    Type: object
    
    Additional properties: true

- `warnings` (optional)
  Type: array
  
  default: []
  
  Items:
    Type: object
    
    Additional properties: true

- `completion_percentage` (optional)
  Type: integer
  
  default: 0

- 422: Validation Error

Content type: application/json

Type: object

Schema: [FormService_HTTPValidationError](/api-reference/schemas/formservice-httpvalidationerror-8e8725ba52.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [FormService_ValidationError](/api-reference/schemas/formservice-validationerror-e235b81cf9.md); Type: object

## Examples

### cURL

```bash
curl -X POST 'http://localhost:8010/api/v1/forms/validate' \
  -H 'Authorization: Bearer YOUR_TOKEN' \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "session_token": "string",
  "form_data": {},
  "validate_all": false,
  "fields_to_validate": [
    "string"
  ]
}'
```

### JavaScript

```javascript
const body = `{
  "session_token": "string",
  "form_data": {},
  "validate_all": false,
  "fields_to_validate": [
    "string"
  ]
}`;

const response = await fetch('http://localhost:8010/api/v1/forms/validate', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer YOUR_TOKEN',
    'Content-Type': 'application/json',
  },
  body,
});

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

### Python

```python
import requests

body = '''{
  "session_token": "string",
  "form_data": {},
  "validate_all": false,
  "fields_to_validate": [
    "string"
  ]
}'''

response = requests.post(
    'http://localhost:8010/api/v1/forms/validate',
    data=body.encode('utf-8'),
    headers={
        'Authorization': 'Bearer YOUR_TOKEN',
        'Content-Type': 'application/json',
    },
)
print(response.text)
```


## List user's drafts

`GET /api/v1/forms/drafts`

List all drafts for the current user.

Authentication (security requirement alternatives):

```json
[
  {
    "HTTPBearer": []
  }
]
```

- HTTPBearer: http (bearer)

Parameters:

- `survey_id` (query, unknown, optional) - Filter by survey ID
  Type: unknown
  
  Filter by survey ID
  
  anyOf:
    Type: string, uuid
  
    Type: null

- `status` (query, unknown, optional) - Filter by status
  Type: unknown
  
  Filter by status
  
  anyOf:
    Type: string
  
    Type: null

- `skip` (query, integer, optional)
  Type: integer
  
  default: 0
  
  minimum: 0

- `limit` (query, integer, optional)
  Type: integer
  
  default: 20
  
  minimum: 1
  
  maximum: 100

Responses:

- 200: Successful Response

Content type: application/json

Type: object

Response containing list of drafts.

Schema: [FormService_DraftListResponse](/api-reference/schemas/formservice-draftlistresponse-4e547f5e89.md)

- `items` (required)
  Type: array
  
  Items:
    Reference: [FormService_DraftResponse](/api-reference/schemas/formservice-draftresponse-11a8f6ea0f.md); Type: object
    
    Response containing draft information.

- `total` (required)
  Type: integer

- `skip` (optional)
  Type: integer
  
  default: 0

- `limit` (optional)
  Type: integer
  
  default: 20

- `has_next` (required)
  Type: boolean

- `has_previous` (required)
  Type: boolean

- 422: Validation Error

Content type: application/json

Type: object

Schema: [FormService_HTTPValidationError](/api-reference/schemas/formservice-httpvalidationerror-8e8725ba52.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [FormService_ValidationError](/api-reference/schemas/formservice-validationerror-e235b81cf9.md); Type: object

## Examples

### cURL

```bash
curl -X GET 'http://localhost:8010/api/v1/forms/drafts?skip=0&limit=20' \
  -H 'Authorization: Bearer YOUR_TOKEN'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8010/api/v1/forms/drafts?skip=0&limit=20', {
  method: 'GET',
  headers: {
    'Authorization': 'Bearer YOUR_TOKEN',
  },
});

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

### Python

```python
import requests

response = requests.get(
    'http://localhost:8010/api/v1/forms/drafts?skip=0&limit=20',
    headers={
        'Authorization': 'Bearer YOUR_TOKEN',
    },
)
print(response.text)
```


## Create draft

`POST /api/v1/forms/drafts`

Create a new draft with sync and idempotency support.

Authentication (security requirement alternatives):

```json
[
  {
    "HTTPBearer": []
  }
]
```

- HTTPBearer: http (bearer)

Request body: application/json (required)

Type: object

Request to create a new draft.

Schema: [FormService_DraftCreateRequest](/api-reference/schemas/formservice-draftcreaterequest-2050464672.md)

- `id` (optional)
  Type: unknown
  
  anyOf:
    Type: string, uuid
  
    Type: null

- `survey_id` (required)
  Type: string, uuid

- `session_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string, uuid
  
    Type: null

- `name` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `draft_data` (optional)
  Type: object
  
  Additional properties: true

- `current_page` (optional)
  Type: integer
  
  default: 0

- `survey_version_id` (optional)
  Type: unknown
  
  Pinned immutable survey schema version ID
  
  anyOf:
    Type: string, uuid
  
    Type: null

- `device_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `content_hash` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `idempotency_key` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

Responses:

- 201: Successful Response

Content type: application/json

Type: object

Response containing draft information.

Schema: [FormService_DraftResponse](/api-reference/schemas/formservice-draftresponse-11a8f6ea0f.md)

- `id` (required)
  Type: string, uuid

- `tenant_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string, uuid
  
    Type: null

- `user_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string, uuid
  
    Type: null

- `device_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `survey_id` (required)
  Type: string, uuid

- `session_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string, uuid
  
    Type: null

- `survey_version_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string, uuid
  
    Type: null

- `name` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `draft_data` (required)
  Type: object
  
  Additional properties: true

- `current_page` (required)
  Type: integer

- `completed_fields_count` (required)
  Type: integer

- `total_fields_count` (optional)
  Type: unknown
  
  anyOf:
    Type: integer
  
    Type: null

- `completion_percentage` (required)
  Type: integer

- `status` (required)
  Type: string

- `version_token` (optional)
  Type: integer
  
  default: 1

- `content_hash` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `idempotency_key` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `is_deleted` (optional)
  Type: boolean
  
  default: false

- `deleted_at` (optional)
  Type: unknown
  
  anyOf:
    Type: string, date-time
  
    Type: null

- `validation_errors` (optional)
  Type: array
  
  default: []
  
  Items:
    Type: object
    
    Additional properties: true

- `is_auto_saved` (optional)
  Type: boolean
  
  default: false

- `reconciliation_grant_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string, uuid
  
    Type: null

- `reconciled_at` (optional)
  Type: unknown
  
  anyOf:
    Type: string, date-time
  
    Type: null

- `created_at` (required)
  Type: string, date-time

- `updated_at` (required)
  Type: string, date-time

- `expires_at` (optional)
  Type: unknown
  
  anyOf:
    Type: string, date-time
  
    Type: null

- 422: Validation Error

Content type: application/json

Type: object

Schema: [FormService_HTTPValidationError](/api-reference/schemas/formservice-httpvalidationerror-8e8725ba52.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [FormService_ValidationError](/api-reference/schemas/formservice-validationerror-e235b81cf9.md); Type: object

## Examples

### cURL

```bash
curl -X POST 'http://localhost:8010/api/v1/forms/drafts' \
  -H 'Authorization: Bearer YOUR_TOKEN' \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "id": "550e8400-e29b-41d4-a716-446655440000",
  "survey_id": "550e8400-e29b-41d4-a716-446655440000",
  "session_id": "550e8400-e29b-41d4-a716-446655440000",
  "name": "string",
  "draft_data": {},
  "current_page": 0,
  "survey_version_id": "550e8400-e29b-41d4-a716-446655440000",
  "device_id": "string",
  "content_hash": "string",
  "idempotency_key": "string"
}'
```

### JavaScript

```javascript
const body = `{
  "id": "550e8400-e29b-41d4-a716-446655440000",
  "survey_id": "550e8400-e29b-41d4-a716-446655440000",
  "session_id": "550e8400-e29b-41d4-a716-446655440000",
  "name": "string",
  "draft_data": {},
  "current_page": 0,
  "survey_version_id": "550e8400-e29b-41d4-a716-446655440000",
  "device_id": "string",
  "content_hash": "string",
  "idempotency_key": "string"
}`;

const response = await fetch('http://localhost:8010/api/v1/forms/drafts', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer YOUR_TOKEN',
    'Content-Type': 'application/json',
  },
  body,
});

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

### Python

```python
import requests

body = '''{
  "id": "550e8400-e29b-41d4-a716-446655440000",
  "survey_id": "550e8400-e29b-41d4-a716-446655440000",
  "session_id": "550e8400-e29b-41d4-a716-446655440000",
  "name": "string",
  "draft_data": {},
  "current_page": 0,
  "survey_version_id": "550e8400-e29b-41d4-a716-446655440000",
  "device_id": "string",
  "content_hash": "string",
  "idempotency_key": "string"
}'''

response = requests.post(
    'http://localhost:8010/api/v1/forms/drafts',
    data=body.encode('utf-8'),
    headers={
        'Authorization': 'Bearer YOUR_TOKEN',
        'Content-Type': 'application/json',
    },
)
print(response.text)
```


## Delta sync drafts

`GET /api/v1/forms/drafts/delta`

Pull drafts updated since a given cursor timestamp or keyset cursor, including tombstones (Wave 9 / R24).

Authentication (security requirement alternatives):

```json
[
  {
    "HTTPBearer": []
  }
]
```

- HTTPBearer: http (bearer)

Parameters:

- `cursor` (query, unknown, optional) - Opaque keyset cursor for delta pagination
  Type: unknown
  
  Opaque keyset cursor for delta pagination
  
  anyOf:
    Type: string
  
    Type: null

- `updated_since` (query, unknown, optional) - ISO-8601 timestamp cursor (legacy fallback)
  Type: unknown
  
  ISO-8601 timestamp cursor (legacy fallback)
  
  anyOf:
    Type: string, date-time
  
    Type: null

- `limit` (query, integer, optional)
  Type: integer
  
  default: 50
  
  minimum: 1
  
  maximum: 100

Responses:

- 200: Successful Response

Content type: application/json

Type: object

Response containing delta sync drafts since cursor.

Schema: [FormService_DraftDeltaResponse](/api-reference/schemas/formservice-draftdeltaresponse-f5752cb6b2.md)

- `items` (required)
  Type: array
  
  Items:
    Reference: [FormService_DraftResponse](/api-reference/schemas/formservice-draftresponse-11a8f6ea0f.md); Type: object
    
    Response containing draft information.

- `server_timestamp` (required)
  Type: string

- `total` (required)
  Type: integer

- `has_next` (required)
  Type: boolean

- `next_cursor` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- 422: Validation Error

Content type: application/json

Type: object

Schema: [FormService_HTTPValidationError](/api-reference/schemas/formservice-httpvalidationerror-8e8725ba52.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [FormService_ValidationError](/api-reference/schemas/formservice-validationerror-e235b81cf9.md); Type: object

## Examples

### cURL

```bash
curl -X GET 'http://localhost:8010/api/v1/forms/drafts/delta?limit=50' \
  -H 'Authorization: Bearer YOUR_TOKEN'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8010/api/v1/forms/drafts/delta?limit=50', {
  method: 'GET',
  headers: {
    'Authorization': 'Bearer YOUR_TOKEN',
  },
});

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

### Python

```python
import requests

response = requests.get(
    'http://localhost:8010/api/v1/forms/drafts/delta?limit=50',
    headers={
        'Authorization': 'Bearer YOUR_TOKEN',
    },
)
print(response.text)
```


## List all drafts (admin)

`GET /api/v1/forms/drafts/all`

List all drafts across users (admin only).

Authentication (security requirement alternatives):

```json
[
  {
    "HTTPBearer": []
  }
]
```

- HTTPBearer: http (bearer)

Parameters:

- `survey_id` (query, unknown, optional)
  Type: unknown
  
  anyOf:
    Type: string, uuid
  
    Type: null

- `user_id` (query, unknown, optional)
  Type: unknown
  
  anyOf:
    Type: string, uuid
  
    Type: null

- `status` (query, unknown, optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `skip` (query, integer, optional)
  Type: integer
  
  default: 0
  
  minimum: 0

- `limit` (query, integer, optional)
  Type: integer
  
  default: 20
  
  minimum: 1
  
  maximum: 100

Responses:

- 200: Successful Response

Content type: application/json

Type: object

Response containing list of drafts.

Schema: [FormService_DraftListResponse](/api-reference/schemas/formservice-draftlistresponse-4e547f5e89.md)

- `items` (required)
  Type: array
  
  Items:
    Reference: [FormService_DraftResponse](/api-reference/schemas/formservice-draftresponse-11a8f6ea0f.md); Type: object
    
    Response containing draft information.

- `total` (required)
  Type: integer

- `skip` (optional)
  Type: integer
  
  default: 0

- `limit` (optional)
  Type: integer
  
  default: 20

- `has_next` (required)
  Type: boolean

- `has_previous` (required)
  Type: boolean

- 422: Validation Error

Content type: application/json

Type: object

Schema: [FormService_HTTPValidationError](/api-reference/schemas/formservice-httpvalidationerror-8e8725ba52.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [FormService_ValidationError](/api-reference/schemas/formservice-validationerror-e235b81cf9.md); Type: object

## Examples

### cURL

```bash
curl -X GET 'http://localhost:8010/api/v1/forms/drafts/all?skip=0&limit=20' \
  -H 'Authorization: Bearer YOUR_TOKEN'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8010/api/v1/forms/drafts/all?skip=0&limit=20', {
  method: 'GET',
  headers: {
    'Authorization': 'Bearer YOUR_TOKEN',
  },
});

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

### Python

```python
import requests

response = requests.get(
    'http://localhost:8010/api/v1/forms/drafts/all?skip=0&limit=20',
    headers={
        'Authorization': 'Bearer YOUR_TOKEN',
    },
)
print(response.text)
```


## Get draft

`GET /api/v1/forms/drafts/{draft_id}`

Get a specific draft by ID.

Authentication (security requirement alternatives):

```json
[
  {
    "HTTPBearer": []
  }
]
```

- HTTPBearer: http (bearer)

Parameters:

- `draft_id` (path, string, uuid, required)
  Type: string, uuid

Responses:

- 200: Successful Response

Content type: application/json

Type: object

Response containing draft information.

Schema: [FormService_DraftResponse](/api-reference/schemas/formservice-draftresponse-11a8f6ea0f.md)

- `id` (required)
  Type: string, uuid

- `tenant_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string, uuid
  
    Type: null

- `user_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string, uuid
  
    Type: null

- `device_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `survey_id` (required)
  Type: string, uuid

- `session_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string, uuid
  
    Type: null

- `survey_version_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string, uuid
  
    Type: null

- `name` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `draft_data` (required)
  Type: object
  
  Additional properties: true

- `current_page` (required)
  Type: integer

- `completed_fields_count` (required)
  Type: integer

- `total_fields_count` (optional)
  Type: unknown
  
  anyOf:
    Type: integer
  
    Type: null

- `completion_percentage` (required)
  Type: integer

- `status` (required)
  Type: string

- `version_token` (optional)
  Type: integer
  
  default: 1

- `content_hash` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `idempotency_key` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `is_deleted` (optional)
  Type: boolean
  
  default: false

- `deleted_at` (optional)
  Type: unknown
  
  anyOf:
    Type: string, date-time
  
    Type: null

- `validation_errors` (optional)
  Type: array
  
  default: []
  
  Items:
    Type: object
    
    Additional properties: true

- `is_auto_saved` (optional)
  Type: boolean
  
  default: false

- `reconciliation_grant_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string, uuid
  
    Type: null

- `reconciled_at` (optional)
  Type: unknown
  
  anyOf:
    Type: string, date-time
  
    Type: null

- `created_at` (required)
  Type: string, date-time

- `updated_at` (required)
  Type: string, date-time

- `expires_at` (optional)
  Type: unknown
  
  anyOf:
    Type: string, date-time
  
    Type: null

- 422: Validation Error

Content type: application/json

Type: object

Schema: [FormService_HTTPValidationError](/api-reference/schemas/formservice-httpvalidationerror-8e8725ba52.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [FormService_ValidationError](/api-reference/schemas/formservice-validationerror-e235b81cf9.md); Type: object

## Examples

### cURL

```bash
curl -X GET 'http://localhost:8010/api/v1/forms/drafts/550e8400-e29b-41d4-a716-446655440000' \
  -H 'Authorization: Bearer YOUR_TOKEN'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8010/api/v1/forms/drafts/550e8400-e29b-41d4-a716-446655440000', {
  method: 'GET',
  headers: {
    'Authorization': 'Bearer YOUR_TOKEN',
  },
});

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

### Python

```python
import requests

response = requests.get(
    'http://localhost:8010/api/v1/forms/drafts/550e8400-e29b-41d4-a716-446655440000',
    headers={
        'Authorization': 'Bearer YOUR_TOKEN',
    },
)
print(response.text)
```


## Update draft

`PUT /api/v1/forms/drafts/{draft_id}`

Update an existing draft with optimistic concurrency checks.

Authentication (security requirement alternatives):

```json
[
  {
    "HTTPBearer": []
  }
]
```

- HTTPBearer: http (bearer)

Parameters:

- `draft_id` (path, string, uuid, required)
  Type: string, uuid

Request body: application/json (required)

Type: object

Request to update an existing draft.

Schema: [FormService_DraftUpdateRequest](/api-reference/schemas/formservice-draftupdaterequest-fea029a037.md)

- `draft_data` (optional)
  Type: unknown
  
  anyOf:
    Type: object
    
    Additional properties: true
  
    Type: null

- `name` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `current_page` (optional)
  Type: unknown
  
  anyOf:
    Type: integer
  
    Type: null

- `is_auto_save` (optional)
  Type: boolean
  
  default: false

- `version_token` (optional)
  Type: integer
  
  Expected current server version token
  
  default: 1
  
  minimum: 1

- `device_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `content_hash` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `idempotency_key` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

Responses:

- 200: Successful Response

Content type: application/json

Type: object

Response containing draft information.

Schema: [FormService_DraftResponse](/api-reference/schemas/formservice-draftresponse-11a8f6ea0f.md)

- `id` (required)
  Type: string, uuid

- `tenant_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string, uuid
  
    Type: null

- `user_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string, uuid
  
    Type: null

- `device_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `survey_id` (required)
  Type: string, uuid

- `session_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string, uuid
  
    Type: null

- `survey_version_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string, uuid
  
    Type: null

- `name` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `draft_data` (required)
  Type: object
  
  Additional properties: true

- `current_page` (required)
  Type: integer

- `completed_fields_count` (required)
  Type: integer

- `total_fields_count` (optional)
  Type: unknown
  
  anyOf:
    Type: integer
  
    Type: null

- `completion_percentage` (required)
  Type: integer

- `status` (required)
  Type: string

- `version_token` (optional)
  Type: integer
  
  default: 1

- `content_hash` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `idempotency_key` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `is_deleted` (optional)
  Type: boolean
  
  default: false

- `deleted_at` (optional)
  Type: unknown
  
  anyOf:
    Type: string, date-time
  
    Type: null

- `validation_errors` (optional)
  Type: array
  
  default: []
  
  Items:
    Type: object
    
    Additional properties: true

- `is_auto_saved` (optional)
  Type: boolean
  
  default: false

- `reconciliation_grant_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string, uuid
  
    Type: null

- `reconciled_at` (optional)
  Type: unknown
  
  anyOf:
    Type: string, date-time
  
    Type: null

- `created_at` (required)
  Type: string, date-time

- `updated_at` (required)
  Type: string, date-time

- `expires_at` (optional)
  Type: unknown
  
  anyOf:
    Type: string, date-time
  
    Type: null

- 409: Optimistic concurrency conflict

Content type: application/json

Type: object

Response returned upon an optimistic concurrency conflict (HTTP 409).

Schema: [FormService_DraftConflictResponse](/api-reference/schemas/formservice-draftconflictresponse-f49b85967c.md)

- `error` (optional)
  Type: string
  
  default: "DRAFT_CONFLICT"

- `message` (required)
  Type: string

- `draft_id` (required)
  Type: string, uuid

- `server_version_token` (required)
  Type: integer

- `client_version_token` (optional)
  Type: unknown
  
  anyOf:
    Type: integer
  
    Type: null

- `server_content_hash` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `client_content_hash` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `server_device_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `server_updated_at` (required)
  Type: string

- `server_draft_data` (required)
  Type: object
  
  Additional properties: true

- 422: Validation Error

Content type: application/json

Type: object

Schema: [FormService_HTTPValidationError](/api-reference/schemas/formservice-httpvalidationerror-8e8725ba52.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [FormService_ValidationError](/api-reference/schemas/formservice-validationerror-e235b81cf9.md); Type: object

## Examples

### cURL

```bash
curl -X PUT 'http://localhost:8010/api/v1/forms/drafts/550e8400-e29b-41d4-a716-446655440000' \
  -H 'Authorization: Bearer YOUR_TOKEN' \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "draft_data": {},
  "name": "string",
  "current_page": 0,
  "is_auto_save": false,
  "version_token": 1,
  "device_id": "string",
  "content_hash": "string",
  "idempotency_key": "string"
}'
```

### JavaScript

```javascript
const body = `{
  "draft_data": {},
  "name": "string",
  "current_page": 0,
  "is_auto_save": false,
  "version_token": 1,
  "device_id": "string",
  "content_hash": "string",
  "idempotency_key": "string"
}`;

const response = await fetch('http://localhost:8010/api/v1/forms/drafts/550e8400-e29b-41d4-a716-446655440000', {
  method: 'PUT',
  headers: {
    'Authorization': 'Bearer YOUR_TOKEN',
    'Content-Type': 'application/json',
  },
  body,
});

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

### Python

```python
import requests

body = '''{
  "draft_data": {},
  "name": "string",
  "current_page": 0,
  "is_auto_save": false,
  "version_token": 1,
  "device_id": "string",
  "content_hash": "string",
  "idempotency_key": "string"
}'''

response = requests.put(
    'http://localhost:8010/api/v1/forms/drafts/550e8400-e29b-41d4-a716-446655440000',
    data=body.encode('utf-8'),
    headers={
        'Authorization': 'Bearer YOUR_TOKEN',
        'Content-Type': 'application/json',
    },
)
print(response.text)
```


## Delete draft

`DELETE /api/v1/forms/drafts/{draft_id}`

Soft-delete a draft with tombstone so stale devices do not resurrect it.

Authentication (security requirement alternatives):

```json
[
  {
    "HTTPBearer": []
  }
]
```

- HTTPBearer: http (bearer)

Parameters:

- `draft_id` (path, string, uuid, required)
  Type: string, uuid

Responses:

- 204: Successful Response

- 422: Validation Error

Content type: application/json

Type: object

Schema: [FormService_HTTPValidationError](/api-reference/schemas/formservice-httpvalidationerror-8e8725ba52.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [FormService_ValidationError](/api-reference/schemas/formservice-validationerror-e235b81cf9.md); Type: object

## Examples

### cURL

```bash
curl -X DELETE 'http://localhost:8010/api/v1/forms/drafts/550e8400-e29b-41d4-a716-446655440000' \
  -H 'Authorization: Bearer YOUR_TOKEN'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8010/api/v1/forms/drafts/550e8400-e29b-41d4-a716-446655440000', {
  method: 'DELETE',
  headers: {
    'Authorization': 'Bearer YOUR_TOKEN',
  },
});

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

### Python

```python
import requests

response = requests.delete(
    'http://localhost:8010/api/v1/forms/drafts/550e8400-e29b-41d4-a716-446655440000',
    headers={
        'Authorization': 'Bearer YOUR_TOKEN',
    },
)
print(response.text)
```


## Drain and archive offline draft after authorization revocation

`POST /api/v1/forms/drafts/drain-revoked`

Validates pre-revocation editing timestamps against historical authorization, setting status to 'archived_revoked'.

Authentication (security requirement alternatives):

```json
[
  {
    "HTTPBearer": []
  }
]
```

- HTTPBearer: http (bearer)

Request body: application/json (required)

Type: object

Request to drain an offline draft whose user's assignment was revoked.

Schema: [FormService_DraftDrainRevokedRequest](/api-reference/schemas/formservice-draftdrainrevokedrequest-57a2cef442.md)

- `id` (required)
  Type: string, uuid
  
  Unique draft identifier

- `survey_id` (required)
  Type: string, uuid
  
  Survey identifier

- `survey_version_id` (optional)
  Type: unknown
  
  Pinned survey schema version ID
  
  anyOf:
    Type: string, uuid
  
    Type: null

- `name` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `draft_data` (optional)
  Type: object
  
  Answers captured in draft
  
  Additional properties: true

- `current_page` (optional)
  Type: integer
  
  default: 0

- `device_id` (required)
  Type: string
  
  Attribution device ID (must not be placeholder)

- `version_token` (optional)
  Type: integer
  
  Client version token
  
  default: 1
  
  minimum: 1

- `content_hash` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `idempotency_key` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `reconciliation_grant_id` (optional)
  Type: unknown
  
  Reconciliation grant ID
  
  anyOf:
    Type: string, uuid
  
    Type: null

- `lastModifiedAt` (required)
  Type: string, date-time
  
  Timestamp of the last offline edit to the draft

- `reconciliation_reason` (optional)
  Type: unknown
  
  Optional domain note or reason
  
  anyOf:
    Type: string
  
    Type: null

Responses:

- 200: Successful Response

Content type: application/json

Type: object

Response containing draft information.

Schema: [FormService_DraftResponse](/api-reference/schemas/formservice-draftresponse-11a8f6ea0f.md)

- `id` (required)
  Type: string, uuid

- `tenant_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string, uuid
  
    Type: null

- `user_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string, uuid
  
    Type: null

- `device_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `survey_id` (required)
  Type: string, uuid

- `session_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string, uuid
  
    Type: null

- `survey_version_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string, uuid
  
    Type: null

- `name` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `draft_data` (required)
  Type: object
  
  Additional properties: true

- `current_page` (required)
  Type: integer

- `completed_fields_count` (required)
  Type: integer

- `total_fields_count` (optional)
  Type: unknown
  
  anyOf:
    Type: integer
  
    Type: null

- `completion_percentage` (required)
  Type: integer

- `status` (required)
  Type: string

- `version_token` (optional)
  Type: integer
  
  default: 1

- `content_hash` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `idempotency_key` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `is_deleted` (optional)
  Type: boolean
  
  default: false

- `deleted_at` (optional)
  Type: unknown
  
  anyOf:
    Type: string, date-time
  
    Type: null

- `validation_errors` (optional)
  Type: array
  
  default: []
  
  Items:
    Type: object
    
    Additional properties: true

- `is_auto_saved` (optional)
  Type: boolean
  
  default: false

- `reconciliation_grant_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string, uuid
  
    Type: null

- `reconciled_at` (optional)
  Type: unknown
  
  anyOf:
    Type: string, date-time
  
    Type: null

- `created_at` (required)
  Type: string, date-time

- `updated_at` (required)
  Type: string, date-time

- `expires_at` (optional)
  Type: unknown
  
  anyOf:
    Type: string, date-time
  
    Type: null

- 422: Validation Error

Content type: application/json

Type: object

Schema: [FormService_HTTPValidationError](/api-reference/schemas/formservice-httpvalidationerror-8e8725ba52.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [FormService_ValidationError](/api-reference/schemas/formservice-validationerror-e235b81cf9.md); Type: object

## Examples

### cURL

```bash
curl -X POST 'http://localhost:8010/api/v1/forms/drafts/drain-revoked' \
  -H 'Authorization: Bearer YOUR_TOKEN' \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "id": "550e8400-e29b-41d4-a716-446655440000",
  "survey_id": "550e8400-e29b-41d4-a716-446655440000",
  "survey_version_id": "550e8400-e29b-41d4-a716-446655440000",
  "name": "string",
  "draft_data": {},
  "current_page": 0,
  "device_id": "string",
  "version_token": 1,
  "content_hash": "string",
  "idempotency_key": "string",
  "reconciliation_grant_id": "550e8400-e29b-41d4-a716-446655440000",
  "lastModifiedAt": "2024-01-15T09:30:00Z",
  "reconciliation_reason": "string"
}'
```

### JavaScript

```javascript
const body = `{
  "id": "550e8400-e29b-41d4-a716-446655440000",
  "survey_id": "550e8400-e29b-41d4-a716-446655440000",
  "survey_version_id": "550e8400-e29b-41d4-a716-446655440000",
  "name": "string",
  "draft_data": {},
  "current_page": 0,
  "device_id": "string",
  "version_token": 1,
  "content_hash": "string",
  "idempotency_key": "string",
  "reconciliation_grant_id": "550e8400-e29b-41d4-a716-446655440000",
  "lastModifiedAt": "2024-01-15T09:30:00Z",
  "reconciliation_reason": "string"
}`;

const response = await fetch('http://localhost:8010/api/v1/forms/drafts/drain-revoked', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer YOUR_TOKEN',
    'Content-Type': 'application/json',
  },
  body,
});

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

### Python

```python
import requests

body = '''{
  "id": "550e8400-e29b-41d4-a716-446655440000",
  "survey_id": "550e8400-e29b-41d4-a716-446655440000",
  "survey_version_id": "550e8400-e29b-41d4-a716-446655440000",
  "name": "string",
  "draft_data": {},
  "current_page": 0,
  "device_id": "string",
  "version_token": 1,
  "content_hash": "string",
  "idempotency_key": "string",
  "reconciliation_grant_id": "550e8400-e29b-41d4-a716-446655440000",
  "lastModifiedAt": "2024-01-15T09:30:00Z",
  "reconciliation_reason": "string"
}'''

response = requests.post(
    'http://localhost:8010/api/v1/forms/drafts/drain-revoked',
    data=body.encode('utf-8'),
    headers={
        'Authorization': 'Bearer YOUR_TOKEN',
        'Content-Type': 'application/json',
    },
)
print(response.text)
```


## List user's sessions

`GET /api/v1/forms/sessions`

List all form sessions for the current user.

Authentication (security requirement alternatives):

```json
[
  {
    "HTTPBearer": []
  }
]
```

- HTTPBearer: http (bearer)

Parameters:

- `survey_id` (query, unknown, optional) - Filter by survey ID
  Type: unknown
  
  Filter by survey ID
  
  anyOf:
    Type: string, uuid
  
    Type: null

- `status` (query, unknown, optional) - Filter by status
  Type: unknown
  
  Filter by status
  
  anyOf:
    Type: string
  
    Type: null

- `skip` (query, integer, optional)
  Type: integer
  
  default: 0
  
  minimum: 0

- `limit` (query, integer, optional)
  Type: integer
  
  default: 20
  
  minimum: 1
  
  maximum: 100

Responses:

- 200: Successful Response

Content type: application/json

Type: object

Response containing list of sessions.

Schema: [FormService_SessionListResponse](/api-reference/schemas/formservice-sessionlistresponse-1fe9e0e8ce.md)

- `items` (required)
  Type: array
  
  Items:
    Reference: [FormService_SessionResponse](/api-reference/schemas/formservice-sessionresponse-11edd23d9f.md); Type: object
    
    Response containing session information.

- `total` (required)
  Type: integer

- `skip` (optional)
  Type: integer
  
  default: 0

- `limit` (optional)
  Type: integer
  
  default: 20

- `has_next` (required)
  Type: boolean

- `has_previous` (required)
  Type: boolean

- 422: Validation Error

Content type: application/json

Type: object

Schema: [FormService_HTTPValidationError](/api-reference/schemas/formservice-httpvalidationerror-8e8725ba52.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [FormService_ValidationError](/api-reference/schemas/formservice-validationerror-e235b81cf9.md); Type: object

## Examples

### cURL

```bash
curl -X GET 'http://localhost:8010/api/v1/forms/sessions?skip=0&limit=20' \
  -H 'Authorization: Bearer YOUR_TOKEN'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8010/api/v1/forms/sessions?skip=0&limit=20', {
  method: 'GET',
  headers: {
    'Authorization': 'Bearer YOUR_TOKEN',
  },
});

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

### Python

```python
import requests

response = requests.get(
    'http://localhost:8010/api/v1/forms/sessions?skip=0&limit=20',
    headers={
        'Authorization': 'Bearer YOUR_TOKEN',
    },
)
print(response.text)
```


## List all sessions (admin)

`GET /api/v1/forms/sessions/all`

List all form sessions across users (admin only).

Authentication (security requirement alternatives):

```json
[
  {
    "HTTPBearer": []
  }
]
```

- HTTPBearer: http (bearer)

Parameters:

- `survey_id` (query, unknown, optional)
  Type: unknown
  
  anyOf:
    Type: string, uuid
  
    Type: null

- `user_id` (query, unknown, optional)
  Type: unknown
  
  anyOf:
    Type: string, uuid
  
    Type: null

- `status` (query, unknown, optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `skip` (query, integer, optional)
  Type: integer
  
  default: 0
  
  minimum: 0

- `limit` (query, integer, optional)
  Type: integer
  
  default: 20
  
  minimum: 1
  
  maximum: 100

Responses:

- 200: Successful Response

Content type: application/json

Type: object

Response containing list of sessions.

Schema: [FormService_SessionListResponse](/api-reference/schemas/formservice-sessionlistresponse-1fe9e0e8ce.md)

- `items` (required)
  Type: array
  
  Items:
    Reference: [FormService_SessionResponse](/api-reference/schemas/formservice-sessionresponse-11edd23d9f.md); Type: object
    
    Response containing session information.

- `total` (required)
  Type: integer

- `skip` (optional)
  Type: integer
  
  default: 0

- `limit` (optional)
  Type: integer
  
  default: 20

- `has_next` (required)
  Type: boolean

- `has_previous` (required)
  Type: boolean

- 422: Validation Error

Content type: application/json

Type: object

Schema: [FormService_HTTPValidationError](/api-reference/schemas/formservice-httpvalidationerror-8e8725ba52.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [FormService_ValidationError](/api-reference/schemas/formservice-validationerror-e235b81cf9.md); Type: object

## Examples

### cURL

```bash
curl -X GET 'http://localhost:8010/api/v1/forms/sessions/all?skip=0&limit=20' \
  -H 'Authorization: Bearer YOUR_TOKEN'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8010/api/v1/forms/sessions/all?skip=0&limit=20', {
  method: 'GET',
  headers: {
    'Authorization': 'Bearer YOUR_TOKEN',
  },
});

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

### Python

```python
import requests

response = requests.get(
    'http://localhost:8010/api/v1/forms/sessions/all?skip=0&limit=20',
    headers={
        'Authorization': 'Bearer YOUR_TOKEN',
    },
)
print(response.text)
```


## Get session

`GET /api/v1/forms/sessions/{session_id}`

Get a specific session by ID.

Authentication (security requirement alternatives):

```json
[
  {
    "HTTPBearer": []
  }
]
```

- HTTPBearer: http (bearer)

Parameters:

- `session_id` (path, string, uuid, required)
  Type: string, uuid

Responses:

- 200: Successful Response

Content type: application/json

Type: object

Response containing session information.

Schema: [FormService_SessionResponse](/api-reference/schemas/formservice-sessionresponse-11edd23d9f.md)

- `id` (required)
  Type: string, uuid

- `survey_id` (required)
  Type: string, uuid

- `survey_version_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string, uuid
  
    Type: null

- `session_token` (required)
  Type: string

- `status` (required)
  Type: string

- `current_page` (required)
  Type: integer

- `total_pages` (optional)
  Type: unknown
  
  anyOf:
    Type: integer
  
    Type: null

- `progress_percentage` (required)
  Type: integer

- `is_offline` (required)
  Type: boolean

- `started_at` (required)
  Type: string, date-time

- `last_activity_at` (required)
  Type: string, date-time

- `expires_at` (required)
  Type: string, date-time

- `completed_at` (optional)
  Type: unknown
  
  anyOf:
    Type: string, date-time
  
    Type: null

- `response_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string, uuid
  
    Type: null

- `metadata` (optional)
  Type: object
  
  default: {}
  
  Additional properties: true

- 422: Validation Error

Content type: application/json

Type: object

Schema: [FormService_HTTPValidationError](/api-reference/schemas/formservice-httpvalidationerror-8e8725ba52.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [FormService_ValidationError](/api-reference/schemas/formservice-validationerror-e235b81cf9.md); Type: object

## Examples

### cURL

```bash
curl -X GET 'http://localhost:8010/api/v1/forms/sessions/550e8400-e29b-41d4-a716-446655440000' \
  -H 'Authorization: Bearer YOUR_TOKEN'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8010/api/v1/forms/sessions/550e8400-e29b-41d4-a716-446655440000', {
  method: 'GET',
  headers: {
    'Authorization': 'Bearer YOUR_TOKEN',
  },
});

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

### Python

```python
import requests

response = requests.get(
    'http://localhost:8010/api/v1/forms/sessions/550e8400-e29b-41d4-a716-446655440000',
    headers={
        'Authorization': 'Bearer YOUR_TOKEN',
    },
)
print(response.text)
```


## Delete session

`DELETE /api/v1/forms/sessions/{session_id}`

Delete/invalidate a session.

Authentication (security requirement alternatives):

```json
[
  {
    "HTTPBearer": []
  }
]
```

- HTTPBearer: http (bearer)

Parameters:

- `session_id` (path, string, uuid, required)
  Type: string, uuid

Responses:

- 204: Successful Response

- 422: Validation Error

Content type: application/json

Type: object

Schema: [FormService_HTTPValidationError](/api-reference/schemas/formservice-httpvalidationerror-8e8725ba52.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [FormService_ValidationError](/api-reference/schemas/formservice-validationerror-e235b81cf9.md); Type: object

## Examples

### cURL

```bash
curl -X DELETE 'http://localhost:8010/api/v1/forms/sessions/550e8400-e29b-41d4-a716-446655440000' \
  -H 'Authorization: Bearer YOUR_TOKEN'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8010/api/v1/forms/sessions/550e8400-e29b-41d4-a716-446655440000', {
  method: 'DELETE',
  headers: {
    'Authorization': 'Bearer YOUR_TOKEN',
  },
});

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

### Python

```python
import requests

response = requests.delete(
    'http://localhost:8010/api/v1/forms/sessions/550e8400-e29b-41d4-a716-446655440000',
    headers={
        'Authorization': 'Bearer YOUR_TOKEN',
    },
)
print(response.text)
```


## Get session by token

`GET /api/v1/forms/sessions/token/{session_token}`

Get a session by its token.

Authentication: no security requirement declared for this operation.

Parameters:

- `session_token` (path, string, required)
  Type: string

Responses:

- 200: Successful Response

Content type: application/json

Type: object

Response containing session information.

Schema: [FormService_SessionResponse](/api-reference/schemas/formservice-sessionresponse-11edd23d9f.md)

- `id` (required)
  Type: string, uuid

- `survey_id` (required)
  Type: string, uuid

- `survey_version_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string, uuid
  
    Type: null

- `session_token` (required)
  Type: string

- `status` (required)
  Type: string

- `current_page` (required)
  Type: integer

- `total_pages` (optional)
  Type: unknown
  
  anyOf:
    Type: integer
  
    Type: null

- `progress_percentage` (required)
  Type: integer

- `is_offline` (required)
  Type: boolean

- `started_at` (required)
  Type: string, date-time

- `last_activity_at` (required)
  Type: string, date-time

- `expires_at` (required)
  Type: string, date-time

- `completed_at` (optional)
  Type: unknown
  
  anyOf:
    Type: string, date-time
  
    Type: null

- `response_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string, uuid
  
    Type: null

- `metadata` (optional)
  Type: object
  
  default: {}
  
  Additional properties: true

- 422: Validation Error

Content type: application/json

Type: object

Schema: [FormService_HTTPValidationError](/api-reference/schemas/formservice-httpvalidationerror-8e8725ba52.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [FormService_ValidationError](/api-reference/schemas/formservice-validationerror-e235b81cf9.md); Type: object

## Examples

### cURL

```bash
curl -X GET 'http://localhost:8010/api/v1/forms/sessions/token/string'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8010/api/v1/forms/sessions/token/string', {
  method: 'GET',
});

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

### Python

```python
import requests

response = requests.get('http://localhost:8010/api/v1/forms/sessions/token/string')
print(response.text)
```


## Resolve lookup values

`GET /api/v1/forms/{session_token}/lookup`

Resolve referee question values from lookup data based on trigger question answer.

Authentication: no security requirement declared for this operation.

Parameters:

- `session_token` (path, string, required)
  Type: string

- `trigger_question` (query, string, required) - Name of trigger question (e.g., 'uid')
  Type: string
  
  Name of trigger question (e.g., 'uid')

- `trigger_value` (query, string, required) - Value answered for trigger question
  Type: string
  
  Value answered for trigger question

Responses:

- 200: Successful Response

Content type: application/json

Type: object

Additional properties: true

- 422: Validation Error

Content type: application/json

Type: object

Schema: [FormService_HTTPValidationError](/api-reference/schemas/formservice-httpvalidationerror-8e8725ba52.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [FormService_ValidationError](/api-reference/schemas/formservice-validationerror-e235b81cf9.md); Type: object

## Examples

### cURL

```bash
curl -X GET 'http://localhost:8010/api/v1/forms/string/lookup?trigger_question=string&trigger_value=string'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8010/api/v1/forms/string/lookup?trigger_question=string&trigger_value=string', {
  method: 'GET',
});

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

### Python

```python
import requests

response = requests.get('http://localhost:8010/api/v1/forms/string/lookup?trigger_question=string&trigger_value=string')
print(response.text)
```


## Validate single field constraint

`POST /api/v1/validation/field`

Validate a single field against its XPath constraint

Authentication (security requirement alternatives):

```json
[
  {
    "HTTPBearer": []
  }
]
```

- HTTPBearer: http (bearer)

Request body: application/json (required)

Type: object

Request to validate a single field.

Schema: [FormService_ValidateFieldRequest](/api-reference/schemas/formservice-validatefieldrequest-fee5567ddf.md)

- `session_token` (required)
  Type: string
  
  Form session token

- `field_name` (required)
  Type: string
  
  Name of the field to validate

- `field_value` (required)
  Type: unknown
  
  Current value of the field

- `form_data` (optional)
  Type: object
  
  Complete form data
  
  Additional properties: true

Responses:

- 200: Successful Response

Content type: application/json

Type: object

Response for single field validation.

Schema: [FormService_ValidateFieldResponse](/api-reference/schemas/formservice-validatefieldresponse-6baa72e46e.md)

- `is_valid` (required)
  Type: boolean

- `field` (required)
  Type: string

- `errors` (optional)
  Type: array
  
  Items:
    Type: object
    
    Additional properties: true

- 422: Validation Error

Content type: application/json

Type: object

Schema: [FormService_HTTPValidationError](/api-reference/schemas/formservice-httpvalidationerror-8e8725ba52.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [FormService_ValidationError](/api-reference/schemas/formservice-validationerror-e235b81cf9.md); Type: object

## Examples

### cURL

```bash
curl -X POST 'http://localhost:8010/api/v1/validation/field' \
  -H 'Authorization: Bearer YOUR_TOKEN' \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "session_token": "string",
  "field_name": "string",
  "form_data": {}
}'
```

### JavaScript

```javascript
const body = `{
  "session_token": "string",
  "field_name": "string",
  "form_data": {}
}`;

const response = await fetch('http://localhost:8010/api/v1/validation/field', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer YOUR_TOKEN',
    'Content-Type': 'application/json',
  },
  body,
});

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

### Python

```python
import requests

body = '''{
  "session_token": "string",
  "field_name": "string",
  "form_data": {}
}'''

response = requests.post(
    'http://localhost:8010/api/v1/validation/field',
    data=body.encode('utf-8'),
    headers={
        'Authorization': 'Bearer YOUR_TOKEN',
        'Content-Type': 'application/json',
    },
)
print(response.text)
```


## Validate entire form

`POST /api/v1/validation/form`

Validate all field constraints in a form

Authentication (security requirement alternatives):

```json
[
  {
    "HTTPBearer": []
  }
]
```

- HTTPBearer: http (bearer)

Request body: application/json (required)

Type: object

Request to validate entire form.

Schema: [FormService_ValidateFormRequest](/api-reference/schemas/formservice-validateformrequest-844286fc55.md)

- `session_token` (required)
  Type: string
  
  Form session token

- `form_data` (required)
  Type: object
  
  Form data to validate
  
  Additional properties: true

- `fields_to_validate` (optional)
  Type: unknown
  
  Optional list of fields to validate (all if not specified)
  
  anyOf:
    Type: array
    
    Items:
      Type: string
  
    Type: null

Responses:

- 200: Successful Response

Content type: application/json

Type: object

Response for form validation.

Schema: [FormService_ValidateFormResponse](/api-reference/schemas/formservice-validateformresponse-957dec06ed.md)

- `is_valid` (required)
  Type: boolean

- `errors` (optional)
  Type: array
  
  Items:
    Type: object
    
    Additional properties: true

- `total_fields` (required)
  Type: integer

- `valid_fields` (required)
  Type: integer

- `invalid_fields` (required)
  Type: integer

- 422: Validation Error

Content type: application/json

Type: object

Schema: [FormService_HTTPValidationError](/api-reference/schemas/formservice-httpvalidationerror-8e8725ba52.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [FormService_ValidationError](/api-reference/schemas/formservice-validationerror-e235b81cf9.md); Type: object

## Examples

### cURL

```bash
curl -X POST 'http://localhost:8010/api/v1/validation/form' \
  -H 'Authorization: Bearer YOUR_TOKEN' \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "session_token": "string",
  "form_data": {},
  "fields_to_validate": [
    "string"
  ]
}'
```

### JavaScript

```javascript
const body = `{
  "session_token": "string",
  "form_data": {},
  "fields_to_validate": [
    "string"
  ]
}`;

const response = await fetch('http://localhost:8010/api/v1/validation/form', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer YOUR_TOKEN',
    'Content-Type': 'application/json',
  },
  body,
});

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

### Python

```python
import requests

body = '''{
  "session_token": "string",
  "form_data": {},
  "fields_to_validate": [
    "string"
  ]
}'''

response = requests.post(
    'http://localhost:8010/api/v1/validation/form',
    data=body.encode('utf-8'),
    headers={
        'Authorization': 'Bearer YOUR_TOKEN',
        'Content-Type': 'application/json',
    },
)
print(response.text)
```


## Evaluate XPath expression

`POST /api/v1/validation/evaluate`

Evaluate an XPath expression with form data context

Authentication (security requirement alternatives):

```json
[
  {
    "HTTPBearer": []
  }
]
```

- HTTPBearer: http (bearer)

Request body: application/json (required)

Type: object

Request to evaluate an XPath expression.

Schema: [FormService_EvaluateExpressionRequest](/api-reference/schemas/formservice-evaluateexpressionrequest-35ddfa78e2.md)

- `session_token` (required)
  Type: string
  
  Form session token

- `expression` (required)
  Type: string
  
  XPath expression to evaluate

- `form_data` (optional)
  Type: object
  
  Form data for variable resolution
  
  Additional properties: true

Responses:

- 200: Successful Response

Content type: application/json

Type: object

Response for expression evaluation.

Schema: [FormService_EvaluateExpressionResponse](/api-reference/schemas/formservice-evaluateexpressionresponse-61ee13f101.md)

- `success` (required)
  Type: boolean

- `result` (optional)
  Type: unknown

- `error` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- 422: Validation Error

Content type: application/json

Type: object

Schema: [FormService_HTTPValidationError](/api-reference/schemas/formservice-httpvalidationerror-8e8725ba52.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [FormService_ValidationError](/api-reference/schemas/formservice-validationerror-e235b81cf9.md); Type: object

## Examples

### cURL

```bash
curl -X POST 'http://localhost:8010/api/v1/validation/evaluate' \
  -H 'Authorization: Bearer YOUR_TOKEN' \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "session_token": "string",
  "expression": "string",
  "form_data": {}
}'
```

### JavaScript

```javascript
const body = `{
  "session_token": "string",
  "expression": "string",
  "form_data": {}
}`;

const response = await fetch('http://localhost:8010/api/v1/validation/evaluate', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer YOUR_TOKEN',
    'Content-Type': 'application/json',
  },
  body,
});

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

### Python

```python
import requests

body = '''{
  "session_token": "string",
  "expression": "string",
  "form_data": {}
}'''

response = requests.post(
    'http://localhost:8010/api/v1/validation/evaluate',
    data=body.encode('utf-8'),
    headers={
        'Authorization': 'Bearer YOUR_TOKEN',
        'Content-Type': 'application/json',
    },
)
print(response.text)
```


## List available XPath functions

`GET /api/v1/validation/functions`

Get list of all available XPath/ODK functions

Authentication (security requirement alternatives):

```json
[
  {
    "HTTPBearer": []
  }
]
```

- HTTPBearer: http (bearer)

Responses:

- 200: Successful Response

Content type: application/json

Type: unknown

## Examples

### cURL

```bash
curl -X GET 'http://localhost:8010/api/v1/validation/functions' \
  -H 'Authorization: Bearer YOUR_TOKEN'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8010/api/v1/validation/functions', {
  method: 'GET',
  headers: {
    'Authorization': 'Bearer YOUR_TOKEN',
  },
});

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

### Python

```python
import requests

response = requests.get(
    'http://localhost:8010/api/v1/validation/functions',
    headers={
        'Authorization': 'Bearer YOUR_TOKEN',
    },
)
print(response.text)
```


## Test constraint expression

`POST /api/v1/validation/test-constraint`

Test a constraint expression with sample data

Authentication (security requirement alternatives):

```json
[
  {
    "HTTPBearer": []
  }
]
```

- HTTPBearer: http (bearer)

Parameters:

- `constraint` (query, string, required)
  Type: string

- `field_name` (query, string, optional)
  Type: string
  
  default: "test_field"

- `field_value` (query, unknown, optional)
  Type: unknown

Request body: application/json

Type: object

default: {}

Additional properties: true

Responses:

- 200: Successful Response

Content type: application/json

Type: unknown

- 422: Validation Error

Content type: application/json

Type: object

Schema: [FormService_HTTPValidationError](/api-reference/schemas/formservice-httpvalidationerror-8e8725ba52.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [FormService_ValidationError](/api-reference/schemas/formservice-validationerror-e235b81cf9.md); Type: object

## Examples

### cURL

```bash
curl -X POST 'http://localhost:8010/api/v1/validation/test-constraint?constraint=string&field_name=test_field' \
  -H 'Authorization: Bearer YOUR_TOKEN' \
  -H 'Content-Type: application/json' \
  --data-raw '{}'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8010/api/v1/validation/test-constraint?constraint=string&field_name=test_field', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer YOUR_TOKEN',
    'Content-Type': 'application/json',
  },
  body: '{}',
});

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

### Python

```python
import requests

response = requests.post(
    'http://localhost:8010/api/v1/validation/test-constraint?constraint=string&field_name=test_field',
    data='{}'.encode('utf-8'),
    headers={
        'Authorization': 'Bearer YOUR_TOKEN',
        'Content-Type': 'application/json',
    },
)
print(response.text)
```


## List RID block allocations

`GET /api/v1/interviews/rid-blocks`

List RID block allocations for the tenant. Field users see their own blocks.

Authentication (security requirement alternatives):

```json
[
  {
    "HTTPBearer": []
  }
]
```

- HTTPBearer: http (bearer)

Parameters:

- `survey_id` (query, unknown, optional) - Filter by survey ID
  Type: unknown
  
  Filter by survey ID
  
  anyOf:
    Type: string, uuid
  
    Type: null

- `device_id` (query, unknown, optional) - Filter by device ID
  Type: unknown
  
  Filter by device ID
  
  anyOf:
    Type: string
  
    Type: null

- `limit` (query, integer, optional)
  Type: integer
  
  default: 50
  
  minimum: 1
  
  maximum: 100

- `offset` (query, integer, optional)
  Type: integer
  
  default: 0
  
  minimum: 0

Responses:

- 200: Successful Response

Content type: application/json

Type: object

List of RID block allocations.

Schema: [FormService_RidBlockListResponse](/api-reference/schemas/formservice-ridblocklistresponse-2b9b9da213.md)

- `items` (required)
  Type: array
  
  Items:
    Reference: [FormService_RidBlockResponse](/api-reference/schemas/formservice-ridblockresponse-4b8c100a7a.md); Type: object
    
    Server-allocated device-bound RID block response (matches mobile RidBlockDto).

- `total` (required)
  Type: integer

- 422: Validation Error

Content type: application/json

Type: object

Schema: [FormService_HTTPValidationError](/api-reference/schemas/formservice-httpvalidationerror-8e8725ba52.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [FormService_ValidationError](/api-reference/schemas/formservice-validationerror-e235b81cf9.md); Type: object

## Examples

### cURL

```bash
curl -X GET 'http://localhost:8010/api/v1/interviews/rid-blocks?limit=50&offset=0' \
  -H 'Authorization: Bearer YOUR_TOKEN'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8010/api/v1/interviews/rid-blocks?limit=50&offset=0', {
  method: 'GET',
  headers: {
    'Authorization': 'Bearer YOUR_TOKEN',
  },
});

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

### Python

```python
import requests

response = requests.get(
    'http://localhost:8010/api/v1/interviews/rid-blocks?limit=50&offset=0',
    headers={
        'Authorization': 'Bearer YOUR_TOKEN',
    },
)
print(response.text)
```


## Allocate server-issued device-bound RID block

`POST /api/v1/interviews/rid-blocks`

Allocate a non-overlapping block of RIDs bound to (tenant, survey, user, device) (R25 / AD-3).

Authentication (security requirement alternatives):

```json
[
  {
    "HTTPBearer": []
  }
]
```

- HTTPBearer: http (bearer)

Request body: application/json (required)

Type: object

Request payload for server-allocated device-bound RID block (R25 / AD-3).

Schema: [FormService_RidBlockAllocationRequest](/api-reference/schemas/formservice-ridblockallocationrequest-0933e80022.md)

- `survey_id` (required)
  Type: string, uuid
  
  ID of the survey for which RID block is requested

- `device_id` (required)
  Type: string
  
  Unique client device ID (non-placeholder)
  
  minLength: 4
  
  maxLength: 255

- `block_size` (optional)
  Type: integer
  
  Number of sequential RIDs to allocate
  
  default: 50
  
  minimum: 1
  
  maximum: 200

- `idempotency_key` (optional)
  Type: unknown
  
  Client idempotency key for safe retries
  
  anyOf:
    Type: string
    
    maxLength: 255
  
    Type: null

Responses:

- 201: Successful Response

Content type: application/json

Type: object

Server-allocated device-bound RID block response (matches mobile RidBlockDto).

Schema: [FormService_RidBlockResponse](/api-reference/schemas/formservice-ridblockresponse-4b8c100a7a.md)

- `id` (required)
  Type: string, uuid

- `tenant_id` (required)
  Type: string, uuid

- `survey_id` (required)
  Type: string, uuid

- `user_id` (required)
  Type: string, uuid

- `user_code` (required)
  Type: string

- `device_id` (required)
  Type: string

- `start_seq` (required)
  Type: integer

- `end_seq` (required)
  Type: integer

- `current_seq` (required)
  Type: integer

- `is_exhausted` (optional)
  Type: boolean
  
  default: false

- `idempotency_key` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `created_at` (required)
  Type: string

- 422: Validation Error

Content type: application/json

Type: object

Schema: [FormService_HTTPValidationError](/api-reference/schemas/formservice-httpvalidationerror-8e8725ba52.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [FormService_ValidationError](/api-reference/schemas/formservice-validationerror-e235b81cf9.md); Type: object

## Examples

### cURL

```bash
curl -X POST 'http://localhost:8010/api/v1/interviews/rid-blocks' \
  -H 'Authorization: Bearer YOUR_TOKEN' \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "survey_id": "550e8400-e29b-41d4-a716-446655440000",
  "device_id": "string",
  "block_size": 50,
  "idempotency_key": "string"
}'
```

### JavaScript

```javascript
const body = `{
  "survey_id": "550e8400-e29b-41d4-a716-446655440000",
  "device_id": "string",
  "block_size": 50,
  "idempotency_key": "string"
}`;

const response = await fetch('http://localhost:8010/api/v1/interviews/rid-blocks', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer YOUR_TOKEN',
    'Content-Type': 'application/json',
  },
  body,
});

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

### Python

```python
import requests

body = '''{
  "survey_id": "550e8400-e29b-41d4-a716-446655440000",
  "device_id": "string",
  "block_size": 50,
  "idempotency_key": "string"
}'''

response = requests.post(
    'http://localhost:8010/api/v1/interviews/rid-blocks',
    data=body.encode('utf-8'),
    headers={
        'Authorization': 'Bearer YOUR_TOKEN',
        'Content-Type': 'application/json',
    },
)
print(response.text)
```


## List interviews

`GET /api/v1/interviews`

Authentication (security requirement alternatives):

```json
[
  {
    "HTTPBearer": []
  }
]
```

- HTTPBearer: http (bearer)

Parameters:

- `status_filter` (query, unknown, optional) - Filter by status
  Type: unknown
  
  Filter by status
  
  anyOf:
    Type: string
  
    Type: null

- `survey_id` (query, unknown, optional) - Filter by survey ID
  Type: unknown
  
  Filter by survey ID
  
  anyOf:
    Type: string, uuid
  
    Type: null

- `interviewer_id` (query, unknown, optional) - Filter by interviewer
  Type: unknown
  
  Filter by interviewer
  
  anyOf:
    Type: string, uuid
  
    Type: null

- `respondent_id` (query, unknown, optional) - Filter by respondent
  Type: unknown
  
  Filter by respondent
  
  anyOf:
    Type: string, uuid
  
    Type: null

- `search` (query, unknown, optional) - Search by session token
  Type: unknown
  
  Search by session token
  
  anyOf:
    Type: string
  
    Type: null

- `sort` (query, unknown, optional) - Sort by: last_activity, started_at, completion, created_at
  Type: unknown
  
  Sort by: last_activity, started_at, completion, created_at
  
  anyOf:
    Type: string
  
    Type: null

- `skip` (query, integer, optional)
  Type: integer
  
  default: 0
  
  minimum: 0

- `limit` (query, integer, optional)
  Type: integer
  
  default: 20
  
  minimum: 1
  
  maximum: 100

Responses:

- 200: Successful Response

Content type: application/json

Type: object

Schema: [FormService_InterviewListResponse](/api-reference/schemas/formservice-interviewlistresponse-7153ae680b.md)

- `items` (required)
  Type: array
  
  Items:
    Reference: [FormService_InterviewDto](/api-reference/schemas/formservice-interviewdto-8f3906253b.md); Type: object

- `total` (required)
  Type: integer

- `skip` (optional)
  Type: integer
  
  default: 0

- `limit` (optional)
  Type: integer
  
  default: 20

- `has_next` (optional)
  Type: boolean
  
  default: false

- `has_previous` (optional)
  Type: boolean
  
  default: false

- 422: Validation Error

Content type: application/json

Type: object

Schema: [FormService_HTTPValidationError](/api-reference/schemas/formservice-httpvalidationerror-8e8725ba52.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [FormService_ValidationError](/api-reference/schemas/formservice-validationerror-e235b81cf9.md); Type: object

## Examples

### cURL

```bash
curl -X GET 'http://localhost:8010/api/v1/interviews?skip=0&limit=20' \
  -H 'Authorization: Bearer YOUR_TOKEN'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8010/api/v1/interviews?skip=0&limit=20', {
  method: 'GET',
  headers: {
    'Authorization': 'Bearer YOUR_TOKEN',
  },
});

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

### Python

```python
import requests

response = requests.get(
    'http://localhost:8010/api/v1/interviews?skip=0&limit=20',
    headers={
        'Authorization': 'Bearer YOUR_TOKEN',
    },
)
print(response.text)
```


## Create interview

`POST /api/v1/interviews`

Authentication (security requirement alternatives):

```json
[
  {
    "HTTPBearer": []
  }
]
```

- HTTPBearer: http (bearer)

Request body: application/json (required)

Type: object

Schema: [FormService_CreateInterviewDto](/api-reference/schemas/formservice-createinterviewdto-1a4f776587.md)

- `survey_id` (required)
  Type: string, uuid

- `respondent_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string, uuid
  
    Type: null

- `session_token` (required)
  Type: string

- `total_questions` (optional)
  Type: integer
  
  default: 0

- `language` (optional)
  Type: unknown
  
  Active language code during interview (e.g., 'en', 'es', 'hi')
  
  anyOf:
    Type: string
    
    maxLength: 10
  
    Type: null

- `interview_metadata` (optional)
  Type: object
  
  default: {}
  
  Additional properties: true

- `survey_name` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `response_rid` (optional)
  Type: unknown
  
  DEPRECATED. The server allocates the permanent RID at interview creation. This field is ignored for NEW interviews and only used as a last-resort backfill for legacy interviews created before server-side allocation.
  
  anyOf:
    Type: string
  
    Type: null

Responses:

- 201: Successful Response

Content type: application/json

Type: object

Schema: [FormService_InterviewDto](/api-reference/schemas/formservice-interviewdto-8f3906253b.md)

- `id` (required)
  Type: string, uuid

- `tenant_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string, uuid
  
    Type: null

- `survey_id` (required)
  Type: string, uuid

- `respondent_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string, uuid
  
    Type: null

- `interviewer_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string, uuid
  
    Type: null

- `session_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string, uuid
  
    Type: null

- `session_token` (required)
  Type: string

- `status` (required)
  Type: string

- `started_at` (optional)
  Type: unknown
  
  anyOf:
    Type: string, date-time
  
    Type: null

- `paused_at` (optional)
  Type: unknown
  
  anyOf:
    Type: string, date-time
  
    Type: null

- `completed_at` (optional)
  Type: unknown
  
  anyOf:
    Type: string, date-time
  
    Type: null

- `terminated_at` (optional)
  Type: unknown
  
  anyOf:
    Type: string, date-time
  
    Type: null

- `termination_reason` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `last_heartbeat_at` (optional)
  Type: unknown
  
  anyOf:
    Type: string, date-time
  
    Type: null

- `language` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `interview_metadata` (optional)
  Type: object
  
  default: {}
  
  Additional properties: true

- `current_page` (optional)
  Type: integer
  
  default: 0

- `answered_count` (optional)
  Type: integer
  
  default: 0

- `total_questions` (optional)
  Type: integer
  
  default: 0

- `survey_name` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `response_rid` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `response_uid` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `current_response_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string, uuid
  
    Type: null

- `created_at` (required)
  Type: string, date-time

- `updated_at` (required)
  Type: string, date-time

- 422: Validation Error

Content type: application/json

Type: object

Schema: [FormService_HTTPValidationError](/api-reference/schemas/formservice-httpvalidationerror-8e8725ba52.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [FormService_ValidationError](/api-reference/schemas/formservice-validationerror-e235b81cf9.md); Type: object

## Examples

### cURL

```bash
curl -X POST 'http://localhost:8010/api/v1/interviews' \
  -H 'Authorization: Bearer YOUR_TOKEN' \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "survey_id": "550e8400-e29b-41d4-a716-446655440000",
  "respondent_id": "550e8400-e29b-41d4-a716-446655440000",
  "session_token": "string",
  "total_questions": 0,
  "language": "string",
  "interview_metadata": {},
  "survey_name": "string",
  "response_rid": "string"
}'
```

### JavaScript

```javascript
const body = `{
  "survey_id": "550e8400-e29b-41d4-a716-446655440000",
  "respondent_id": "550e8400-e29b-41d4-a716-446655440000",
  "session_token": "string",
  "total_questions": 0,
  "language": "string",
  "interview_metadata": {},
  "survey_name": "string",
  "response_rid": "string"
}`;

const response = await fetch('http://localhost:8010/api/v1/interviews', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer YOUR_TOKEN',
    'Content-Type': 'application/json',
  },
  body,
});

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

### Python

```python
import requests

body = '''{
  "survey_id": "550e8400-e29b-41d4-a716-446655440000",
  "respondent_id": "550e8400-e29b-41d4-a716-446655440000",
  "session_token": "string",
  "total_questions": 0,
  "language": "string",
  "interview_metadata": {},
  "survey_name": "string",
  "response_rid": "string"
}'''

response = requests.post(
    'http://localhost:8010/api/v1/interviews',
    data=body.encode('utf-8'),
    headers={
        'Authorization': 'Bearer YOUR_TOKEN',
        'Content-Type': 'application/json',
    },
)
print(response.text)
```


## Resolve interview by session token

`GET /api/v1/interviews/resolve/by-session-token/{session_token}`

Authentication (security requirement alternatives):

```json
[
  {
    "HTTPBearer": []
  }
]
```

- HTTPBearer: http (bearer)

Parameters:

- `session_token` (path, string, required)
  Type: string

Responses:

- 200: Successful Response

Content type: application/json

Type: object

Schema: [FormService_InterviewDto](/api-reference/schemas/formservice-interviewdto-8f3906253b.md)

- `id` (required)
  Type: string, uuid

- `tenant_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string, uuid
  
    Type: null

- `survey_id` (required)
  Type: string, uuid

- `respondent_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string, uuid
  
    Type: null

- `interviewer_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string, uuid
  
    Type: null

- `session_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string, uuid
  
    Type: null

- `session_token` (required)
  Type: string

- `status` (required)
  Type: string

- `started_at` (optional)
  Type: unknown
  
  anyOf:
    Type: string, date-time
  
    Type: null

- `paused_at` (optional)
  Type: unknown
  
  anyOf:
    Type: string, date-time
  
    Type: null

- `completed_at` (optional)
  Type: unknown
  
  anyOf:
    Type: string, date-time
  
    Type: null

- `terminated_at` (optional)
  Type: unknown
  
  anyOf:
    Type: string, date-time
  
    Type: null

- `termination_reason` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `last_heartbeat_at` (optional)
  Type: unknown
  
  anyOf:
    Type: string, date-time
  
    Type: null

- `language` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `interview_metadata` (optional)
  Type: object
  
  default: {}
  
  Additional properties: true

- `current_page` (optional)
  Type: integer
  
  default: 0

- `answered_count` (optional)
  Type: integer
  
  default: 0

- `total_questions` (optional)
  Type: integer
  
  default: 0

- `survey_name` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `response_rid` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `response_uid` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `current_response_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string, uuid
  
    Type: null

- `created_at` (required)
  Type: string, date-time

- `updated_at` (required)
  Type: string, date-time

- 422: Validation Error

Content type: application/json

Type: object

Schema: [FormService_HTTPValidationError](/api-reference/schemas/formservice-httpvalidationerror-8e8725ba52.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [FormService_ValidationError](/api-reference/schemas/formservice-validationerror-e235b81cf9.md); Type: object

## Examples

### cURL

```bash
curl -X GET 'http://localhost:8010/api/v1/interviews/resolve/by-session-token/string' \
  -H 'Authorization: Bearer YOUR_TOKEN'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8010/api/v1/interviews/resolve/by-session-token/string', {
  method: 'GET',
  headers: {
    'Authorization': 'Bearer YOUR_TOKEN',
  },
});

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

### Python

```python
import requests

response = requests.get(
    'http://localhost:8010/api/v1/interviews/resolve/by-session-token/string',
    headers={
        'Authorization': 'Bearer YOUR_TOKEN',
    },
)
print(response.text)
```


## Get interview details

`GET /api/v1/interviews/{interview_id}`

Authentication (security requirement alternatives):

```json
[
  {
    "HTTPBearer": []
  }
]
```

- HTTPBearer: http (bearer)

Parameters:

- `interview_id` (path, string, uuid, required)
  Type: string, uuid

Responses:

- 200: Successful Response

Content type: application/json

Type: object

Schema: [FormService_InterviewDto](/api-reference/schemas/formservice-interviewdto-8f3906253b.md)

- `id` (required)
  Type: string, uuid

- `tenant_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string, uuid
  
    Type: null

- `survey_id` (required)
  Type: string, uuid

- `respondent_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string, uuid
  
    Type: null

- `interviewer_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string, uuid
  
    Type: null

- `session_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string, uuid
  
    Type: null

- `session_token` (required)
  Type: string

- `status` (required)
  Type: string

- `started_at` (optional)
  Type: unknown
  
  anyOf:
    Type: string, date-time
  
    Type: null

- `paused_at` (optional)
  Type: unknown
  
  anyOf:
    Type: string, date-time
  
    Type: null

- `completed_at` (optional)
  Type: unknown
  
  anyOf:
    Type: string, date-time
  
    Type: null

- `terminated_at` (optional)
  Type: unknown
  
  anyOf:
    Type: string, date-time
  
    Type: null

- `termination_reason` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `last_heartbeat_at` (optional)
  Type: unknown
  
  anyOf:
    Type: string, date-time
  
    Type: null

- `language` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `interview_metadata` (optional)
  Type: object
  
  default: {}
  
  Additional properties: true

- `current_page` (optional)
  Type: integer
  
  default: 0

- `answered_count` (optional)
  Type: integer
  
  default: 0

- `total_questions` (optional)
  Type: integer
  
  default: 0

- `survey_name` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `response_rid` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `response_uid` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `current_response_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string, uuid
  
    Type: null

- `created_at` (required)
  Type: string, date-time

- `updated_at` (required)
  Type: string, date-time

- 422: Validation Error

Content type: application/json

Type: object

Schema: [FormService_HTTPValidationError](/api-reference/schemas/formservice-httpvalidationerror-8e8725ba52.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [FormService_ValidationError](/api-reference/schemas/formservice-validationerror-e235b81cf9.md); Type: object

## Examples

### cURL

```bash
curl -X GET 'http://localhost:8010/api/v1/interviews/550e8400-e29b-41d4-a716-446655440000' \
  -H 'Authorization: Bearer YOUR_TOKEN'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8010/api/v1/interviews/550e8400-e29b-41d4-a716-446655440000', {
  method: 'GET',
  headers: {
    'Authorization': 'Bearer YOUR_TOKEN',
  },
});

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

### Python

```python
import requests

response = requests.get(
    'http://localhost:8010/api/v1/interviews/550e8400-e29b-41d4-a716-446655440000',
    headers={
        'Authorization': 'Bearer YOUR_TOKEN',
    },
)
print(response.text)
```


## Soft-delete interview (only if status is created)

`DELETE /api/v1/interviews/{interview_id}`

Authentication (security requirement alternatives):

```json
[
  {
    "HTTPBearer": []
  }
]
```

- HTTPBearer: http (bearer)

Parameters:

- `interview_id` (path, string, uuid, required)
  Type: string, uuid

Responses:

- 204: Successful Response

- 422: Validation Error

Content type: application/json

Type: object

Schema: [FormService_HTTPValidationError](/api-reference/schemas/formservice-httpvalidationerror-8e8725ba52.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [FormService_ValidationError](/api-reference/schemas/formservice-validationerror-e235b81cf9.md); Type: object

## Examples

### cURL

```bash
curl -X DELETE 'http://localhost:8010/api/v1/interviews/550e8400-e29b-41d4-a716-446655440000' \
  -H 'Authorization: Bearer YOUR_TOKEN'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8010/api/v1/interviews/550e8400-e29b-41d4-a716-446655440000', {
  method: 'DELETE',
  headers: {
    'Authorization': 'Bearer YOUR_TOKEN',
  },
});

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

### Python

```python
import requests

response = requests.delete(
    'http://localhost:8010/api/v1/interviews/550e8400-e29b-41d4-a716-446655440000',
    headers={
        'Authorization': 'Bearer YOUR_TOKEN',
    },
)
print(response.text)
```


## Update interview metadata

`PATCH /api/v1/interviews/{interview_id}`

Authentication (security requirement alternatives):

```json
[
  {
    "HTTPBearer": []
  }
]
```

- HTTPBearer: http (bearer)

Parameters:

- `interview_id` (path, string, uuid, required)
  Type: string, uuid

Request body: application/json (required)

Type: object

Schema: [FormService_UpdateInterviewDto](/api-reference/schemas/formservice-updateinterviewdto-c7d9ace9ae.md)

- `respondent_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string, uuid
  
    Type: null

- `current_page` (optional)
  Type: unknown
  
  anyOf:
    Type: integer
  
    Type: null

- `answered_count` (optional)
  Type: unknown
  
  anyOf:
    Type: integer
  
    Type: null

- `total_questions` (optional)
  Type: unknown
  
  anyOf:
    Type: integer
  
    Type: null

- `interview_metadata` (optional)
  Type: unknown
  
  anyOf:
    Type: object
    
    Additional properties: true
  
    Type: null

Responses:

- 200: Successful Response

Content type: application/json

Type: object

Schema: [FormService_InterviewDto](/api-reference/schemas/formservice-interviewdto-8f3906253b.md)

- `id` (required)
  Type: string, uuid

- `tenant_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string, uuid
  
    Type: null

- `survey_id` (required)
  Type: string, uuid

- `respondent_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string, uuid
  
    Type: null

- `interviewer_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string, uuid
  
    Type: null

- `session_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string, uuid
  
    Type: null

- `session_token` (required)
  Type: string

- `status` (required)
  Type: string

- `started_at` (optional)
  Type: unknown
  
  anyOf:
    Type: string, date-time
  
    Type: null

- `paused_at` (optional)
  Type: unknown
  
  anyOf:
    Type: string, date-time
  
    Type: null

- `completed_at` (optional)
  Type: unknown
  
  anyOf:
    Type: string, date-time
  
    Type: null

- `terminated_at` (optional)
  Type: unknown
  
  anyOf:
    Type: string, date-time
  
    Type: null

- `termination_reason` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `last_heartbeat_at` (optional)
  Type: unknown
  
  anyOf:
    Type: string, date-time
  
    Type: null

- `language` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `interview_metadata` (optional)
  Type: object
  
  default: {}
  
  Additional properties: true

- `current_page` (optional)
  Type: integer
  
  default: 0

- `answered_count` (optional)
  Type: integer
  
  default: 0

- `total_questions` (optional)
  Type: integer
  
  default: 0

- `survey_name` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `response_rid` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `response_uid` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `current_response_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string, uuid
  
    Type: null

- `created_at` (required)
  Type: string, date-time

- `updated_at` (required)
  Type: string, date-time

- 422: Validation Error

Content type: application/json

Type: object

Schema: [FormService_HTTPValidationError](/api-reference/schemas/formservice-httpvalidationerror-8e8725ba52.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [FormService_ValidationError](/api-reference/schemas/formservice-validationerror-e235b81cf9.md); Type: object

## Examples

### cURL

```bash
curl -X PATCH 'http://localhost:8010/api/v1/interviews/550e8400-e29b-41d4-a716-446655440000' \
  -H 'Authorization: Bearer YOUR_TOKEN' \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "respondent_id": "550e8400-e29b-41d4-a716-446655440000",
  "current_page": 0,
  "answered_count": 0,
  "total_questions": 0,
  "interview_metadata": {}
}'
```

### JavaScript

```javascript
const body = `{
  "respondent_id": "550e8400-e29b-41d4-a716-446655440000",
  "current_page": 0,
  "answered_count": 0,
  "total_questions": 0,
  "interview_metadata": {}
}`;

const response = await fetch('http://localhost:8010/api/v1/interviews/550e8400-e29b-41d4-a716-446655440000', {
  method: 'PATCH',
  headers: {
    'Authorization': 'Bearer YOUR_TOKEN',
    'Content-Type': 'application/json',
  },
  body,
});

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

### Python

```python
import requests

body = '''{
  "respondent_id": "550e8400-e29b-41d4-a716-446655440000",
  "current_page": 0,
  "answered_count": 0,
  "total_questions": 0,
  "interview_metadata": {}
}'''

response = requests.patch(
    'http://localhost:8010/api/v1/interviews/550e8400-e29b-41d4-a716-446655440000',
    data=body.encode('utf-8'),
    headers={
        'Authorization': 'Bearer YOUR_TOKEN',
        'Content-Type': 'application/json',
    },
)
print(response.text)
```


## Transition interview status

`POST /api/v1/interviews/{interview_id}/transition`

Authentication (security requirement alternatives):

```json
[
  {
    "HTTPBearer": []
  }
]
```

- HTTPBearer: http (bearer)

Parameters:

- `interview_id` (path, string, uuid, required)
  Type: string, uuid

Request body: application/json (required)

Type: object

Schema: [FormService_TransitionInterviewDto](/api-reference/schemas/formservice-transitioninterviewdto-c26435a1a1.md)

- `to_status` (required)
  Type: string

- `termination_reason` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `explanatory_text` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `form_data` (optional)
  Type: unknown
  
  anyOf:
    Type: object
    
    Additional properties: true
  
    Type: null

- `is_complete` (optional)
  Type: unknown
  
  anyOf:
    Type: boolean
  
    Type: null

- `current_page` (optional)
  Type: unknown
  
  anyOf:
    Type: integer
  
    Type: null

- `version_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `edit_response_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `duration_seconds` (optional)
  Type: unknown
  
  anyOf:
    Type: integer
  
    Type: null

- `question_paradata` (optional)
  Type: unknown
  
  Phase-1 question paradata (T). Additive — merged into InterviewExecution.interview_metadata.question_paradata before the transition, and forwarded to data-service response_metadata at completion/retained termination. Existing metadata keys are preserved.
  
  anyOf:
    Type: object
    
    Additional properties: true
  
    Type: null

Responses:

- 200: Successful Response

Content type: application/json

Type: object

Schema: [FormService_InterviewDto](/api-reference/schemas/formservice-interviewdto-8f3906253b.md)

- `id` (required)
  Type: string, uuid

- `tenant_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string, uuid
  
    Type: null

- `survey_id` (required)
  Type: string, uuid

- `respondent_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string, uuid
  
    Type: null

- `interviewer_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string, uuid
  
    Type: null

- `session_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string, uuid
  
    Type: null

- `session_token` (required)
  Type: string

- `status` (required)
  Type: string

- `started_at` (optional)
  Type: unknown
  
  anyOf:
    Type: string, date-time
  
    Type: null

- `paused_at` (optional)
  Type: unknown
  
  anyOf:
    Type: string, date-time
  
    Type: null

- `completed_at` (optional)
  Type: unknown
  
  anyOf:
    Type: string, date-time
  
    Type: null

- `terminated_at` (optional)
  Type: unknown
  
  anyOf:
    Type: string, date-time
  
    Type: null

- `termination_reason` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `last_heartbeat_at` (optional)
  Type: unknown
  
  anyOf:
    Type: string, date-time
  
    Type: null

- `language` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `interview_metadata` (optional)
  Type: object
  
  default: {}
  
  Additional properties: true

- `current_page` (optional)
  Type: integer
  
  default: 0

- `answered_count` (optional)
  Type: integer
  
  default: 0

- `total_questions` (optional)
  Type: integer
  
  default: 0

- `survey_name` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `response_rid` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `response_uid` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `current_response_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string, uuid
  
    Type: null

- `created_at` (required)
  Type: string, date-time

- `updated_at` (required)
  Type: string, date-time

- 422: Validation Error

Content type: application/json

Type: object

Schema: [FormService_HTTPValidationError](/api-reference/schemas/formservice-httpvalidationerror-8e8725ba52.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [FormService_ValidationError](/api-reference/schemas/formservice-validationerror-e235b81cf9.md); Type: object

## Examples

### cURL

```bash
curl -X POST 'http://localhost:8010/api/v1/interviews/550e8400-e29b-41d4-a716-446655440000/transition' \
  -H 'Authorization: Bearer YOUR_TOKEN' \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "to_status": "string",
  "termination_reason": "string",
  "explanatory_text": "string",
  "form_data": {},
  "is_complete": true,
  "current_page": 0,
  "version_id": "string",
  "edit_response_id": "string",
  "duration_seconds": 0,
  "question_paradata": {}
}'
```

### JavaScript

```javascript
const body = `{
  "to_status": "string",
  "termination_reason": "string",
  "explanatory_text": "string",
  "form_data": {},
  "is_complete": true,
  "current_page": 0,
  "version_id": "string",
  "edit_response_id": "string",
  "duration_seconds": 0,
  "question_paradata": {}
}`;

const response = await fetch('http://localhost:8010/api/v1/interviews/550e8400-e29b-41d4-a716-446655440000/transition', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer YOUR_TOKEN',
    'Content-Type': 'application/json',
  },
  body,
});

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

### Python

```python
import requests

body = '''{
  "to_status": "string",
  "termination_reason": "string",
  "explanatory_text": "string",
  "form_data": {},
  "is_complete": true,
  "current_page": 0,
  "version_id": "string",
  "edit_response_id": "string",
  "duration_seconds": 0,
  "question_paradata": {}
}'''

response = requests.post(
    'http://localhost:8010/api/v1/interviews/550e8400-e29b-41d4-a716-446655440000/transition',
    data=body.encode('utf-8'),
    headers={
        'Authorization': 'Bearer YOUR_TOKEN',
        'Content-Type': 'application/json',
    },
)
print(response.text)
```


## Get termination details for an interview

`GET /api/v1/interviews/{interview_id}/termination`

Authentication (security requirement alternatives):

```json
[
  {
    "HTTPBearer": []
  }
]
```

- HTTPBearer: http (bearer)

Parameters:

- `interview_id` (path, string, uuid, required)
  Type: string, uuid

Responses:

- 200: Successful Response

Content type: application/json

Type: object

Schema: [FormService_TerminationDto](/api-reference/schemas/formservice-terminationdto-827fa97c4f.md)

- `id` (required)
  Type: string, uuid

- `interview_id` (required)
  Type: string, uuid

- `tenant_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string, uuid
  
    Type: null

- `termination_reason` (required)
  Type: string

- `explanatory_text` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `retain_partial_data` (required)
  Type: boolean

- `discard_data` (required)
  Type: boolean

- `notify_supervisor` (required)
  Type: boolean

- `supervisor_notified` (required)
  Type: boolean

- `supervisor_notified_at` (optional)
  Type: unknown
  
  anyOf:
    Type: string, date-time
  
    Type: null

- `data_action_taken` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `terminated_by` (required)
  Type: string, uuid

- `created_at` (required)
  Type: string, date-time

- 422: Validation Error

Content type: application/json

Type: object

Schema: [FormService_HTTPValidationError](/api-reference/schemas/formservice-httpvalidationerror-8e8725ba52.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [FormService_ValidationError](/api-reference/schemas/formservice-validationerror-e235b81cf9.md); Type: object

## Examples

### cURL

```bash
curl -X GET 'http://localhost:8010/api/v1/interviews/550e8400-e29b-41d4-a716-446655440000/termination' \
  -H 'Authorization: Bearer YOUR_TOKEN'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8010/api/v1/interviews/550e8400-e29b-41d4-a716-446655440000/termination', {
  method: 'GET',
  headers: {
    'Authorization': 'Bearer YOUR_TOKEN',
  },
});

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

### Python

```python
import requests

response = requests.get(
    'http://localhost:8010/api/v1/interviews/550e8400-e29b-41d4-a716-446655440000/termination',
    headers={
        'Authorization': 'Bearer YOUR_TOKEN',
    },
)
print(response.text)
```


## List all termination reason options with policies

`GET /api/v1/interviews/termination-policies`

Authentication (security requirement alternatives):

```json
[
  {
    "HTTPBearer": []
  }
]
```

- HTTPBearer: http (bearer)

Responses:

- 200: Successful Response

Content type: application/json

Type: array

Items:
  Reference: [FormService_TerminationReasonOptionDto](/api-reference/schemas/formservice-terminationreasonoptiondto-880f57b551.md); Type: object

## Examples

### cURL

```bash
curl -X GET 'http://localhost:8010/api/v1/interviews/termination-policies' \
  -H 'Authorization: Bearer YOUR_TOKEN'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8010/api/v1/interviews/termination-policies', {
  method: 'GET',
  headers: {
    'Authorization': 'Bearer YOUR_TOKEN',
  },
});

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

### Python

```python
import requests

response = requests.get(
    'http://localhost:8010/api/v1/interviews/termination-policies',
    headers={
        'Authorization': 'Bearer YOUR_TOKEN',
    },
)
print(response.text)
```


## Retry pending partial submission for terminated interview

`POST /api/v1/interviews/{interview_id}/retry-submission`

Retry a pending partial submission for a terminated interview.

This is used when the initial submission failed and the user wants to manually retry,
or when the sync engine automatically retries during crash recovery.

Authentication (security requirement alternatives):

```json
[
  {
    "HTTPBearer": []
  }
]
```

- HTTPBearer: http (bearer)

Parameters:

- `interview_id` (path, string, uuid, required)
  Type: string, uuid

Responses:

- 200: Successful Response

Content type: application/json

Type: object

Schema: [FormService_TerminationDto](/api-reference/schemas/formservice-terminationdto-827fa97c4f.md)

- `id` (required)
  Type: string, uuid

- `interview_id` (required)
  Type: string, uuid

- `tenant_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string, uuid
  
    Type: null

- `termination_reason` (required)
  Type: string

- `explanatory_text` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `retain_partial_data` (required)
  Type: boolean

- `discard_data` (required)
  Type: boolean

- `notify_supervisor` (required)
  Type: boolean

- `supervisor_notified` (required)
  Type: boolean

- `supervisor_notified_at` (optional)
  Type: unknown
  
  anyOf:
    Type: string, date-time
  
    Type: null

- `data_action_taken` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `terminated_by` (required)
  Type: string, uuid

- `created_at` (required)
  Type: string, date-time

- 422: Validation Error

Content type: application/json

Type: object

Schema: [FormService_HTTPValidationError](/api-reference/schemas/formservice-httpvalidationerror-8e8725ba52.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [FormService_ValidationError](/api-reference/schemas/formservice-validationerror-e235b81cf9.md); Type: object

## Examples

### cURL

```bash
curl -X POST 'http://localhost:8010/api/v1/interviews/550e8400-e29b-41d4-a716-446655440000/retry-submission' \
  -H 'Authorization: Bearer YOUR_TOKEN'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8010/api/v1/interviews/550e8400-e29b-41d4-a716-446655440000/retry-submission', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer YOUR_TOKEN',
  },
});

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

### Python

```python
import requests

response = requests.post(
    'http://localhost:8010/api/v1/interviews/550e8400-e29b-41d4-a716-446655440000/retry-submission',
    headers={
        'Authorization': 'Bearer YOUR_TOKEN',
    },
)
print(response.text)
```


## Heartbeat ping for active interview

`POST /api/v1/interviews/{interview_id}/heartbeat`

Authentication (security requirement alternatives):

```json
[
  {
    "HTTPBearer": []
  }
]
```

- HTTPBearer: http (bearer)

Parameters:

- `interview_id` (path, string, uuid, required)
  Type: string, uuid

Responses:

- 200: Successful Response

Content type: application/json

Type: unknown

- 422: Validation Error

Content type: application/json

Type: object

Schema: [FormService_HTTPValidationError](/api-reference/schemas/formservice-httpvalidationerror-8e8725ba52.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [FormService_ValidationError](/api-reference/schemas/formservice-validationerror-e235b81cf9.md); Type: object

## Examples

### cURL

```bash
curl -X POST 'http://localhost:8010/api/v1/interviews/550e8400-e29b-41d4-a716-446655440000/heartbeat' \
  -H 'Authorization: Bearer YOUR_TOKEN'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8010/api/v1/interviews/550e8400-e29b-41d4-a716-446655440000/heartbeat', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer YOUR_TOKEN',
  },
});

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

### Python

```python
import requests

response = requests.post(
    'http://localhost:8010/api/v1/interviews/550e8400-e29b-41d4-a716-446655440000/heartbeat',
    headers={
        'Authorization': 'Bearer YOUR_TOKEN',
    },
)
print(response.text)
```


## List interview events

`GET /api/v1/interviews/{interview_id}/events`

Authentication (security requirement alternatives):

```json
[
  {
    "HTTPBearer": []
  }
]
```

- HTTPBearer: http (bearer)

Parameters:

- `interview_id` (path, string, uuid, required)
  Type: string, uuid

- `skip` (query, integer, optional)
  Type: integer
  
  default: 0
  
  minimum: 0

- `limit` (query, integer, optional)
  Type: integer
  
  default: 50
  
  minimum: 1
  
  maximum: 200

Responses:

- 200: Successful Response

Content type: application/json

Type: array

Items:
  Reference: [FormService_InterviewEventDto](/api-reference/schemas/formservice-intervieweventdto-9b738f45ed.md); Type: object

- 422: Validation Error

Content type: application/json

Type: object

Schema: [FormService_HTTPValidationError](/api-reference/schemas/formservice-httpvalidationerror-8e8725ba52.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [FormService_ValidationError](/api-reference/schemas/formservice-validationerror-e235b81cf9.md); Type: object

## Examples

### cURL

```bash
curl -X GET 'http://localhost:8010/api/v1/interviews/550e8400-e29b-41d4-a716-446655440000/events?skip=0&limit=50' \
  -H 'Authorization: Bearer YOUR_TOKEN'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8010/api/v1/interviews/550e8400-e29b-41d4-a716-446655440000/events?skip=0&limit=50', {
  method: 'GET',
  headers: {
    'Authorization': 'Bearer YOUR_TOKEN',
  },
});

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

### Python

```python
import requests

response = requests.get(
    'http://localhost:8010/api/v1/interviews/550e8400-e29b-41d4-a716-446655440000/events?skip=0&limit=50',
    headers={
        'Authorization': 'Bearer YOUR_TOKEN',
    },
)
print(response.text)
```


## List notes for an interview

`GET /api/v1/interviews/{interview_id}/notes`

Authentication (security requirement alternatives):

```json
[
  {
    "HTTPBearer": []
  }
]
```

- HTTPBearer: http (bearer)

Parameters:

- `interview_id` (path, string, uuid, required)
  Type: string, uuid

- `field_name` (query, unknown, optional) - Filter by field/question name
  Type: unknown
  
  Filter by field/question name
  
  anyOf:
    Type: string
  
    Type: null

- `category` (query, unknown, optional) - Filter by note category
  Type: unknown
  
  Filter by note category
  
  anyOf:
    Type: string
  
    Type: null

Responses:

- 200: Successful Response

Content type: application/json

Type: object

Schema: [FormService_NoteListResponse](/api-reference/schemas/formservice-notelistresponse-ff5f1d209b.md)

- `items` (required)
  Type: array
  
  Items:
    Reference: [FormService_NoteResponseDto](/api-reference/schemas/formservice-noteresponsedto-705fa67267.md); Type: object

- `total` (required)
  Type: integer

- 422: Validation Error

Content type: application/json

Type: object

Schema: [FormService_HTTPValidationError](/api-reference/schemas/formservice-httpvalidationerror-8e8725ba52.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [FormService_ValidationError](/api-reference/schemas/formservice-validationerror-e235b81cf9.md); Type: object

## Examples

### cURL

```bash
curl -X GET 'http://localhost:8010/api/v1/interviews/550e8400-e29b-41d4-a716-446655440000/notes' \
  -H 'Authorization: Bearer YOUR_TOKEN'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8010/api/v1/interviews/550e8400-e29b-41d4-a716-446655440000/notes', {
  method: 'GET',
  headers: {
    'Authorization': 'Bearer YOUR_TOKEN',
  },
});

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

### Python

```python
import requests

response = requests.get(
    'http://localhost:8010/api/v1/interviews/550e8400-e29b-41d4-a716-446655440000/notes',
    headers={
        'Authorization': 'Bearer YOUR_TOKEN',
    },
)
print(response.text)
```


## Create a note for an interview

`POST /api/v1/interviews/{interview_id}/notes`

Authentication (security requirement alternatives):

```json
[
  {
    "HTTPBearer": []
  }
]
```

- HTTPBearer: http (bearer)

Parameters:

- `interview_id` (path, string, uuid, required)
  Type: string, uuid

Request body: application/json (required)

Type: object

Schema: [FormService_NoteCreateDto](/api-reference/schemas/formservice-notecreatedto-1d46b029fa.md)

- `field_name` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `text` (required)
  Type: string
  
  minLength: 1

- `category` (optional)
  Type: string
  
  default: "general"

- `client_created_at` (optional)
  Type: unknown
  
  anyOf:
    Type: string, date-time
  
    Type: null

Responses:

- 201: Successful Response

Content type: application/json

Type: object

Schema: [FormService_NoteResponseDto](/api-reference/schemas/formservice-noteresponsedto-705fa67267.md)

- `id` (required)
  Type: string, uuid

- `interview_id` (required)
  Type: string, uuid

- `tenant_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string, uuid
  
    Type: null

- `field_name` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `text` (required)
  Type: string

- `category` (required)
  Type: string

- `author_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string, uuid
  
    Type: null

- `pinned` (optional)
  Type: boolean
  
  default: false

- `created_at` (required)
  Type: string, date-time

- `updated_at` (required)
  Type: string, date-time

- `client_created_at` (optional)
  Type: unknown
  
  anyOf:
    Type: string, date-time
  
    Type: null

- 422: Validation Error

Content type: application/json

Type: object

Schema: [FormService_HTTPValidationError](/api-reference/schemas/formservice-httpvalidationerror-8e8725ba52.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [FormService_ValidationError](/api-reference/schemas/formservice-validationerror-e235b81cf9.md); Type: object

## Examples

### cURL

```bash
curl -X POST 'http://localhost:8010/api/v1/interviews/550e8400-e29b-41d4-a716-446655440000/notes' \
  -H 'Authorization: Bearer YOUR_TOKEN' \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "field_name": "string",
  "text": "string",
  "category": "general",
  "client_created_at": "2024-01-15T09:30:00Z"
}'
```

### JavaScript

```javascript
const body = `{
  "field_name": "string",
  "text": "string",
  "category": "general",
  "client_created_at": "2024-01-15T09:30:00Z"
}`;

const response = await fetch('http://localhost:8010/api/v1/interviews/550e8400-e29b-41d4-a716-446655440000/notes', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer YOUR_TOKEN',
    'Content-Type': 'application/json',
  },
  body,
});

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

### Python

```python
import requests

body = '''{
  "field_name": "string",
  "text": "string",
  "category": "general",
  "client_created_at": "2024-01-15T09:30:00Z"
}'''

response = requests.post(
    'http://localhost:8010/api/v1/interviews/550e8400-e29b-41d4-a716-446655440000/notes',
    data=body.encode('utf-8'),
    headers={
        'Authorization': 'Bearer YOUR_TOKEN',
        'Content-Type': 'application/json',
    },
)
print(response.text)
```


## Get a specific note

`GET /api/v1/interviews/{interview_id}/notes/{note_id}`

Authentication (security requirement alternatives):

```json
[
  {
    "HTTPBearer": []
  }
]
```

- HTTPBearer: http (bearer)

Parameters:

- `interview_id` (path, string, uuid, required)
  Type: string, uuid

- `note_id` (path, string, uuid, required)
  Type: string, uuid

Responses:

- 200: Successful Response

Content type: application/json

Type: object

Schema: [FormService_NoteResponseDto](/api-reference/schemas/formservice-noteresponsedto-705fa67267.md)

- `id` (required)
  Type: string, uuid

- `interview_id` (required)
  Type: string, uuid

- `tenant_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string, uuid
  
    Type: null

- `field_name` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `text` (required)
  Type: string

- `category` (required)
  Type: string

- `author_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string, uuid
  
    Type: null

- `pinned` (optional)
  Type: boolean
  
  default: false

- `created_at` (required)
  Type: string, date-time

- `updated_at` (required)
  Type: string, date-time

- `client_created_at` (optional)
  Type: unknown
  
  anyOf:
    Type: string, date-time
  
    Type: null

- 422: Validation Error

Content type: application/json

Type: object

Schema: [FormService_HTTPValidationError](/api-reference/schemas/formservice-httpvalidationerror-8e8725ba52.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [FormService_ValidationError](/api-reference/schemas/formservice-validationerror-e235b81cf9.md); Type: object

## Examples

### cURL

```bash
curl -X GET 'http://localhost:8010/api/v1/interviews/550e8400-e29b-41d4-a716-446655440000/notes/550e8400-e29b-41d4-a716-446655440000' \
  -H 'Authorization: Bearer YOUR_TOKEN'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8010/api/v1/interviews/550e8400-e29b-41d4-a716-446655440000/notes/550e8400-e29b-41d4-a716-446655440000', {
  method: 'GET',
  headers: {
    'Authorization': 'Bearer YOUR_TOKEN',
  },
});

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

### Python

```python
import requests

response = requests.get(
    'http://localhost:8010/api/v1/interviews/550e8400-e29b-41d4-a716-446655440000/notes/550e8400-e29b-41d4-a716-446655440000',
    headers={
        'Authorization': 'Bearer YOUR_TOKEN',
    },
)
print(response.text)
```


## Update a note

`PUT /api/v1/interviews/{interview_id}/notes/{note_id}`

Authentication (security requirement alternatives):

```json
[
  {
    "HTTPBearer": []
  }
]
```

- HTTPBearer: http (bearer)

Parameters:

- `interview_id` (path, string, uuid, required)
  Type: string, uuid

- `note_id` (path, string, uuid, required)
  Type: string, uuid

Request body: application/json (required)

Type: object

Schema: [FormService_NoteUpdateDto](/api-reference/schemas/formservice-noteupdatedto-caba699aea.md)

- `text` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `category` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `pinned` (optional)
  Type: unknown
  
  anyOf:
    Type: boolean
  
    Type: null

- `field_name` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

Responses:

- 200: Successful Response

Content type: application/json

Type: object

Schema: [FormService_NoteResponseDto](/api-reference/schemas/formservice-noteresponsedto-705fa67267.md)

- `id` (required)
  Type: string, uuid

- `interview_id` (required)
  Type: string, uuid

- `tenant_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string, uuid
  
    Type: null

- `field_name` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `text` (required)
  Type: string

- `category` (required)
  Type: string

- `author_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string, uuid
  
    Type: null

- `pinned` (optional)
  Type: boolean
  
  default: false

- `created_at` (required)
  Type: string, date-time

- `updated_at` (required)
  Type: string, date-time

- `client_created_at` (optional)
  Type: unknown
  
  anyOf:
    Type: string, date-time
  
    Type: null

- 422: Validation Error

Content type: application/json

Type: object

Schema: [FormService_HTTPValidationError](/api-reference/schemas/formservice-httpvalidationerror-8e8725ba52.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [FormService_ValidationError](/api-reference/schemas/formservice-validationerror-e235b81cf9.md); Type: object

## Examples

### cURL

```bash
curl -X PUT 'http://localhost:8010/api/v1/interviews/550e8400-e29b-41d4-a716-446655440000/notes/550e8400-e29b-41d4-a716-446655440000' \
  -H 'Authorization: Bearer YOUR_TOKEN' \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "text": "string",
  "category": "string",
  "pinned": true,
  "field_name": "string"
}'
```

### JavaScript

```javascript
const body = `{
  "text": "string",
  "category": "string",
  "pinned": true,
  "field_name": "string"
}`;

const response = await fetch('http://localhost:8010/api/v1/interviews/550e8400-e29b-41d4-a716-446655440000/notes/550e8400-e29b-41d4-a716-446655440000', {
  method: 'PUT',
  headers: {
    'Authorization': 'Bearer YOUR_TOKEN',
    'Content-Type': 'application/json',
  },
  body,
});

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

### Python

```python
import requests

body = '''{
  "text": "string",
  "category": "string",
  "pinned": true,
  "field_name": "string"
}'''

response = requests.put(
    'http://localhost:8010/api/v1/interviews/550e8400-e29b-41d4-a716-446655440000/notes/550e8400-e29b-41d4-a716-446655440000',
    data=body.encode('utf-8'),
    headers={
        'Authorization': 'Bearer YOUR_TOKEN',
        'Content-Type': 'application/json',
    },
)
print(response.text)
```


## Delete a note

`DELETE /api/v1/interviews/{interview_id}/notes/{note_id}`

Authentication (security requirement alternatives):

```json
[
  {
    "HTTPBearer": []
  }
]
```

- HTTPBearer: http (bearer)

Parameters:

- `interview_id` (path, string, uuid, required)
  Type: string, uuid

- `note_id` (path, string, uuid, required)
  Type: string, uuid

Responses:

- 204: Successful Response

- 422: Validation Error

Content type: application/json

Type: object

Schema: [FormService_HTTPValidationError](/api-reference/schemas/formservice-httpvalidationerror-8e8725ba52.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [FormService_ValidationError](/api-reference/schemas/formservice-validationerror-e235b81cf9.md); Type: object

## Examples

### cURL

```bash
curl -X DELETE 'http://localhost:8010/api/v1/interviews/550e8400-e29b-41d4-a716-446655440000/notes/550e8400-e29b-41d4-a716-446655440000' \
  -H 'Authorization: Bearer YOUR_TOKEN'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8010/api/v1/interviews/550e8400-e29b-41d4-a716-446655440000/notes/550e8400-e29b-41d4-a716-446655440000', {
  method: 'DELETE',
  headers: {
    'Authorization': 'Bearer YOUR_TOKEN',
  },
});

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

### Python

```python
import requests

response = requests.delete(
    'http://localhost:8010/api/v1/interviews/550e8400-e29b-41d4-a716-446655440000/notes/550e8400-e29b-41d4-a716-446655440000',
    headers={
        'Authorization': 'Bearer YOUR_TOKEN',
    },
)
print(response.text)
```


## Batch create notes

`POST /api/v1/interviews/{interview_id}/notes/batch`

Authentication (security requirement alternatives):

```json
[
  {
    "HTTPBearer": []
  }
]
```

- HTTPBearer: http (bearer)

Parameters:

- `interview_id` (path, string, uuid, required)
  Type: string, uuid

Request body: application/json (required)

Type: object

Schema: [FormService_BatchNoteCreateDto](/api-reference/schemas/formservice-batchnotecreatedto-4f9402d4a9.md)

- `notes` (required)
  Type: array
  
  Items:
    Reference: [FormService_NoteCreateDto](/api-reference/schemas/formservice-notecreatedto-1d46b029fa.md); Type: object

Responses:

- 201: Successful Response

Content type: application/json

Type: array

Items:
  Reference: [FormService_NoteResponseDto](/api-reference/schemas/formservice-noteresponsedto-705fa67267.md); Type: object

- 422: Validation Error

Content type: application/json

Type: object

Schema: [FormService_HTTPValidationError](/api-reference/schemas/formservice-httpvalidationerror-8e8725ba52.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [FormService_ValidationError](/api-reference/schemas/formservice-validationerror-e235b81cf9.md); Type: object

## Examples

### cURL

```bash
curl -X POST 'http://localhost:8010/api/v1/interviews/550e8400-e29b-41d4-a716-446655440000/notes/batch' \
  -H 'Authorization: Bearer YOUR_TOKEN' \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "notes": [
    {
      "field_name": "string",
      "text": "string",
      "category": "general",
      "client_created_at": "2024-01-15T09:30:00Z"
    }
  ]
}'
```

### JavaScript

```javascript
const body = `{
  "notes": [
    {
      "field_name": "string",
      "text": "string",
      "category": "general",
      "client_created_at": "2024-01-15T09:30:00Z"
    }
  ]
}`;

const response = await fetch('http://localhost:8010/api/v1/interviews/550e8400-e29b-41d4-a716-446655440000/notes/batch', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer YOUR_TOKEN',
    'Content-Type': 'application/json',
  },
  body,
});

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

### Python

```python
import requests

body = '''{
  "notes": [
    {
      "field_name": "string",
      "text": "string",
      "category": "general",
      "client_created_at": "2024-01-15T09:30:00Z"
    }
  ]
}'''

response = requests.post(
    'http://localhost:8010/api/v1/interviews/550e8400-e29b-41d4-a716-446655440000/notes/batch',
    data=body.encode('utf-8'),
    headers={
        'Authorization': 'Bearer YOUR_TOKEN',
        'Content-Type': 'application/json',
    },
)
print(response.text)
```


## Get Migration Version

`GET /api/v1/migrations/version`

Get current Alembic migration version for specific tenant.

Authentication: no security requirement declared for this operation.

Responses:

- 200: Successful Response

Content type: application/json

Type: unknown

## Examples

### cURL

```bash
curl -X GET 'http://localhost:8010/api/v1/migrations/version'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8010/api/v1/migrations/version', {
  method: 'GET',
});

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

### Python

```python
import requests

response = requests.get('http://localhost:8010/api/v1/migrations/version')
print(response.text)
```


## Run Cleanup

`POST /api/v1/cleanup/run`

Run cleanup job to remove expired sessions and drafts.

Args:
    dry_run: If True, don't actually delete anything
    tenant_id: Optional specific tenant to cleanup (admin only)

Authentication: no security requirement declared for this operation.

Parameters:

- `dry_run` (query, boolean, optional)
  Type: boolean
  
  default: false

- `tenant_id` (query, unknown, optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

Responses:

- 200: Successful Response

Content type: application/json

Type: unknown

- 422: Validation Error

Content type: application/json

Type: object

Schema: [FormService_HTTPValidationError](/api-reference/schemas/formservice-httpvalidationerror-8e8725ba52.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [FormService_ValidationError](/api-reference/schemas/formservice-validationerror-e235b81cf9.md); Type: object

## Examples

### cURL

```bash
curl -X POST 'http://localhost:8010/api/v1/cleanup/run?dry_run=false'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8010/api/v1/cleanup/run?dry_run=false', {
  method: 'POST',
});

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

### Python

```python
import requests

response = requests.post('http://localhost:8010/api/v1/cleanup/run?dry_run=false')
print(response.text)
```


## Upload File

`POST /api/v1/media/upload`

Upload a single file.

Args:
    file: The file to upload
    survey_id: Optional survey to associate with
    response_id: Optional response to associate with
    is_public: Whether the file is publicly accessible
    description: Optional file description
    survey_name: Optional survey name for custom renaming
    question_name: Optional question name for custom renaming
    user_name: Optional name of the user uploading the file
    checksum: Optional expected SHA-256 digest

Returns:
    Asset metadata including ID, filename, size, and type

Authentication (security requirement alternatives):

```json
[
  {
    "HTTPBearer": []
  }
]
```

- HTTPBearer: http (bearer)

Request body: multipart/form-data (required)

Type: object

Schema: [MediaService_Body_upload_file_api_v1_media_upload_post](/api-reference/schemas/mediaservice-body-upload-file-api-v1-media-upload-post-e04daaccb8.md)

- `file` (required)
  Type: string

- `survey_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `response_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `entity_type` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `entity_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `is_public` (optional)
  Type: boolean
  
  default: false

- `description` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `survey_name` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `question_name` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `user_name` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `device_id` (optional)
  Type: unknown
  
  Device that recorded this media (used for post-closure grant validation)
  
  anyOf:
    Type: string
  
    Type: null

- `checksum` (optional)
  Type: unknown
  
  Expected SHA-256 checksum of file
  
  anyOf:
    Type: string
  
    Type: null

Responses:

- 201: Successful Response

Content type: application/json

Type: unknown

- 422: Validation Error

Content type: application/json

Type: object

Schema: [MediaService_HTTPValidationError](/api-reference/schemas/mediaservice-httpvalidationerror-f5812c7c1f.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [MediaService_ValidationError](/api-reference/schemas/mediaservice-validationerror-0fc30c3898.md); Type: object

## Examples

### cURL

```bash
curl -X POST 'http://localhost:8011/api/v1/media/upload' \
  -H 'Authorization: Bearer YOUR_TOKEN' \
  --form-string 'file=string' \
  --form-string 'survey_id=string' \
  --form-string 'response_id=string' \
  --form-string 'entity_type=string' \
  --form-string 'entity_id=string' \
  --form-string 'is_public=false' \
  --form-string 'description=string' \
  --form-string 'survey_name=string' \
  --form-string 'question_name=string' \
  --form-string 'user_name=string' \
  --form-string 'device_id=string' \
  --form-string 'checksum=string'
```

### JavaScript

```javascript
const form = new FormData();
form.append('file', 'string');
form.append('survey_id', 'string');
form.append('response_id', 'string');
form.append('entity_type', 'string');
form.append('entity_id', 'string');
form.append('is_public', 'false');
form.append('description', 'string');
form.append('survey_name', 'string');
form.append('question_name', 'string');
form.append('user_name', 'string');
form.append('device_id', 'string');
form.append('checksum', 'string');
const response = await fetch('http://localhost:8011/api/v1/media/upload', {
  method: 'POST',
  headers: {"Authorization":"Bearer YOUR_TOKEN"},
  body: form,
});
console.log(await response.text());
```

### Python

```python
import requests
from contextlib import ExitStack

with ExitStack() as stack:
    files = [
        ('file', (None, 'string')),
        ('survey_id', (None, 'string')),
        ('response_id', (None, 'string')),
        ('entity_type', (None, 'string')),
        ('entity_id', (None, 'string')),
        ('is_public', (None, 'false')),
        ('description', (None, 'string')),
        ('survey_name', (None, 'string')),
        ('question_name', (None, 'string')),
        ('user_name', (None, 'string')),
        ('device_id', (None, 'string')),
        ('checksum', (None, 'string')),
    ]
    response = requests.request('POST', 'http://localhost:8011/api/v1/media/upload', headers={"Authorization":"Bearer YOUR_TOKEN"}, files=files)
    print(response.text)
```


## Upload Batch

`POST /api/v1/media/upload/batch`

Upload multiple files at once.

Args:
    files: List of files to upload
    survey_id: Optional survey to associate with
    response_id: Optional response to associate with
    user_name: Optional name of the user uploading the files

Returns:
    Summary of uploaded files and any errors

Authentication (security requirement alternatives):

```json
[
  {
    "HTTPBearer": []
  }
]
```

- HTTPBearer: http (bearer)

Request body: multipart/form-data (required)

Type: object

Schema: [MediaService_Body_upload_batch_api_v1_media_upload_batch_post](/api-reference/schemas/mediaservice-body-upload-batch-api-v1-media-upload-batch-post-5ea4e742e9.md)

- `files` (required)
  Type: array
  
  Items:
    Type: string

- `survey_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `response_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `entity_type` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `entity_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `user_name` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `device_id` (optional)
  Type: unknown
  
  Device that recorded this media (used for post-closure grant validation)
  
  anyOf:
    Type: string
  
    Type: null

Responses:

- 201: Successful Response

Content type: application/json

Type: unknown

- 422: Validation Error

Content type: application/json

Type: object

Schema: [MediaService_HTTPValidationError](/api-reference/schemas/mediaservice-httpvalidationerror-f5812c7c1f.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [MediaService_ValidationError](/api-reference/schemas/mediaservice-validationerror-0fc30c3898.md); Type: object

## Examples

### cURL

```bash
curl -X POST 'http://localhost:8011/api/v1/media/upload/batch' \
  -H 'Authorization: Bearer YOUR_TOKEN' \
  --form-string 'files=string' \
  --form-string 'survey_id=string' \
  --form-string 'response_id=string' \
  --form-string 'entity_type=string' \
  --form-string 'entity_id=string' \
  --form-string 'user_name=string' \
  --form-string 'device_id=string'
```

### JavaScript

```javascript
const form = new FormData();
form.append('files', 'string');
form.append('survey_id', 'string');
form.append('response_id', 'string');
form.append('entity_type', 'string');
form.append('entity_id', 'string');
form.append('user_name', 'string');
form.append('device_id', 'string');
const response = await fetch('http://localhost:8011/api/v1/media/upload/batch', {
  method: 'POST',
  headers: {"Authorization":"Bearer YOUR_TOKEN"},
  body: form,
});
console.log(await response.text());
```

### Python

```python
import requests
from contextlib import ExitStack

with ExitStack() as stack:
    files = [
        ('files', (None, 'string')),
        ('survey_id', (None, 'string')),
        ('response_id', (None, 'string')),
        ('entity_type', (None, 'string')),
        ('entity_id', (None, 'string')),
        ('user_name', (None, 'string')),
        ('device_id', (None, 'string')),
    ]
    response = requests.request('POST', 'http://localhost:8011/api/v1/media/upload/batch', headers={"Authorization":"Bearer YOUR_TOKEN"}, files=files)
    print(response.text)
```


## Upload Chunk

`POST /api/v1/media/upload/chunk`

Upload a single chunk of a large media file.

Mobile uploads files in 512KB chunks, posting each to this endpoint with
the same ``upload_id``. Chunks are staged on disk; when the final chunk
(``chunk_index == total_chunks - 1``) arrives the full file is reassembled
and stored via the standard media pipeline (compression, checksum, DB
record).

- ``survey_id`` is REQUIRED for production-bound uploads (project lifecycle
  gate; §5 row 11).
- ``response_id`` is client-local at upload time and is never the
  enforcement key.
- ``checksum`` (full-file SHA-256) is verified on the last chunk.

Authentication (security requirement alternatives):

```json
[
  {
    "HTTPBearer": []
  }
]
```

- HTTPBearer: http (bearer)

Request body: multipart/form-data (required)

Type: object

Schema: [MediaService_Body_upload_chunk_api_v1_media_upload_chunk_post](/api-reference/schemas/mediaservice-body-upload-chunk-api-v1-media-upload-chunk-post-3d429bec17.md)

- `file` (required)
  Type: string

- `upload_id` (required)
  Type: string
  
  Client-generated stable upload ID (media local ID)
  
  minLength: 8
  
  maxLength: 64

- `chunk_index` (required)
  Type: integer
  
  Zero-based chunk index
  
  minimum: 0

- `total_chunks` (required)
  Type: integer
  
  Total number of chunks
  
  minimum: 1
  
  maximum: 100000

- `file_name` (required)
  Type: string
  
  minLength: 1
  
  maxLength: 255

- `mime_type` (required)
  Type: string
  
  minLength: 1
  
  maxLength: 100

- `survey_id` (optional)
  Type: unknown
  
  Survey this media belongs to (REQUIRED for production-bound uploads)
  
  anyOf:
    Type: string
  
    Type: null

- `response_id` (optional)
  Type: unknown
  
  Client-local response reference (metadata only — never the enforcement key)
  
  anyOf:
    Type: string
  
    Type: null

- `checksum` (optional)
  Type: unknown
  
  Expected SHA-256 of the FULL assembled file
  
  anyOf:
    Type: string
  
    Type: null

- `device_id` (optional)
  Type: unknown
  
  Device that recorded this media (used for post-closure grant validation)
  
  anyOf:
    Type: string
  
    Type: null

Responses:

- 201: Successful Response

Content type: application/json

Type: unknown

- 422: Validation Error

Content type: application/json

Type: object

Schema: [MediaService_HTTPValidationError](/api-reference/schemas/mediaservice-httpvalidationerror-f5812c7c1f.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [MediaService_ValidationError](/api-reference/schemas/mediaservice-validationerror-0fc30c3898.md); Type: object

## Examples

### cURL

```bash
curl -X POST 'http://localhost:8011/api/v1/media/upload/chunk' \
  -H 'Authorization: Bearer YOUR_TOKEN' \
  --form-string 'file=string' \
  --form-string 'upload_id=string' \
  --form-string 'chunk_index=0' \
  --form-string 'total_chunks=1' \
  --form-string 'file_name=string' \
  --form-string 'mime_type=string' \
  --form-string 'survey_id=string' \
  --form-string 'response_id=string' \
  --form-string 'checksum=string' \
  --form-string 'device_id=string'
```

### JavaScript

```javascript
const form = new FormData();
form.append('file', 'string');
form.append('upload_id', 'string');
form.append('chunk_index', '0');
form.append('total_chunks', '1');
form.append('file_name', 'string');
form.append('mime_type', 'string');
form.append('survey_id', 'string');
form.append('response_id', 'string');
form.append('checksum', 'string');
form.append('device_id', 'string');
const response = await fetch('http://localhost:8011/api/v1/media/upload/chunk', {
  method: 'POST',
  headers: {"Authorization":"Bearer YOUR_TOKEN"},
  body: form,
});
console.log(await response.text());
```

### Python

```python
import requests
from contextlib import ExitStack

with ExitStack() as stack:
    files = [
        ('file', (None, 'string')),
        ('upload_id', (None, 'string')),
        ('chunk_index', (None, '0')),
        ('total_chunks', (None, '1')),
        ('file_name', (None, 'string')),
        ('mime_type', (None, 'string')),
        ('survey_id', (None, 'string')),
        ('response_id', (None, 'string')),
        ('checksum', (None, 'string')),
        ('device_id', (None, 'string')),
    ]
    response = requests.request('POST', 'http://localhost:8011/api/v1/media/upload/chunk', headers={"Authorization":"Bearer YOUR_TOKEN"}, files=files)
    print(response.text)
```


## Download File

`GET /api/v1/media/download/{asset_id}`

Download a file by asset ID.

Authentication (security requirement alternatives):

```json
[
  {
    "HTTPBearer": []
  }
]
```

- HTTPBearer: http (bearer)

Parameters:

- `asset_id` (path, string, required)
  Type: string

- `token` (query, unknown, optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

Responses:

- 200: Successful Response

Content type: application/json

Type: unknown

- 422: Validation Error

Content type: application/json

Type: object

Schema: [MediaService_HTTPValidationError](/api-reference/schemas/mediaservice-httpvalidationerror-f5812c7c1f.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [MediaService_ValidationError](/api-reference/schemas/mediaservice-validationerror-0fc30c3898.md); Type: object

## Examples

### cURL

```bash
curl -X GET 'http://localhost:8011/api/v1/media/download/string' \
  -H 'Authorization: Bearer YOUR_TOKEN'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8011/api/v1/media/download/string', {
  method: 'GET',
  headers: {
    'Authorization': 'Bearer YOUR_TOKEN',
  },
});

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

### Python

```python
import requests

response = requests.get(
    'http://localhost:8011/api/v1/media/download/string',
    headers={
        'Authorization': 'Bearer YOUR_TOKEN',
    },
)
print(response.text)
```


## Stream File

`GET /api/v1/media/stream/{asset_id}`

Stream a file inline (for images, audio, video).

Authentication (security requirement alternatives):

```json
[
  {
    "HTTPBearer": []
  }
]
```

- HTTPBearer: http (bearer)

Parameters:

- `asset_id` (path, string, required)
  Type: string

- `token` (query, unknown, optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

Responses:

- 200: Successful Response

Content type: application/json

Type: unknown

- 422: Validation Error

Content type: application/json

Type: object

Schema: [MediaService_HTTPValidationError](/api-reference/schemas/mediaservice-httpvalidationerror-f5812c7c1f.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [MediaService_ValidationError](/api-reference/schemas/mediaservice-validationerror-0fc30c3898.md); Type: object

## Examples

### cURL

```bash
curl -X GET 'http://localhost:8011/api/v1/media/stream/string' \
  -H 'Authorization: Bearer YOUR_TOKEN'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8011/api/v1/media/stream/string', {
  method: 'GET',
  headers: {
    'Authorization': 'Bearer YOUR_TOKEN',
  },
});

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

### Python

```python
import requests

response = requests.get(
    'http://localhost:8011/api/v1/media/stream/string',
    headers={
        'Authorization': 'Bearer YOUR_TOKEN',
    },
)
print(response.text)
```


## Stream Thumbnail

`GET /api/v1/media/stream/{asset_id}/thumbnail`

Stream an asset's thumbnail.

Authentication (security requirement alternatives):

```json
[
  {
    "HTTPBearer": []
  }
]
```

- HTTPBearer: http (bearer)

Parameters:

- `asset_id` (path, string, required)
  Type: string

- `token` (query, unknown, optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

Responses:

- 200: Successful Response

Content type: application/json

Type: unknown

- 422: Validation Error

Content type: application/json

Type: object

Schema: [MediaService_HTTPValidationError](/api-reference/schemas/mediaservice-httpvalidationerror-f5812c7c1f.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [MediaService_ValidationError](/api-reference/schemas/mediaservice-validationerror-0fc30c3898.md); Type: object

## Examples

### cURL

```bash
curl -X GET 'http://localhost:8011/api/v1/media/stream/string/thumbnail' \
  -H 'Authorization: Bearer YOUR_TOKEN'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8011/api/v1/media/stream/string/thumbnail', {
  method: 'GET',
  headers: {
    'Authorization': 'Bearer YOUR_TOKEN',
  },
});

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

### Python

```python
import requests

response = requests.get(
    'http://localhost:8011/api/v1/media/stream/string/thumbnail',
    headers={
        'Authorization': 'Bearer YOUR_TOKEN',
    },
)
print(response.text)
```


## Get File By Name

`GET /api/v1/media/file/{filename}`

Get a library file by its original filename.
Used by form filler to display media files.

Authentication (security requirement alternatives):

```json
[
  {
    "HTTPBearer": []
  }
]
```

- HTTPBearer: http (bearer)

Parameters:

- `filename` (path, string, required)
  Type: string

- `token` (query, unknown, optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

Responses:

- 200: Successful Response

Content type: application/json

Type: unknown

- 422: Validation Error

Content type: application/json

Type: object

Schema: [MediaService_HTTPValidationError](/api-reference/schemas/mediaservice-httpvalidationerror-f5812c7c1f.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [MediaService_ValidationError](/api-reference/schemas/mediaservice-validationerror-0fc30c3898.md); Type: object

## Examples

### cURL

```bash
curl -X GET 'http://localhost:8011/api/v1/media/file/string' \
  -H 'Authorization: Bearer YOUR_TOKEN'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8011/api/v1/media/file/string', {
  method: 'GET',
  headers: {
    'Authorization': 'Bearer YOUR_TOKEN',
  },
});

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

### Python

```python
import requests

response = requests.get(
    'http://localhost:8011/api/v1/media/file/string',
    headers={
        'Authorization': 'Bearer YOUR_TOKEN',
    },
)
print(response.text)
```


## List Assets

`GET /api/v1/media/assets`

List media assets with optional filters.

Authentication (security requirement alternatives):

```json
[
  {
    "HTTPBearer": []
  }
]
```

- HTTPBearer: http (bearer)

Parameters:

- `survey_id` (query, unknown, optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `response_id` (query, unknown, optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `entity_type` (query, unknown, optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `entity_id` (query, unknown, optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `asset_type` (query, unknown, optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `skip` (query, integer, optional)
  Type: integer
  
  default: 0

- `limit` (query, integer, optional)
  Type: integer
  
  default: 20

Responses:

- 200: Successful Response

Content type: application/json

Type: unknown

- 422: Validation Error

Content type: application/json

Type: object

Schema: [MediaService_HTTPValidationError](/api-reference/schemas/mediaservice-httpvalidationerror-f5812c7c1f.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [MediaService_ValidationError](/api-reference/schemas/mediaservice-validationerror-0fc30c3898.md); Type: object

## Examples

### cURL

```bash
curl -X GET 'http://localhost:8011/api/v1/media/assets?skip=0&limit=20' \
  -H 'Authorization: Bearer YOUR_TOKEN'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8011/api/v1/media/assets?skip=0&limit=20', {
  method: 'GET',
  headers: {
    'Authorization': 'Bearer YOUR_TOKEN',
  },
});

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

### Python

```python
import requests

response = requests.get(
    'http://localhost:8011/api/v1/media/assets?skip=0&limit=20',
    headers={
        'Authorization': 'Bearer YOUR_TOKEN',
    },
)
print(response.text)
```


## Get Asset

`GET /api/v1/media/assets/{asset_id}`

Get asset metadata.

Authentication (security requirement alternatives):

```json
[
  {
    "HTTPBearer": []
  }
]
```

- HTTPBearer: http (bearer)

Parameters:

- `asset_id` (path, string, required)
  Type: string

Responses:

- 200: Successful Response

Content type: application/json

Type: unknown

- 422: Validation Error

Content type: application/json

Type: object

Schema: [MediaService_HTTPValidationError](/api-reference/schemas/mediaservice-httpvalidationerror-f5812c7c1f.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [MediaService_ValidationError](/api-reference/schemas/mediaservice-validationerror-0fc30c3898.md); Type: object

## Examples

### cURL

```bash
curl -X GET 'http://localhost:8011/api/v1/media/assets/string' \
  -H 'Authorization: Bearer YOUR_TOKEN'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8011/api/v1/media/assets/string', {
  method: 'GET',
  headers: {
    'Authorization': 'Bearer YOUR_TOKEN',
  },
});

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

### Python

```python
import requests

response = requests.get(
    'http://localhost:8011/api/v1/media/assets/string',
    headers={
        'Authorization': 'Bearer YOUR_TOKEN',
    },
)
print(response.text)
```


## Update Asset

`PUT /api/v1/media/assets/{asset_id}`

Update asset metadata.

Authentication (security requirement alternatives):

```json
[
  {
    "HTTPBearer": []
  }
]
```

- HTTPBearer: http (bearer)

Parameters:

- `asset_id` (path, string, required)
  Type: string

Request body: application/json (required)

Type: object

Schema: [MediaService_AssetUpdateRequest](/api-reference/schemas/mediaservice-assetupdaterequest-5a8ce499c3.md)

- `original_filename` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `description` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `alt_text` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `tags` (optional)
  Type: unknown
  
  anyOf:
    Type: array
    
    Items:
      Type: string
  
    Type: null

- `is_public` (optional)
  Type: unknown
  
  anyOf:
    Type: boolean
  
    Type: null

Responses:

- 200: Successful Response

Content type: application/json

Type: unknown

- 422: Validation Error

Content type: application/json

Type: object

Schema: [MediaService_HTTPValidationError](/api-reference/schemas/mediaservice-httpvalidationerror-f5812c7c1f.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [MediaService_ValidationError](/api-reference/schemas/mediaservice-validationerror-0fc30c3898.md); Type: object

## Examples

### cURL

```bash
curl -X PUT 'http://localhost:8011/api/v1/media/assets/string' \
  -H 'Authorization: Bearer YOUR_TOKEN' \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "original_filename": "string",
  "description": "string",
  "alt_text": "string",
  "tags": [
    "string"
  ],
  "is_public": true
}'
```

### JavaScript

```javascript
const body = `{
  "original_filename": "string",
  "description": "string",
  "alt_text": "string",
  "tags": [
    "string"
  ],
  "is_public": true
}`;

const response = await fetch('http://localhost:8011/api/v1/media/assets/string', {
  method: 'PUT',
  headers: {
    'Authorization': 'Bearer YOUR_TOKEN',
    'Content-Type': 'application/json',
  },
  body,
});

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

### Python

```python
import requests

body = '''{
  "original_filename": "string",
  "description": "string",
  "alt_text": "string",
  "tags": [
    "string"
  ],
  "is_public": true
}'''

response = requests.put(
    'http://localhost:8011/api/v1/media/assets/string',
    data=body.encode('utf-8'),
    headers={
        'Authorization': 'Bearer YOUR_TOKEN',
        'Content-Type': 'application/json',
    },
)
print(response.text)
```


## Delete Asset

`DELETE /api/v1/media/assets/{asset_id}`

Delete an asset and its stored files.

Authentication (security requirement alternatives):

```json
[
  {
    "HTTPBearer": []
  }
]
```

- HTTPBearer: http (bearer)

Parameters:

- `asset_id` (path, string, required)
  Type: string

Responses:

- 200: Successful Response

Content type: application/json

Type: unknown

- 422: Validation Error

Content type: application/json

Type: object

Schema: [MediaService_HTTPValidationError](/api-reference/schemas/mediaservice-httpvalidationerror-f5812c7c1f.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [MediaService_ValidationError](/api-reference/schemas/mediaservice-validationerror-0fc30c3898.md); Type: object

## Examples

### cURL

```bash
curl -X DELETE 'http://localhost:8011/api/v1/media/assets/string' \
  -H 'Authorization: Bearer YOUR_TOKEN'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8011/api/v1/media/assets/string', {
  method: 'DELETE',
  headers: {
    'Authorization': 'Bearer YOUR_TOKEN',
  },
});

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

### Python

```python
import requests

response = requests.delete(
    'http://localhost:8011/api/v1/media/assets/string',
    headers={
        'Authorization': 'Bearer YOUR_TOKEN',
    },
)
print(response.text)
```


## Get Presigned Url

`GET /api/v1/media/assets/{asset_id}/presigned`

Get a proxy URL for direct file access.

Authentication (security requirement alternatives):

```json
[
  {
    "HTTPBearer": []
  }
]
```

- HTTPBearer: http (bearer)

Parameters:

- `asset_id` (path, string, required)
  Type: string

- `expires_in` (query, integer, optional)
  Type: integer
  
  default: 3600

Responses:

- 200: Successful Response

Content type: application/json

Type: unknown

- 422: Validation Error

Content type: application/json

Type: object

Schema: [MediaService_HTTPValidationError](/api-reference/schemas/mediaservice-httpvalidationerror-f5812c7c1f.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [MediaService_ValidationError](/api-reference/schemas/mediaservice-validationerror-0fc30c3898.md); Type: object

## Examples

### cURL

```bash
curl -X GET 'http://localhost:8011/api/v1/media/assets/string/presigned?expires_in=3600' \
  -H 'Authorization: Bearer YOUR_TOKEN'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8011/api/v1/media/assets/string/presigned?expires_in=3600', {
  method: 'GET',
  headers: {
    'Authorization': 'Bearer YOUR_TOKEN',
  },
});

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

### Python

```python
import requests

response = requests.get(
    'http://localhost:8011/api/v1/media/assets/string/presigned?expires_in=3600',
    headers={
        'Authorization': 'Bearer YOUR_TOKEN',
    },
)
print(response.text)
```


## Link Asset To Response

`POST /api/v1/media/assets/{asset_id}/link`

Link an asset to a form response.

Authentication (security requirement alternatives):

```json
[
  {
    "HTTPBearer": []
  }
]
```

- HTTPBearer: http (bearer)

Parameters:

- `asset_id` (path, string, required)
  Type: string

Request body: application/json (required)

Type: object

Additional properties: true

Responses:

- 200: Successful Response

Content type: application/json

Type: unknown

- 422: Validation Error

Content type: application/json

Type: object

Schema: [MediaService_HTTPValidationError](/api-reference/schemas/mediaservice-httpvalidationerror-f5812c7c1f.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [MediaService_ValidationError](/api-reference/schemas/mediaservice-validationerror-0fc30c3898.md); Type: object

## Examples

### cURL

```bash
curl -X POST 'http://localhost:8011/api/v1/media/assets/string/link' \
  -H 'Authorization: Bearer YOUR_TOKEN' \
  -H 'Content-Type: application/json' \
  --data-raw '{}'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8011/api/v1/media/assets/string/link', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer YOUR_TOKEN',
    'Content-Type': 'application/json',
  },
  body: '{}',
});

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

### Python

```python
import requests

response = requests.post(
    'http://localhost:8011/api/v1/media/assets/string/link',
    data='{}'.encode('utf-8'),
    headers={
        'Authorization': 'Bearer YOUR_TOKEN',
        'Content-Type': 'application/json',
    },
)
print(response.text)
```


## Get Assets For Response

`GET /api/v1/media/assets/by-response/{response_id}`

Get all assets associated with a response.

Authentication (security requirement alternatives):

```json
[
  {
    "HTTPBearer": []
  }
]
```

- HTTPBearer: http (bearer)

Parameters:

- `response_id` (path, string, required)
  Type: string

Responses:

- 200: Successful Response

Content type: application/json

Type: unknown

- 422: Validation Error

Content type: application/json

Type: object

Schema: [MediaService_HTTPValidationError](/api-reference/schemas/mediaservice-httpvalidationerror-f5812c7c1f.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [MediaService_ValidationError](/api-reference/schemas/mediaservice-validationerror-0fc30c3898.md); Type: object

## Examples

### cURL

```bash
curl -X GET 'http://localhost:8011/api/v1/media/assets/by-response/string' \
  -H 'Authorization: Bearer YOUR_TOKEN'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8011/api/v1/media/assets/by-response/string', {
  method: 'GET',
  headers: {
    'Authorization': 'Bearer YOUR_TOKEN',
  },
});

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

### Python

```python
import requests

response = requests.get(
    'http://localhost:8011/api/v1/media/assets/by-response/string',
    headers={
        'Authorization': 'Bearer YOUR_TOKEN',
    },
)
print(response.text)
```


## Get Asset By Upload Id

`GET /api/v1/media/assets/by-upload/{upload_id}`

Resolve a Media Track ``upload_id`` to its canonical MediaAsset.id.

This is the mobile half of the media identity map. A mobile answer carries
``asset_ref="upload_id"`` while offline, so the canonical server identity is
reached through this endpoint rather than by assuming the client's id is a
``MediaAsset.id``.

Deliberately narrow, to match the frozen contract: one indexed lookup on
``upload_id``, tenant-scoped, at most one result. There is no fallback to a
``MediaAsset.id`` lookup, no question-name lookup, and no response-id
lookup, so an unresolved reference stays unresolved instead of resolving to
something it was not.

Authentication (security requirement alternatives):

```json
[
  {
    "HTTPBearer": []
  }
]
```

- HTTPBearer: http (bearer)

Parameters:

- `upload_id` (path, string, required)
  Type: string

Responses:

- 200: Successful Response

Content type: application/json

Type: unknown

- 422: Validation Error

Content type: application/json

Type: object

Schema: [MediaService_HTTPValidationError](/api-reference/schemas/mediaservice-httpvalidationerror-f5812c7c1f.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [MediaService_ValidationError](/api-reference/schemas/mediaservice-validationerror-0fc30c3898.md); Type: object

## Examples

### cURL

```bash
curl -X GET 'http://localhost:8011/api/v1/media/assets/by-upload/string' \
  -H 'Authorization: Bearer YOUR_TOKEN'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8011/api/v1/media/assets/by-upload/string', {
  method: 'GET',
  headers: {
    'Authorization': 'Bearer YOUR_TOKEN',
  },
});

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

### Python

```python
import requests

response = requests.get(
    'http://localhost:8011/api/v1/media/assets/by-upload/string',
    headers={
        'Authorization': 'Bearer YOUR_TOKEN',
    },
)
print(response.text)
```


## Upload Library File

`POST /api/v1/media/library/upload`

Upload a file to the tenant's shared media library.

Uploaded files can then be referenced by filename in survey
question and choice `media_file` fields.

Allowed types: images (jpg, png, gif, webp), audio (mp3, wav, ogg),
video (mp4, webm).

Authentication (security requirement alternatives):

```json
[
  {
    "HTTPBearer": []
  }
]
```

- HTTPBearer: http (bearer)

Request body: multipart/form-data (required)

Type: object

Schema: [MediaService_Body_upload_library_file_api_v1_media_library_upload_post](/api-reference/schemas/mediaservice-body-upload-library-file-api-v1-media-library-upload-post-dbd2f63f47.md)

- `file` (required)
  Type: string
  
  Media file to add to the library

- `description` (optional)
  Type: unknown
  
  Optional description
  
  anyOf:
    Type: string
  
    Type: null

- `survey_name` (optional)
  Type: unknown
  
  Optional survey name for renaming
  
  anyOf:
    Type: string
  
    Type: null

- `question_name` (optional)
  Type: unknown
  
  Optional question name for renaming
  
  anyOf:
    Type: string
  
    Type: null

- `response_id` (optional)
  Type: unknown
  
  Optional response ID for renaming
  
  anyOf:
    Type: string
  
    Type: null

Responses:

- 201: Successful Response

Content type: application/json

Type: unknown

- 422: Validation Error

Content type: application/json

Type: object

Schema: [MediaService_HTTPValidationError](/api-reference/schemas/mediaservice-httpvalidationerror-f5812c7c1f.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [MediaService_ValidationError](/api-reference/schemas/mediaservice-validationerror-0fc30c3898.md); Type: object

## Examples

### cURL

```bash
curl -X POST 'http://localhost:8011/api/v1/media/library/upload' \
  -H 'Authorization: Bearer YOUR_TOKEN' \
  --form-string 'file=string' \
  --form-string 'description=string' \
  --form-string 'survey_name=string' \
  --form-string 'question_name=string' \
  --form-string 'response_id=string'
```

### JavaScript

```javascript
const form = new FormData();
form.append('file', 'string');
form.append('description', 'string');
form.append('survey_name', 'string');
form.append('question_name', 'string');
form.append('response_id', 'string');
const response = await fetch('http://localhost:8011/api/v1/media/library/upload', {
  method: 'POST',
  headers: {"Authorization":"Bearer YOUR_TOKEN"},
  body: form,
});
console.log(await response.text());
```

### Python

```python
import requests
from contextlib import ExitStack

with ExitStack() as stack:
    files = [
        ('file', (None, 'string')),
        ('description', (None, 'string')),
        ('survey_name', (None, 'string')),
        ('question_name', (None, 'string')),
        ('response_id', (None, 'string')),
    ]
    response = requests.request('POST', 'http://localhost:8011/api/v1/media/library/upload', headers={"Authorization":"Bearer YOUR_TOKEN"}, files=files)
    print(response.text)
```


## Upload Library Files Batch

`POST /api/v1/media/library/upload/batch`

Upload multiple files to the tenant's media library at once.

Authentication (security requirement alternatives):

```json
[
  {
    "HTTPBearer": []
  }
]
```

- HTTPBearer: http (bearer)

Request body: multipart/form-data (required)

Type: object

Schema: [MediaService_Body_upload_library_files_batch_api_v1_media_library_upload_batch_post](/api-reference/schemas/mediaservice-body-upload-library-files-batch-api-v1-media-library-upload-batch-post-352912a6cf.md)

- `files` (required)
  Type: array
  
  Media files to add to the library
  
  Items:
    Type: string

Responses:

- 201: Successful Response

Content type: application/json

Type: unknown

- 422: Validation Error

Content type: application/json

Type: object

Schema: [MediaService_HTTPValidationError](/api-reference/schemas/mediaservice-httpvalidationerror-f5812c7c1f.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [MediaService_ValidationError](/api-reference/schemas/mediaservice-validationerror-0fc30c3898.md); Type: object

## Examples

### cURL

```bash
curl -X POST 'http://localhost:8011/api/v1/media/library/upload/batch' \
  -H 'Authorization: Bearer YOUR_TOKEN' \
  --form-string 'files=string'
```

### JavaScript

```javascript
const form = new FormData();
form.append('files', 'string');
const response = await fetch('http://localhost:8011/api/v1/media/library/upload/batch', {
  method: 'POST',
  headers: {"Authorization":"Bearer YOUR_TOKEN"},
  body: form,
});
console.log(await response.text());
```

### Python

```python
import requests
from contextlib import ExitStack

with ExitStack() as stack:
    files = [
        ('files', (None, 'string')),
    ]
    response = requests.request('POST', 'http://localhost:8011/api/v1/media/library/upload/batch', headers={"Authorization":"Bearer YOUR_TOKEN"}, files=files)
    print(response.text)
```


## List Library

`GET /api/v1/media/library`

List all files in the tenant's shared media library.

Supports filtering by asset_type (image, audio, video), filename search,
and tags (comma-separated, returns assets with any matching tag).

Authentication (security requirement alternatives):

```json
[
  {
    "HTTPBearer": []
  }
]
```

- HTTPBearer: http (bearer)

Parameters:

- `asset_type` (query, unknown, optional) - Filter by type: image, audio, video
  Type: unknown
  
  Filter by type: image, audio, video
  
  anyOf:
    Type: string
  
    Type: null

- `search` (query, unknown, optional) - Search by filename
  Type: unknown
  
  Search by filename
  
  anyOf:
    Type: string
  
    Type: null

- `tags` (query, unknown, optional) - Comma-separated tags to filter by (OR logic — assets with any matching tag)
  Type: unknown
  
  Comma-separated tags to filter by (OR logic — assets with any matching tag)
  
  anyOf:
    Type: string
  
    Type: null

- `skip` (query, integer, optional) - Row offset
  Type: integer
  
  Row offset
  
  default: 0
  
  minimum: 0

- `limit` (query, integer, optional) - Items per page
  Type: integer
  
  Items per page
  
  default: 20
  
  minimum: 1
  
  maximum: 100

Responses:

- 200: Successful Response

Content type: application/json

Type: unknown

- 422: Validation Error

Content type: application/json

Type: object

Schema: [MediaService_HTTPValidationError](/api-reference/schemas/mediaservice-httpvalidationerror-f5812c7c1f.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [MediaService_ValidationError](/api-reference/schemas/mediaservice-validationerror-0fc30c3898.md); Type: object

## Examples

### cURL

```bash
curl -X GET 'http://localhost:8011/api/v1/media/library?skip=0&limit=20' \
  -H 'Authorization: Bearer YOUR_TOKEN'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8011/api/v1/media/library?skip=0&limit=20', {
  method: 'GET',
  headers: {
    'Authorization': 'Bearer YOUR_TOKEN',
  },
});

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

### Python

```python
import requests

response = requests.get(
    'http://localhost:8011/api/v1/media/library?skip=0&limit=20',
    headers={
        'Authorization': 'Bearer YOUR_TOKEN',
    },
)
print(response.text)
```


## Get Library Asset By Filename

`GET /api/v1/media/library/by-filename/{filename}`

Look up a library asset by its original filename.

Used by form-service during form rendering to resolve media_file
values to actual stream URLs.

Authentication (security requirement alternatives):

```json
[
  {
    "HTTPBearer": []
  }
]
```

- HTTPBearer: http (bearer)

Parameters:

- `filename` (path, string, required)
  Type: string

Responses:

- 200: Successful Response

Content type: application/json

Type: unknown

- 422: Validation Error

Content type: application/json

Type: object

Schema: [MediaService_HTTPValidationError](/api-reference/schemas/mediaservice-httpvalidationerror-f5812c7c1f.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [MediaService_ValidationError](/api-reference/schemas/mediaservice-validationerror-0fc30c3898.md); Type: object

## Examples

### cURL

```bash
curl -X GET 'http://localhost:8011/api/v1/media/library/by-filename/string' \
  -H 'Authorization: Bearer YOUR_TOKEN'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8011/api/v1/media/library/by-filename/string', {
  method: 'GET',
  headers: {
    'Authorization': 'Bearer YOUR_TOKEN',
  },
});

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

### Python

```python
import requests

response = requests.get(
    'http://localhost:8011/api/v1/media/library/by-filename/string',
    headers={
        'Authorization': 'Bearer YOUR_TOKEN',
    },
)
print(response.text)
```


## Get Library Asset Url

`GET /api/v1/media/library/{asset_id}/url`

Get the stream URL for a library asset.

Returns the URL to stream/display the file inline.

Authentication (security requirement alternatives):

```json
[
  {
    "HTTPBearer": []
  }
]
```

- HTTPBearer: http (bearer)

Parameters:

- `asset_id` (path, string, required)
  Type: string

Responses:

- 200: Successful Response

Content type: application/json

Type: unknown

- 422: Validation Error

Content type: application/json

Type: object

Schema: [MediaService_HTTPValidationError](/api-reference/schemas/mediaservice-httpvalidationerror-f5812c7c1f.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [MediaService_ValidationError](/api-reference/schemas/mediaservice-validationerror-0fc30c3898.md); Type: object

## Examples

### cURL

```bash
curl -X GET 'http://localhost:8011/api/v1/media/library/string/url' \
  -H 'Authorization: Bearer YOUR_TOKEN'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8011/api/v1/media/library/string/url', {
  method: 'GET',
  headers: {
    'Authorization': 'Bearer YOUR_TOKEN',
  },
});

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

### Python

```python
import requests

response = requests.get(
    'http://localhost:8011/api/v1/media/library/string/url',
    headers={
        'Authorization': 'Bearer YOUR_TOKEN',
    },
)
print(response.text)
```


## Update Library Asset Status

`PATCH /api/v1/media/library/{asset_id}/status`

Update a library asset's approval status (pending/approved/rejected).

Only users with the MEDIA_MANAGE permission can approve or reject media.
Pending/rejected library assets are not usable in forms — the by-filename
lookup, stream/download endpoints, and survey enrichment all block them.

Authentication (security requirement alternatives):

```json
[
  {
    "HTTPBearer": []
  }
]
```

- HTTPBearer: http (bearer)

Parameters:

- `asset_id` (path, string, required)
  Type: string

Request body: application/json (required)

Type: object

Additional properties: true

Responses:

- 200: Successful Response

Content type: application/json

Type: unknown

- 422: Validation Error

Content type: application/json

Type: object

Schema: [MediaService_HTTPValidationError](/api-reference/schemas/mediaservice-httpvalidationerror-f5812c7c1f.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [MediaService_ValidationError](/api-reference/schemas/mediaservice-validationerror-0fc30c3898.md); Type: object

## Examples

### cURL

```bash
curl -X PATCH 'http://localhost:8011/api/v1/media/library/string/status' \
  -H 'Authorization: Bearer YOUR_TOKEN' \
  -H 'Content-Type: application/json' \
  --data-raw '{}'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8011/api/v1/media/library/string/status', {
  method: 'PATCH',
  headers: {
    'Authorization': 'Bearer YOUR_TOKEN',
    'Content-Type': 'application/json',
  },
  body: '{}',
});

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

### Python

```python
import requests

response = requests.patch(
    'http://localhost:8011/api/v1/media/library/string/status',
    data='{}'.encode('utf-8'),
    headers={
        'Authorization': 'Bearer YOUR_TOKEN',
        'Content-Type': 'application/json',
    },
)
print(response.text)
```


## Delete Library Asset

`DELETE /api/v1/media/library/{asset_id}`

Delete a file from the tenant's media library.

Warning: This will remove the file from storage. Any surveys that
reference this file by name will no longer be able to display it.

Authentication (security requirement alternatives):

```json
[
  {
    "HTTPBearer": []
  }
]
```

- HTTPBearer: http (bearer)

Parameters:

- `asset_id` (path, string, required)
  Type: string

Responses:

- 200: Successful Response

Content type: application/json

Type: unknown

- 422: Validation Error

Content type: application/json

Type: object

Schema: [MediaService_HTTPValidationError](/api-reference/schemas/mediaservice-httpvalidationerror-f5812c7c1f.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [MediaService_ValidationError](/api-reference/schemas/mediaservice-validationerror-0fc30c3898.md); Type: object

## Examples

### cURL

```bash
curl -X DELETE 'http://localhost:8011/api/v1/media/library/string' \
  -H 'Authorization: Bearer YOUR_TOKEN'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8011/api/v1/media/library/string', {
  method: 'DELETE',
  headers: {
    'Authorization': 'Bearer YOUR_TOKEN',
  },
});

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

### Python

```python
import requests

response = requests.delete(
    'http://localhost:8011/api/v1/media/library/string',
    headers={
        'Authorization': 'Bearer YOUR_TOKEN',
    },
)
print(response.text)
```


## Get Storage Usage

`GET /api/v1/media/storage/usage`

Authentication (security requirement alternatives):

```json
[
  {
    "HTTPBearer": []
  }
]
```

- HTTPBearer: http (bearer)

Responses:

- 200: Successful Response

Content type: application/json

Type: unknown

## Examples

### cURL

```bash
curl -X GET 'http://localhost:8011/api/v1/media/storage/usage' \
  -H 'Authorization: Bearer YOUR_TOKEN'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8011/api/v1/media/storage/usage', {
  method: 'GET',
  headers: {
    'Authorization': 'Bearer YOUR_TOKEN',
  },
});

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

### Python

```python
import requests

response = requests.get(
    'http://localhost:8011/api/v1/media/storage/usage',
    headers={
        'Authorization': 'Bearer YOUR_TOKEN',
    },
)
print(response.text)
```


## Send Notification

`POST /api/v1/notification/send`

Authentication (security requirement alternatives):

```json
[
  {
    "HTTPBearer": []
  }
]
```

- HTTPBearer: http (bearer)

Request body: application/json (required)

Type: object

Schema: [NotificationService_SendNotificationRequest](/api-reference/schemas/notificationservice-sendnotificationrequest-bce0cd0fcb.md)

- `channel` (required)
  Type: string
  
  enum: ["email","sms","slack"]

- `recipient` (required)
  Type: string

- `subject` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `body` (required)
  Type: string

- `template_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `template_vars` (optional)
  Type: unknown
  
  anyOf:
    Type: object
    
    Additional properties: true
  
    Type: null

- `user_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `notification_type` (optional)
  Type: unknown
  
  anyOf:
    Reference: [NotificationService_NotificationType](/api-reference/schemas/notificationservice-notificationtype-26f3121586.md); Type: string
    
    enum: ["account_activation","password_reset_request","password_changed","email_change_confirmation","email_changed_notify","magic_link_login","audit_security_alert","dns_notification","welcome_email","tenant_active","download_ready","media_export_ready"]
  
    Type: string
  
    Type: null

- `metadata` (optional)
  Type: unknown
  
  anyOf:
    Type: object
    
    Additional properties: true
  
    Type: null

Responses:

- 202: Successful Response

Content type: application/json

Type: unknown

- 422: Validation Error

Content type: application/json

Type: object

Schema: [NotificationService_HTTPValidationError](/api-reference/schemas/notificationservice-httpvalidationerror-89b24df40a.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [NotificationService_ValidationError](/api-reference/schemas/notificationservice-validationerror-e6abc27f21.md); Type: object

## Examples

### cURL

```bash
curl -X POST 'http://localhost:8012/api/v1/notification/send' \
  -H 'Authorization: Bearer YOUR_TOKEN' \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "channel": "email",
  "recipient": "string",
  "subject": "string",
  "body": "string",
  "template_id": "string",
  "template_vars": {},
  "user_id": "string",
  "notification_type": "account_activation",
  "metadata": {}
}'
```

### JavaScript

```javascript
const body = `{
  "channel": "email",
  "recipient": "string",
  "subject": "string",
  "body": "string",
  "template_id": "string",
  "template_vars": {},
  "user_id": "string",
  "notification_type": "account_activation",
  "metadata": {}
}`;

const response = await fetch('http://localhost:8012/api/v1/notification/send', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer YOUR_TOKEN',
    'Content-Type': 'application/json',
  },
  body,
});

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

### Python

```python
import requests

body = '''{
  "channel": "email",
  "recipient": "string",
  "subject": "string",
  "body": "string",
  "template_id": "string",
  "template_vars": {},
  "user_id": "string",
  "notification_type": "account_activation",
  "metadata": {}
}'''

response = requests.post(
    'http://localhost:8012/api/v1/notification/send',
    data=body.encode('utf-8'),
    headers={
        'Authorization': 'Bearer YOUR_TOKEN',
        'Content-Type': 'application/json',
    },
)
print(response.text)
```


## Send Batch

`POST /api/v1/notification/send/batch`

Authentication (security requirement alternatives):

```json
[
  {
    "HTTPBearer": []
  }
]
```

- HTTPBearer: http (bearer)

Request body: application/json (required)

Type: object

Schema: [NotificationService_SendBatchRequest](/api-reference/schemas/notificationservice-sendbatchrequest-adadffcaa6.md)

- `notifications` (required)
  Type: array
  
  Items:
    Reference: [NotificationService_SendNotificationRequest](/api-reference/schemas/notificationservice-sendnotificationrequest-bce0cd0fcb.md); Type: object

Responses:

- 202: Successful Response

Content type: application/json

Type: unknown

- 422: Validation Error

Content type: application/json

Type: object

Schema: [NotificationService_HTTPValidationError](/api-reference/schemas/notificationservice-httpvalidationerror-89b24df40a.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [NotificationService_ValidationError](/api-reference/schemas/notificationservice-validationerror-e6abc27f21.md); Type: object

## Examples

### cURL

```bash
curl -X POST 'http://localhost:8012/api/v1/notification/send/batch' \
  -H 'Authorization: Bearer YOUR_TOKEN' \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "notifications": [
    {
      "channel": "email",
      "recipient": "string",
      "subject": "string",
      "body": "string",
      "template_id": "string",
      "template_vars": {},
      "user_id": "string",
      "notification_type": "account_activation",
      "metadata": {}
    }
  ]
}'
```

### JavaScript

```javascript
const body = `{
  "notifications": [
    {
      "channel": "email",
      "recipient": "string",
      "subject": "string",
      "body": "string",
      "template_id": "string",
      "template_vars": {},
      "user_id": "string",
      "notification_type": "account_activation",
      "metadata": {}
    }
  ]
}`;

const response = await fetch('http://localhost:8012/api/v1/notification/send/batch', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer YOUR_TOKEN',
    'Content-Type': 'application/json',
  },
  body,
});

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

### Python

```python
import requests

body = '''{
  "notifications": [
    {
      "channel": "email",
      "recipient": "string",
      "subject": "string",
      "body": "string",
      "template_id": "string",
      "template_vars": {},
      "user_id": "string",
      "notification_type": "account_activation",
      "metadata": {}
    }
  ]
}'''

response = requests.post(
    'http://localhost:8012/api/v1/notification/send/batch',
    data=body.encode('utf-8'),
    headers={
        'Authorization': 'Bearer YOUR_TOKEN',
        'Content-Type': 'application/json',
    },
)
print(response.text)
```


## List Templates

`GET /api/v1/notification/templates`

Authentication (security requirement alternatives):

```json
[
  {
    "HTTPBearer": []
  }
]
```

- HTTPBearer: http (bearer)

Parameters:

- `channel` (query, unknown, optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

Responses:

- 200: Successful Response

Content type: application/json

Type: unknown

- 422: Validation Error

Content type: application/json

Type: object

Schema: [NotificationService_HTTPValidationError](/api-reference/schemas/notificationservice-httpvalidationerror-89b24df40a.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [NotificationService_ValidationError](/api-reference/schemas/notificationservice-validationerror-e6abc27f21.md); Type: object

## Examples

### cURL

```bash
curl -X GET 'http://localhost:8012/api/v1/notification/templates' \
  -H 'Authorization: Bearer YOUR_TOKEN'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8012/api/v1/notification/templates', {
  method: 'GET',
  headers: {
    'Authorization': 'Bearer YOUR_TOKEN',
  },
});

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

### Python

```python
import requests

response = requests.get(
    'http://localhost:8012/api/v1/notification/templates',
    headers={
        'Authorization': 'Bearer YOUR_TOKEN',
    },
)
print(response.text)
```


## Create Template

`POST /api/v1/notification/templates`

Authentication (security requirement alternatives):

```json
[
  {
    "HTTPBearer": []
  }
]
```

- HTTPBearer: http (bearer)

Request body: application/json (required)

Type: object

Schema: [NotificationService_TemplateCreateRequest](/api-reference/schemas/notificationservice-templatecreaterequest-9d73ece643.md)

- `name` (required)
  Type: string

- `channel` (required)
  Type: string

- `subject_template` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `body_template` (required)
  Type: string

- `variables` (optional)
  Type: unknown
  
  anyOf:
    Type: array
    
    Items:
      Type: string
  
    Type: null

Responses:

- 201: Successful Response

Content type: application/json

Type: unknown

- 422: Validation Error

Content type: application/json

Type: object

Schema: [NotificationService_HTTPValidationError](/api-reference/schemas/notificationservice-httpvalidationerror-89b24df40a.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [NotificationService_ValidationError](/api-reference/schemas/notificationservice-validationerror-e6abc27f21.md); Type: object

## Examples

### cURL

```bash
curl -X POST 'http://localhost:8012/api/v1/notification/templates' \
  -H 'Authorization: Bearer YOUR_TOKEN' \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "name": "string",
  "channel": "string",
  "subject_template": "string",
  "body_template": "string",
  "variables": [
    "string"
  ]
}'
```

### JavaScript

```javascript
const body = `{
  "name": "string",
  "channel": "string",
  "subject_template": "string",
  "body_template": "string",
  "variables": [
    "string"
  ]
}`;

const response = await fetch('http://localhost:8012/api/v1/notification/templates', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer YOUR_TOKEN',
    'Content-Type': 'application/json',
  },
  body,
});

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

### Python

```python
import requests

body = '''{
  "name": "string",
  "channel": "string",
  "subject_template": "string",
  "body_template": "string",
  "variables": [
    "string"
  ]
}'''

response = requests.post(
    'http://localhost:8012/api/v1/notification/templates',
    data=body.encode('utf-8'),
    headers={
        'Authorization': 'Bearer YOUR_TOKEN',
        'Content-Type': 'application/json',
    },
)
print(response.text)
```


## Preview Template Live

`POST /api/v1/notification/templates/preview`

Authentication (security requirement alternatives):

```json
[
  {
    "HTTPBearer": []
  }
]
```

- HTTPBearer: http (bearer)

Request body: application/json (required)

Type: object

Schema: [NotificationService_TemplateLivePreviewRequest](/api-reference/schemas/notificationservice-templatelivepreviewrequest-62dac37c00.md)

- `subject_template` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `body_template` (required)
  Type: string

- `variables` (optional)
  Type: object
  
  default: {}
  
  Additional properties: 
    Type: string

Responses:

- 200: Successful Response

Content type: application/json

Type: unknown

- 422: Validation Error

Content type: application/json

Type: object

Schema: [NotificationService_HTTPValidationError](/api-reference/schemas/notificationservice-httpvalidationerror-89b24df40a.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [NotificationService_ValidationError](/api-reference/schemas/notificationservice-validationerror-e6abc27f21.md); Type: object

## Examples

### cURL

```bash
curl -X POST 'http://localhost:8012/api/v1/notification/templates/preview' \
  -H 'Authorization: Bearer YOUR_TOKEN' \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "subject_template": "string",
  "body_template": "string",
  "variables": {}
}'
```

### JavaScript

```javascript
const body = `{
  "subject_template": "string",
  "body_template": "string",
  "variables": {}
}`;

const response = await fetch('http://localhost:8012/api/v1/notification/templates/preview', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer YOUR_TOKEN',
    'Content-Type': 'application/json',
  },
  body,
});

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

### Python

```python
import requests

body = '''{
  "subject_template": "string",
  "body_template": "string",
  "variables": {}
}'''

response = requests.post(
    'http://localhost:8012/api/v1/notification/templates/preview',
    data=body.encode('utf-8'),
    headers={
        'Authorization': 'Bearer YOUR_TOKEN',
        'Content-Type': 'application/json',
    },
)
print(response.text)
```


## Get Template

`GET /api/v1/notification/templates/{template_id}`

Authentication (security requirement alternatives):

```json
[
  {
    "HTTPBearer": []
  }
]
```

- HTTPBearer: http (bearer)

Parameters:

- `template_id` (path, string, uuid, required)
  Type: string, uuid

Responses:

- 200: Successful Response

Content type: application/json

Type: unknown

- 422: Validation Error

Content type: application/json

Type: object

Schema: [NotificationService_HTTPValidationError](/api-reference/schemas/notificationservice-httpvalidationerror-89b24df40a.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [NotificationService_ValidationError](/api-reference/schemas/notificationservice-validationerror-e6abc27f21.md); Type: object

## Examples

### cURL

```bash
curl -X GET 'http://localhost:8012/api/v1/notification/templates/550e8400-e29b-41d4-a716-446655440000' \
  -H 'Authorization: Bearer YOUR_TOKEN'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8012/api/v1/notification/templates/550e8400-e29b-41d4-a716-446655440000', {
  method: 'GET',
  headers: {
    'Authorization': 'Bearer YOUR_TOKEN',
  },
});

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

### Python

```python
import requests

response = requests.get(
    'http://localhost:8012/api/v1/notification/templates/550e8400-e29b-41d4-a716-446655440000',
    headers={
        'Authorization': 'Bearer YOUR_TOKEN',
    },
)
print(response.text)
```


## Update Template

`PUT /api/v1/notification/templates/{template_id}`

Authentication (security requirement alternatives):

```json
[
  {
    "HTTPBearer": []
  }
]
```

- HTTPBearer: http (bearer)

Parameters:

- `template_id` (path, string, uuid, required)
  Type: string, uuid

Request body: application/json (required)

Type: object

Schema: [NotificationService_TemplateUpdateRequest](/api-reference/schemas/notificationservice-templateupdaterequest-17499a4752.md)

- `name` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `subject_template` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `body_template` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `variables` (optional)
  Type: unknown
  
  anyOf:
    Type: array
    
    Items:
      Type: string
  
    Type: null

- `is_active` (optional)
  Type: unknown
  
  anyOf:
    Type: boolean
  
    Type: null

Responses:

- 200: Successful Response

Content type: application/json

Type: unknown

- 422: Validation Error

Content type: application/json

Type: object

Schema: [NotificationService_HTTPValidationError](/api-reference/schemas/notificationservice-httpvalidationerror-89b24df40a.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [NotificationService_ValidationError](/api-reference/schemas/notificationservice-validationerror-e6abc27f21.md); Type: object

## Examples

### cURL

```bash
curl -X PUT 'http://localhost:8012/api/v1/notification/templates/550e8400-e29b-41d4-a716-446655440000' \
  -H 'Authorization: Bearer YOUR_TOKEN' \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "name": "string",
  "subject_template": "string",
  "body_template": "string",
  "variables": [
    "string"
  ],
  "is_active": true
}'
```

### JavaScript

```javascript
const body = `{
  "name": "string",
  "subject_template": "string",
  "body_template": "string",
  "variables": [
    "string"
  ],
  "is_active": true
}`;

const response = await fetch('http://localhost:8012/api/v1/notification/templates/550e8400-e29b-41d4-a716-446655440000', {
  method: 'PUT',
  headers: {
    'Authorization': 'Bearer YOUR_TOKEN',
    'Content-Type': 'application/json',
  },
  body,
});

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

### Python

```python
import requests

body = '''{
  "name": "string",
  "subject_template": "string",
  "body_template": "string",
  "variables": [
    "string"
  ],
  "is_active": true
}'''

response = requests.put(
    'http://localhost:8012/api/v1/notification/templates/550e8400-e29b-41d4-a716-446655440000',
    data=body.encode('utf-8'),
    headers={
        'Authorization': 'Bearer YOUR_TOKEN',
        'Content-Type': 'application/json',
    },
)
print(response.text)
```


## Delete Template

`DELETE /api/v1/notification/templates/{template_id}`

Authentication (security requirement alternatives):

```json
[
  {
    "HTTPBearer": []
  }
]
```

- HTTPBearer: http (bearer)

Parameters:

- `template_id` (path, string, uuid, required)
  Type: string, uuid

Responses:

- 200: Successful Response

Content type: application/json

Type: unknown

- 422: Validation Error

Content type: application/json

Type: object

Schema: [NotificationService_HTTPValidationError](/api-reference/schemas/notificationservice-httpvalidationerror-89b24df40a.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [NotificationService_ValidationError](/api-reference/schemas/notificationservice-validationerror-e6abc27f21.md); Type: object

## Examples

### cURL

```bash
curl -X DELETE 'http://localhost:8012/api/v1/notification/templates/550e8400-e29b-41d4-a716-446655440000' \
  -H 'Authorization: Bearer YOUR_TOKEN'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8012/api/v1/notification/templates/550e8400-e29b-41d4-a716-446655440000', {
  method: 'DELETE',
  headers: {
    'Authorization': 'Bearer YOUR_TOKEN',
  },
});

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

### Python

```python
import requests

response = requests.delete(
    'http://localhost:8012/api/v1/notification/templates/550e8400-e29b-41d4-a716-446655440000',
    headers={
        'Authorization': 'Bearer YOUR_TOKEN',
    },
)
print(response.text)
```


## Preview Template

`POST /api/v1/notification/templates/{template_id}/preview`

Authentication (security requirement alternatives):

```json
[
  {
    "HTTPBearer": []
  }
]
```

- HTTPBearer: http (bearer)

Parameters:

- `template_id` (path, string, uuid, required)
  Type: string, uuid

Request body: application/json (required)

Type: object

Schema: [NotificationService_TemplatePreviewRequest](/api-reference/schemas/notificationservice-templatepreviewrequest-8be7d0806f.md)

- `variables` (optional)
  Type: object
  
  default: {}
  
  Additional properties: 
    Type: string

Responses:

- 200: Successful Response

Content type: application/json

Type: unknown

- 422: Validation Error

Content type: application/json

Type: object

Schema: [NotificationService_HTTPValidationError](/api-reference/schemas/notificationservice-httpvalidationerror-89b24df40a.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [NotificationService_ValidationError](/api-reference/schemas/notificationservice-validationerror-e6abc27f21.md); Type: object

## Examples

### cURL

```bash
curl -X POST 'http://localhost:8012/api/v1/notification/templates/550e8400-e29b-41d4-a716-446655440000/preview' \
  -H 'Authorization: Bearer YOUR_TOKEN' \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "variables": {}
}'
```

### JavaScript

```javascript
const body = `{
  "variables": {}
}`;

const response = await fetch('http://localhost:8012/api/v1/notification/templates/550e8400-e29b-41d4-a716-446655440000/preview', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer YOUR_TOKEN',
    'Content-Type': 'application/json',
  },
  body,
});

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

### Python

```python
import requests

body = '''{
  "variables": {}
}'''

response = requests.post(
    'http://localhost:8012/api/v1/notification/templates/550e8400-e29b-41d4-a716-446655440000/preview',
    data=body.encode('utf-8'),
    headers={
        'Authorization': 'Bearer YOUR_TOKEN',
        'Content-Type': 'application/json',
    },
)
print(response.text)
```


## Get Preferences

`GET /api/v1/notification/preferences`

Authentication (security requirement alternatives):

```json
[
  {
    "HTTPBearer": []
  }
]
```

- HTTPBearer: http (bearer)

Responses:

- 200: Successful Response

Content type: application/json

Type: unknown

## Examples

### cURL

```bash
curl -X GET 'http://localhost:8012/api/v1/notification/preferences' \
  -H 'Authorization: Bearer YOUR_TOKEN'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8012/api/v1/notification/preferences', {
  method: 'GET',
  headers: {
    'Authorization': 'Bearer YOUR_TOKEN',
  },
});

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

### Python

```python
import requests

response = requests.get(
    'http://localhost:8012/api/v1/notification/preferences',
    headers={
        'Authorization': 'Bearer YOUR_TOKEN',
    },
)
print(response.text)
```


## Set Preference

`POST /api/v1/notification/preferences`

Authentication (security requirement alternatives):

```json
[
  {
    "HTTPBearer": []
  }
]
```

- HTTPBearer: http (bearer)

Request body: application/json (required)

Type: object

Schema: [NotificationService_UserPreferenceRequest](/api-reference/schemas/notificationservice-userpreferencerequest-3b9c7441ee.md)

- `channel` (required)
  Type: string

- `is_enabled` (optional)
  Type: boolean
  
  default: true

- `quiet_hours_start` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `quiet_hours_end` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `frequency` (optional)
  Type: string
  
  default: "immediate"

Responses:

- 201: Successful Response

Content type: application/json

Type: unknown

- 422: Validation Error

Content type: application/json

Type: object

Schema: [NotificationService_HTTPValidationError](/api-reference/schemas/notificationservice-httpvalidationerror-89b24df40a.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [NotificationService_ValidationError](/api-reference/schemas/notificationservice-validationerror-e6abc27f21.md); Type: object

## Examples

### cURL

```bash
curl -X POST 'http://localhost:8012/api/v1/notification/preferences' \
  -H 'Authorization: Bearer YOUR_TOKEN' \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "channel": "string",
  "is_enabled": true,
  "quiet_hours_start": "string",
  "quiet_hours_end": "string",
  "frequency": "immediate"
}'
```

### JavaScript

```javascript
const body = `{
  "channel": "string",
  "is_enabled": true,
  "quiet_hours_start": "string",
  "quiet_hours_end": "string",
  "frequency": "immediate"
}`;

const response = await fetch('http://localhost:8012/api/v1/notification/preferences', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer YOUR_TOKEN',
    'Content-Type': 'application/json',
  },
  body,
});

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

### Python

```python
import requests

body = '''{
  "channel": "string",
  "is_enabled": true,
  "quiet_hours_start": "string",
  "quiet_hours_end": "string",
  "frequency": "immediate"
}'''

response = requests.post(
    'http://localhost:8012/api/v1/notification/preferences',
    data=body.encode('utf-8'),
    headers={
        'Authorization': 'Bearer YOUR_TOKEN',
        'Content-Type': 'application/json',
    },
)
print(response.text)
```


## Update Preference

`PUT /api/v1/notification/preferences/{pref_id}`

Authentication (security requirement alternatives):

```json
[
  {
    "HTTPBearer": []
  }
]
```

- HTTPBearer: http (bearer)

Parameters:

- `pref_id` (path, string, uuid, required)
  Type: string, uuid

Request body: application/json (required)

Type: object

Schema: [NotificationService_UserPreferenceRequest](/api-reference/schemas/notificationservice-userpreferencerequest-3b9c7441ee.md)

- `channel` (required)
  Type: string

- `is_enabled` (optional)
  Type: boolean
  
  default: true

- `quiet_hours_start` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `quiet_hours_end` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `frequency` (optional)
  Type: string
  
  default: "immediate"

Responses:

- 200: Successful Response

Content type: application/json

Type: unknown

- 422: Validation Error

Content type: application/json

Type: object

Schema: [NotificationService_HTTPValidationError](/api-reference/schemas/notificationservice-httpvalidationerror-89b24df40a.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [NotificationService_ValidationError](/api-reference/schemas/notificationservice-validationerror-e6abc27f21.md); Type: object

## Examples

### cURL

```bash
curl -X PUT 'http://localhost:8012/api/v1/notification/preferences/550e8400-e29b-41d4-a716-446655440000' \
  -H 'Authorization: Bearer YOUR_TOKEN' \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "channel": "string",
  "is_enabled": true,
  "quiet_hours_start": "string",
  "quiet_hours_end": "string",
  "frequency": "immediate"
}'
```

### JavaScript

```javascript
const body = `{
  "channel": "string",
  "is_enabled": true,
  "quiet_hours_start": "string",
  "quiet_hours_end": "string",
  "frequency": "immediate"
}`;

const response = await fetch('http://localhost:8012/api/v1/notification/preferences/550e8400-e29b-41d4-a716-446655440000', {
  method: 'PUT',
  headers: {
    'Authorization': 'Bearer YOUR_TOKEN',
    'Content-Type': 'application/json',
  },
  body,
});

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

### Python

```python
import requests

body = '''{
  "channel": "string",
  "is_enabled": true,
  "quiet_hours_start": "string",
  "quiet_hours_end": "string",
  "frequency": "immediate"
}'''

response = requests.put(
    'http://localhost:8012/api/v1/notification/preferences/550e8400-e29b-41d4-a716-446655440000',
    data=body.encode('utf-8'),
    headers={
        'Authorization': 'Bearer YOUR_TOKEN',
        'Content-Type': 'application/json',
    },
)
print(response.text)
```


## Delete Preference

`DELETE /api/v1/notification/preferences/{pref_id}`

Authentication (security requirement alternatives):

```json
[
  {
    "HTTPBearer": []
  }
]
```

- HTTPBearer: http (bearer)

Parameters:

- `pref_id` (path, string, uuid, required)
  Type: string, uuid

Responses:

- 204: Successful Response

- 422: Validation Error

Content type: application/json

Type: object

Schema: [NotificationService_HTTPValidationError](/api-reference/schemas/notificationservice-httpvalidationerror-89b24df40a.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [NotificationService_ValidationError](/api-reference/schemas/notificationservice-validationerror-e6abc27f21.md); Type: object

## Examples

### cURL

```bash
curl -X DELETE 'http://localhost:8012/api/v1/notification/preferences/550e8400-e29b-41d4-a716-446655440000' \
  -H 'Authorization: Bearer YOUR_TOKEN'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8012/api/v1/notification/preferences/550e8400-e29b-41d4-a716-446655440000', {
  method: 'DELETE',
  headers: {
    'Authorization': 'Bearer YOUR_TOKEN',
  },
});

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

### Python

```python
import requests

response = requests.delete(
    'http://localhost:8012/api/v1/notification/preferences/550e8400-e29b-41d4-a716-446655440000',
    headers={
        'Authorization': 'Bearer YOUR_TOKEN',
    },
)
print(response.text)
```


## Get Settings

`GET /api/v1/notification/settings`

Authentication (security requirement alternatives):

```json
[
  {
    "HTTPBearer": []
  }
]
```

- HTTPBearer: http (bearer)

Responses:

- 200: Successful Response

Content type: application/json

Type: object

Schema: [NotificationService_NotificationSettingsResponse](/api-reference/schemas/notificationservice-notificationsettingsresponse-6aa4babdfd.md)

- `sms_provider` (required)
  Type: string

- `smtp` (required)
  Reference: [NotificationService_SMTPConfigResponse](/api-reference/schemas/notificationservice-smtpconfigresponse-cf5f60ea60.md); Type: object

- `aws` (optional)
  Type: unknown
  
  anyOf:
    Reference: [NotificationService_AWSConfigResponse](/api-reference/schemas/notificationservice-awsconfigresponse-e8c66a5507.md); Type: object
  
    Type: null

- `twilio` (optional)
  Type: unknown
  
  anyOf:
    Reference: [NotificationService_TwilioConfigResponse](/api-reference/schemas/notificationservice-twilioconfigresponse-ca0345efeb.md); Type: object
  
    Type: null

- `msg91` (optional)
  Type: unknown
  
  anyOf:
    Reference: [NotificationService_MSG91ConfigResponse](/api-reference/schemas/notificationservice-msg91configresponse-f9524e204e.md); Type: object
  
    Type: null

- `kaleyra` (optional)
  Type: unknown
  
  anyOf:
    Reference: [NotificationService_KaleyraConfigResponse](/api-reference/schemas/notificationservice-kaleyraconfigresponse-d7f645b660.md); Type: object
  
    Type: null

- `africas_talking` (optional)
  Type: unknown
  
  anyOf:
    Reference: [NotificationService_AfricasTalkingConfigResponse](/api-reference/schemas/notificationservice-africastalkingconfigresponse-171e3c21dd.md); Type: object
  
    Type: null

- `generic_http` (optional)
  Type: unknown
  
  anyOf:
    Reference: [NotificationService_GenericHttpConfigResponse](/api-reference/schemas/notificationservice-generichttpconfigresponse-c12cbab716.md); Type: object
  
    Type: null

- `slack` (optional)
  Type: unknown
  
  anyOf:
    Reference: [NotificationService_SlackConfigResponse](/api-reference/schemas/notificationservice-slackconfigresponse-2b5dd208e8.md); Type: object
  
    Type: null

- `is_active` (required)
  Type: boolean

- `created_at` (required)
  Type: string

- `updated_at` (required)
  Type: string

## Examples

### cURL

```bash
curl -X GET 'http://localhost:8012/api/v1/notification/settings' \
  -H 'Authorization: Bearer YOUR_TOKEN'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8012/api/v1/notification/settings', {
  method: 'GET',
  headers: {
    'Authorization': 'Bearer YOUR_TOKEN',
  },
});

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

### Python

```python
import requests

response = requests.get(
    'http://localhost:8012/api/v1/notification/settings',
    headers={
        'Authorization': 'Bearer YOUR_TOKEN',
    },
)
print(response.text)
```


## Update Settings

`PUT /api/v1/notification/settings`

Authentication (security requirement alternatives):

```json
[
  {
    "HTTPBearer": []
  }
]
```

- HTTPBearer: http (bearer)

Request body: application/json (required)

Type: object

Schema: [NotificationService_NotificationSettingsRequest](/api-reference/schemas/notificationservice-notificationsettingsrequest-0dbf9180a6.md)

- `smtp` (optional)
  Type: unknown
  
  anyOf:
    Reference: [NotificationService_SMTPConfig](/api-reference/schemas/notificationservice-smtpconfig-da6804e9b9.md); Type: object
  
    Type: null

- `sms_provider` (optional)
  Type: string
  
  default: "mock"
  
  enum: ["mock","aws_end_user_messaging","twilio","msg91","kaleyra","africas_talking","generic_http"]

- `aws` (optional)
  Type: unknown
  
  anyOf:
    Reference: [NotificationService_AWSConfig](/api-reference/schemas/notificationservice-awsconfig-00d0034632.md); Type: object
  
    Type: null

- `twilio` (optional)
  Type: unknown
  
  anyOf:
    Reference: [NotificationService_TwilioConfig](/api-reference/schemas/notificationservice-twilioconfig-b3f84254c5.md); Type: object
  
    Type: null

- `msg91` (optional)
  Type: unknown
  
  anyOf:
    Reference: [NotificationService_MSG91Config](/api-reference/schemas/notificationservice-msg91config-e074ce88a5.md); Type: object
  
    Type: null

- `kaleyra` (optional)
  Type: unknown
  
  anyOf:
    Reference: [NotificationService_KaleyraConfig](/api-reference/schemas/notificationservice-kaleyraconfig-a61cec99b1.md); Type: object
  
    Type: null

- `africas_talking` (optional)
  Type: unknown
  
  anyOf:
    Reference: [NotificationService_AfricasTalkingConfig](/api-reference/schemas/notificationservice-africastalkingconfig-fb71dc718d.md); Type: object
  
    Type: null

- `generic_http` (optional)
  Type: unknown
  
  anyOf:
    Reference: [NotificationService_GenericHttpConfig](/api-reference/schemas/notificationservice-generichttpconfig-61cc58e557.md); Type: object
  
    Type: null

- `slack` (optional)
  Type: unknown
  
  anyOf:
    Reference: [NotificationService_SlackConfig](/api-reference/schemas/notificationservice-slackconfig-3aeb3a316e.md); Type: object
  
    Type: null

Responses:

- 200: Successful Response

Content type: application/json

Type: object

Schema: [NotificationService_NotificationSettingsResponse](/api-reference/schemas/notificationservice-notificationsettingsresponse-6aa4babdfd.md)

- `sms_provider` (required)
  Type: string

- `smtp` (required)
  Reference: [NotificationService_SMTPConfigResponse](/api-reference/schemas/notificationservice-smtpconfigresponse-cf5f60ea60.md); Type: object

- `aws` (optional)
  Type: unknown
  
  anyOf:
    Reference: [NotificationService_AWSConfigResponse](/api-reference/schemas/notificationservice-awsconfigresponse-e8c66a5507.md); Type: object
  
    Type: null

- `twilio` (optional)
  Type: unknown
  
  anyOf:
    Reference: [NotificationService_TwilioConfigResponse](/api-reference/schemas/notificationservice-twilioconfigresponse-ca0345efeb.md); Type: object
  
    Type: null

- `msg91` (optional)
  Type: unknown
  
  anyOf:
    Reference: [NotificationService_MSG91ConfigResponse](/api-reference/schemas/notificationservice-msg91configresponse-f9524e204e.md); Type: object
  
    Type: null

- `kaleyra` (optional)
  Type: unknown
  
  anyOf:
    Reference: [NotificationService_KaleyraConfigResponse](/api-reference/schemas/notificationservice-kaleyraconfigresponse-d7f645b660.md); Type: object
  
    Type: null

- `africas_talking` (optional)
  Type: unknown
  
  anyOf:
    Reference: [NotificationService_AfricasTalkingConfigResponse](/api-reference/schemas/notificationservice-africastalkingconfigresponse-171e3c21dd.md); Type: object
  
    Type: null

- `generic_http` (optional)
  Type: unknown
  
  anyOf:
    Reference: [NotificationService_GenericHttpConfigResponse](/api-reference/schemas/notificationservice-generichttpconfigresponse-c12cbab716.md); Type: object
  
    Type: null

- `slack` (optional)
  Type: unknown
  
  anyOf:
    Reference: [NotificationService_SlackConfigResponse](/api-reference/schemas/notificationservice-slackconfigresponse-2b5dd208e8.md); Type: object
  
    Type: null

- `is_active` (required)
  Type: boolean

- `created_at` (required)
  Type: string

- `updated_at` (required)
  Type: string

- 422: Validation Error

Content type: application/json

Type: object

Schema: [NotificationService_HTTPValidationError](/api-reference/schemas/notificationservice-httpvalidationerror-89b24df40a.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [NotificationService_ValidationError](/api-reference/schemas/notificationservice-validationerror-e6abc27f21.md); Type: object

## Examples

### cURL

```bash
curl -X PUT 'http://localhost:8012/api/v1/notification/settings' \
  -H 'Authorization: Bearer YOUR_TOKEN' \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "smtp": {
    "smtp_host": "string",
    "smtp_port": 587,
    "smtp_username": "string",
    "smtp_password": "string",
    "smtp_from_email": "string",
    "smtp_from_name": "string",
    "smtp_use_tls": true
  },
  "sms_provider": "mock",
  "aws": {
    "aws_region": "string",
    "aws_access_key_id": "string",
    "aws_secret_access_key": "string",
    "aws_origination_number": "string"
  },
  "twilio": {
    "twilio_account_sid": "string",
    "twilio_auth_token": "string",
    "twilio_from_number": "string"
  },
  "msg91": {
    "msg91_api_key": "string",
    "msg91_sender_id": "string",
    "msg91_flow_id": "string",
    "msg91_route": "4"
  },
  "kaleyra": {
    "kaleyra_api_key": "string",
    "kaleyra_account_sid": "string",
    "kaleyra_sender_id": "string"
  },
  "africas_talking": {
    "africas_talking_username": "string",
    "africas_talking_api_key": "string",
    "africas_talking_shortcode": "string"
  },
  "generic_http": {
    "generic_sms_endpoint": "string",
    "generic_sms_method": "POST",
    "generic_sms_auth_header_name": "string",
    "generic_sms_auth_header_value": "string",
    "generic_sms_body_template": "string"
  },
  "slack": {
    "slack_webhook_url": "string"
  }
}'
```

### JavaScript

```javascript
const body = `{
  "smtp": {
    "smtp_host": "string",
    "smtp_port": 587,
    "smtp_username": "string",
    "smtp_password": "string",
    "smtp_from_email": "string",
    "smtp_from_name": "string",
    "smtp_use_tls": true
  },
  "sms_provider": "mock",
  "aws": {
    "aws_region": "string",
    "aws_access_key_id": "string",
    "aws_secret_access_key": "string",
    "aws_origination_number": "string"
  },
  "twilio": {
    "twilio_account_sid": "string",
    "twilio_auth_token": "string",
    "twilio_from_number": "string"
  },
  "msg91": {
    "msg91_api_key": "string",
    "msg91_sender_id": "string",
    "msg91_flow_id": "string",
    "msg91_route": "4"
  },
  "kaleyra": {
    "kaleyra_api_key": "string",
    "kaleyra_account_sid": "string",
    "kaleyra_sender_id": "string"
  },
  "africas_talking": {
    "africas_talking_username": "string",
    "africas_talking_api_key": "string",
    "africas_talking_shortcode": "string"
  },
  "generic_http": {
    "generic_sms_endpoint": "string",
    "generic_sms_method": "POST",
    "generic_sms_auth_header_name": "string",
    "generic_sms_auth_header_value": "string",
    "generic_sms_body_template": "string"
  },
  "slack": {
    "slack_webhook_url": "string"
  }
}`;

const response = await fetch('http://localhost:8012/api/v1/notification/settings', {
  method: 'PUT',
  headers: {
    'Authorization': 'Bearer YOUR_TOKEN',
    'Content-Type': 'application/json',
  },
  body,
});

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

### Python

```python
import requests

body = '''{
  "smtp": {
    "smtp_host": "string",
    "smtp_port": 587,
    "smtp_username": "string",
    "smtp_password": "string",
    "smtp_from_email": "string",
    "smtp_from_name": "string",
    "smtp_use_tls": true
  },
  "sms_provider": "mock",
  "aws": {
    "aws_region": "string",
    "aws_access_key_id": "string",
    "aws_secret_access_key": "string",
    "aws_origination_number": "string"
  },
  "twilio": {
    "twilio_account_sid": "string",
    "twilio_auth_token": "string",
    "twilio_from_number": "string"
  },
  "msg91": {
    "msg91_api_key": "string",
    "msg91_sender_id": "string",
    "msg91_flow_id": "string",
    "msg91_route": "4"
  },
  "kaleyra": {
    "kaleyra_api_key": "string",
    "kaleyra_account_sid": "string",
    "kaleyra_sender_id": "string"
  },
  "africas_talking": {
    "africas_talking_username": "string",
    "africas_talking_api_key": "string",
    "africas_talking_shortcode": "string"
  },
  "generic_http": {
    "generic_sms_endpoint": "string",
    "generic_sms_method": "POST",
    "generic_sms_auth_header_name": "string",
    "generic_sms_auth_header_value": "string",
    "generic_sms_body_template": "string"
  },
  "slack": {
    "slack_webhook_url": "string"
  }
}'''

response = requests.put(
    'http://localhost:8012/api/v1/notification/settings',
    data=body.encode('utf-8'),
    headers={
        'Authorization': 'Bearer YOUR_TOKEN',
        'Content-Type': 'application/json',
    },
)
print(response.text)
```


## Send Test Notification

`POST /api/v1/notification/test`

Authentication (security requirement alternatives):

```json
[
  {
    "HTTPBearer": []
  }
]
```

- HTTPBearer: http (bearer)

Request body: application/json (required)

Type: object

Schema: [NotificationService_TestNotificationRequest](/api-reference/schemas/notificationservice-testnotificationrequest-182b6121fa.md)

- `channel` (required)
  Type: string
  
  enum: ["email","sms","slack"]

- `recipient` (required)
  Type: string

- `subject` (optional)
  Type: unknown
  
  default: "Test Notification"
  
  anyOf:
    Type: string
  
    Type: null

- `body` (optional)
  Type: string
  
  default: "This is a test notification from MQUAD Notification Service."

Responses:

- 200: Successful Response

Content type: application/json

Type: object

Additional properties: true

- 422: Validation Error

Content type: application/json

Type: object

Schema: [NotificationService_HTTPValidationError](/api-reference/schemas/notificationservice-httpvalidationerror-89b24df40a.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [NotificationService_ValidationError](/api-reference/schemas/notificationservice-validationerror-e6abc27f21.md); Type: object

## Examples

### cURL

```bash
curl -X POST 'http://localhost:8012/api/v1/notification/test' \
  -H 'Authorization: Bearer YOUR_TOKEN' \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "channel": "email",
  "recipient": "string",
  "subject": "Test Notification",
  "body": "This is a test notification from MQUAD Notification Service."
}'
```

### JavaScript

```javascript
const body = `{
  "channel": "email",
  "recipient": "string",
  "subject": "Test Notification",
  "body": "This is a test notification from MQUAD Notification Service."
}`;

const response = await fetch('http://localhost:8012/api/v1/notification/test', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer YOUR_TOKEN',
    'Content-Type': 'application/json',
  },
  body,
});

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

### Python

```python
import requests

body = '''{
  "channel": "email",
  "recipient": "string",
  "subject": "Test Notification",
  "body": "This is a test notification from MQUAD Notification Service."
}'''

response = requests.post(
    'http://localhost:8012/api/v1/notification/test',
    data=body.encode('utf-8'),
    headers={
        'Authorization': 'Bearer YOUR_TOKEN',
        'Content-Type': 'application/json',
    },
)
print(response.text)
```


## List Notifications

`GET /api/v1/notification/history`

Authentication (security requirement alternatives):

```json
[
  {
    "HTTPBearer": []
  }
]
```

- HTTPBearer: http (bearer)

Parameters:

- `user_id` (query, unknown, optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `notification_status` (query, unknown, optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `channel` (query, unknown, optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `page` (query, integer, optional)
  Type: integer
  
  default: 1

- `page_size` (query, integer, optional)
  Type: integer
  
  default: 20

Responses:

- 200: Successful Response

Content type: application/json

Type: unknown

- 422: Validation Error

Content type: application/json

Type: object

Schema: [NotificationService_HTTPValidationError](/api-reference/schemas/notificationservice-httpvalidationerror-89b24df40a.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [NotificationService_ValidationError](/api-reference/schemas/notificationservice-validationerror-e6abc27f21.md); Type: object

## Examples

### cURL

```bash
curl -X GET 'http://localhost:8012/api/v1/notification/history?page=1&page_size=20' \
  -H 'Authorization: Bearer YOUR_TOKEN'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8012/api/v1/notification/history?page=1&page_size=20', {
  method: 'GET',
  headers: {
    'Authorization': 'Bearer YOUR_TOKEN',
  },
});

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

### Python

```python
import requests

response = requests.get(
    'http://localhost:8012/api/v1/notification/history?page=1&page_size=20',
    headers={
        'Authorization': 'Bearer YOUR_TOKEN',
    },
)
print(response.text)
```


## Cancel Notifications

`POST /api/v1/notification/cancel`

Authentication (security requirement alternatives):

```json
[
  {
    "HTTPBearer": []
  }
]
```

- HTTPBearer: http (bearer)

Request body: application/json (required)

Type: object

Schema: [NotificationService_CancelNotificationsRequest](/api-reference/schemas/notificationservice-cancelnotificationsrequest-2d6a11dc16.md)

- `recipient` (required)
  Type: string, email

Responses:

- 200: Successful Response

Content type: application/json

Type: unknown

- 422: Validation Error

Content type: application/json

Type: object

Schema: [NotificationService_HTTPValidationError](/api-reference/schemas/notificationservice-httpvalidationerror-89b24df40a.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [NotificationService_ValidationError](/api-reference/schemas/notificationservice-validationerror-e6abc27f21.md); Type: object

## Examples

### cURL

```bash
curl -X POST 'http://localhost:8012/api/v1/notification/cancel' \
  -H 'Authorization: Bearer YOUR_TOKEN' \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "recipient": "user@example.com"
}'
```

### JavaScript

```javascript
const body = `{
  "recipient": "user@example.com"
}`;

const response = await fetch('http://localhost:8012/api/v1/notification/cancel', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer YOUR_TOKEN',
    'Content-Type': 'application/json',
  },
  body,
});

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

### Python

```python
import requests

body = '''{
  "recipient": "user@example.com"
}'''

response = requests.post(
    'http://localhost:8012/api/v1/notification/cancel',
    data=body.encode('utf-8'),
    headers={
        'Authorization': 'Bearer YOUR_TOKEN',
        'Content-Type': 'application/json',
    },
)
print(response.text)
```


## Get Notification

`GET /api/v1/notification/{notification_id}`

Authentication (security requirement alternatives):

```json
[
  {
    "HTTPBearer": []
  }
]
```

- HTTPBearer: http (bearer)

Parameters:

- `notification_id` (path, string, uuid, required)
  Type: string, uuid

Responses:

- 200: Successful Response

Content type: application/json

Type: unknown

- 422: Validation Error

Content type: application/json

Type: object

Schema: [NotificationService_HTTPValidationError](/api-reference/schemas/notificationservice-httpvalidationerror-89b24df40a.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [NotificationService_ValidationError](/api-reference/schemas/notificationservice-validationerror-e6abc27f21.md); Type: object

## Examples

### cURL

```bash
curl -X GET 'http://localhost:8012/api/v1/notification/550e8400-e29b-41d4-a716-446655440000' \
  -H 'Authorization: Bearer YOUR_TOKEN'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8012/api/v1/notification/550e8400-e29b-41d4-a716-446655440000', {
  method: 'GET',
  headers: {
    'Authorization': 'Bearer YOUR_TOKEN',
  },
});

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

### Python

```python
import requests

response = requests.get(
    'http://localhost:8012/api/v1/notification/550e8400-e29b-41d4-a716-446655440000',
    headers={
        'Authorization': 'Bearer YOUR_TOKEN',
    },
)
print(response.text)
```


## List System Audit Logs

`GET /api/v1/audit/logs/system`

System-wide audit logs - for super:admin and host admin only.

SECURITY: full:access (tenant admin) is explicitly excluded. Tenant admins
must not access other tenants' audit logs. Only super:admin and
host:manage_tenants are permitted. See common/rbac_helpers.py L44.

This endpoint bypasses tenant filtering and allows viewing logs across all tenants.
Optional tenant_id_filter can be used to scope to a specific tenant.

Authentication (security requirement alternatives):

```json
[
  {
    "HTTPBearer": []
  }
]
```

- HTTPBearer: http (bearer)

Parameters:

- `service_name` (query, unknown, optional) - Filter by service name
  Type: unknown
  
  Filter by service name
  
  anyOf:
    Type: string
  
    Type: null

- `action` (query, unknown, optional) - Filter by action
  Type: unknown
  
  Filter by action
  
  anyOf:
    Type: string
  
    Type: null

- `user_id` (query, unknown, optional) - Filter by user ID
  Type: unknown
  
  Filter by user ID
  
  anyOf:
    Type: string
  
    Type: null

- `search` (query, unknown, optional) - Search activity text
  Type: unknown
  
  Search activity text
  
  anyOf:
    Type: string
    
    maxLength: 200
  
    Type: null

- `resource_type` (query, unknown, optional) - Filter by resource type
  Type: unknown
  
  Filter by resource type
  
  anyOf:
    Type: string
  
    Type: null

- `tenant_id_filter` (query, unknown, optional) - Filter by specific tenant ID
  Type: unknown
  
  Filter by specific tenant ID
  
  anyOf:
    Type: string
  
    Type: null

- `category` (query, unknown, optional) - Filter by event category
  Type: unknown
  
  Filter by event category
  
  anyOf:
    Type: string
  
    Type: null

- `date_from` (query, unknown, optional) - Filter from date (ISO format)
  Type: unknown
  
  Filter from date (ISO format)
  
  anyOf:
    Type: string
  
    Type: null

- `date_to` (query, unknown, optional) - Filter to date (ISO format)
  Type: unknown
  
  Filter to date (ISO format)
  
  anyOf:
    Type: string
  
    Type: null

- `skip` (query, integer, optional) - Row offset
  Type: integer
  
  Row offset
  
  default: 0
  
  minimum: 0

- `limit` (query, integer, optional) - Page size
  Type: integer
  
  Page size
  
  default: 50
  
  minimum: 1
  
  maximum: 500

Responses:

- 200: Successful Response

Content type: application/json

Type: object

Schema: [AuditService_AuditLogListResponse](/api-reference/schemas/auditservice-auditloglistresponse-2c9c70a444.md)

- `items` (required)
  Type: array
  
  Items:
    Reference: [AuditService_AuditLogResponse](/api-reference/schemas/auditservice-auditlogresponse-a136345fdc.md); Type: object

- `total` (required)
  Type: integer

- `skip` (required)
  Type: integer

- `limit` (required)
  Type: integer

- `has_next` (required)
  Type: boolean

- `has_previous` (required)
  Type: boolean

- 422: Validation Error

Content type: application/json

Type: object

Schema: [AuditService_HTTPValidationError](/api-reference/schemas/auditservice-httpvalidationerror-3f968f5485.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [AuditService_ValidationError](/api-reference/schemas/auditservice-validationerror-e7f58675b6.md); Type: object

## Examples

### cURL

```bash
curl -X GET 'http://localhost:8013/api/v1/audit/logs/system?skip=0&limit=50' \
  -H 'Authorization: Bearer YOUR_TOKEN'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8013/api/v1/audit/logs/system?skip=0&limit=50', {
  method: 'GET',
  headers: {
    'Authorization': 'Bearer YOUR_TOKEN',
  },
});

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

### Python

```python
import requests

response = requests.get(
    'http://localhost:8013/api/v1/audit/logs/system?skip=0&limit=50',
    headers={
        'Authorization': 'Bearer YOUR_TOKEN',
    },
)
print(response.text)
```


## Get Audit Log

`GET /api/v1/audit/logs/{log_id}`

Get a specific audit log entry by ID.

Authentication (security requirement alternatives):

```json
[
  {
    "HTTPBearer": []
  }
]
```

- HTTPBearer: http (bearer)

Parameters:

- `log_id` (path, string, required)
  Type: string

Responses:

- 200: Successful Response

Content type: application/json

Type: object

Schema: [AuditService_AuditLogResponse](/api-reference/schemas/auditservice-auditlogresponse-a136345fdc.md)

- `id` (required)
  Type: string

- `event_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `event_type` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `log_schema_version` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `service_name` (required)
  Type: string

- `action` (required)
  Type: string

- `actor_type` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `actor_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `actor_email` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `actor_name` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `tenant_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `tenant_name` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `resource_type` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `resource_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `resource_name` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `status` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `category` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `severity` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `description` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `failure_reason` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `correlation_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `ip_address` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `user_agent` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `request_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `trace_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `parent_trace_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `http_method` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `http_path` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `http_status` (optional)
  Type: unknown
  
  anyOf:
    Type: integer
  
    Type: null

- `duration_ms` (optional)
  Type: unknown
  
  anyOf:
    Type: integer
  
    Type: null

- `metadata` (optional)
  Type: unknown
  
  anyOf:
    Type: object
    
    Additional properties: true
  
    Type: null

- `data_classification` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `checksum` (required)
  Type: string

- `created_at` (required)
  Type: string

- 422: Validation Error

Content type: application/json

Type: object

Schema: [AuditService_HTTPValidationError](/api-reference/schemas/auditservice-httpvalidationerror-3f968f5485.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [AuditService_ValidationError](/api-reference/schemas/auditservice-validationerror-e7f58675b6.md); Type: object

## Examples

### cURL

```bash
curl -X GET 'http://localhost:8013/api/v1/audit/logs/string' \
  -H 'Authorization: Bearer YOUR_TOKEN'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8013/api/v1/audit/logs/string', {
  method: 'GET',
  headers: {
    'Authorization': 'Bearer YOUR_TOKEN',
  },
});

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

### Python

```python
import requests

response = requests.get(
    'http://localhost:8013/api/v1/audit/logs/string',
    headers={
        'Authorization': 'Bearer YOUR_TOKEN',
    },
)
print(response.text)
```


## Verify Chain Integrity

`GET /api/v1/audit/chain/verify`

Verify the integrity of the audit log chain.

If resource_type and resource_id are provided, verify only events for that specific resource.
Otherwise, verify the entire tenant's chain (existing behavior).

Authentication (security requirement alternatives):

```json
[
  {
    "HTTPBearer": []
  }
]
```

- HTTPBearer: http (bearer)

Parameters:

- `limit` (query, integer, optional) - Number of logs to verify
  Type: integer
  
  Number of logs to verify
  
  default: 1000
  
  minimum: 1
  
  maximum: 10000

- `resource_type` (query, unknown, optional) - Filter by resource type for targeted verification
  Type: unknown
  
  Filter by resource type for targeted verification
  
  anyOf:
    Type: string
  
    Type: null

- `resource_id` (query, unknown, optional) - Filter by resource ID for targeted verification
  Type: unknown
  
  Filter by resource ID for targeted verification
  
  anyOf:
    Type: string
  
    Type: null

Responses:

- 200: Successful Response

Content type: application/json

Type: unknown

- 422: Validation Error

Content type: application/json

Type: object

Schema: [AuditService_HTTPValidationError](/api-reference/schemas/auditservice-httpvalidationerror-3f968f5485.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [AuditService_ValidationError](/api-reference/schemas/auditservice-validationerror-e7f58675b6.md); Type: object

## Examples

### cURL

```bash
curl -X GET 'http://localhost:8013/api/v1/audit/chain/verify?limit=1000' \
  -H 'Authorization: Bearer YOUR_TOKEN'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8013/api/v1/audit/chain/verify?limit=1000', {
  method: 'GET',
  headers: {
    'Authorization': 'Bearer YOUR_TOKEN',
  },
});

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

### Python

```python
import requests

response = requests.get(
    'http://localhost:8013/api/v1/audit/chain/verify?limit=1000',
    headers={
        'Authorization': 'Bearer YOUR_TOKEN',
    },
)
print(response.text)
```


## Get Data Access Report

`GET /api/v1/audit/compliance/gdpr/data-access/{user_id}`

Get GDPR data access report for a specific user.

Authentication (security requirement alternatives):

```json
[
  {
    "HTTPBearer": []
  }
]
```

- HTTPBearer: http (bearer)

Parameters:

- `user_id` (path, string, required)
  Type: string

Responses:

- 200: Successful Response

Content type: application/json

Type: unknown

- 422: Validation Error

Content type: application/json

Type: object

Schema: [AuditService_HTTPValidationError](/api-reference/schemas/auditservice-httpvalidationerror-3f968f5485.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [AuditService_ValidationError](/api-reference/schemas/auditservice-validationerror-e7f58675b6.md); Type: object

## Examples

### cURL

```bash
curl -X GET 'http://localhost:8013/api/v1/audit/compliance/gdpr/data-access/string' \
  -H 'Authorization: Bearer YOUR_TOKEN'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8013/api/v1/audit/compliance/gdpr/data-access/string', {
  method: 'GET',
  headers: {
    'Authorization': 'Bearer YOUR_TOKEN',
  },
});

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

### Python

```python
import requests

response = requests.get(
    'http://localhost:8013/api/v1/audit/compliance/gdpr/data-access/string',
    headers={
        'Authorization': 'Bearer YOUR_TOKEN',
    },
)
print(response.text)
```


## Record Consent

`POST /api/v1/audit/compliance/consent`

Record or update a consent decision for a user.

Authentication (security requirement alternatives):

```json
[
  {
    "HTTPBearer": []
  }
]
```

- HTTPBearer: http (bearer)

Request body: application/json (required)

Type: object

Schema: [AuditService_ConsentRecordRequest](/api-reference/schemas/auditservice-consentrecordrequest-5e6c8467ca.md)

- `user_id` (required)
  Type: string

- `consent_type` (required)
  Type: string

- `is_granted` (required)
  Type: boolean

- `ip_address` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `metadata` (optional)
  Type: unknown
  
  anyOf:
    Type: object
    
    Additional properties: true
  
    Type: null

Responses:

- 201: Successful Response

Content type: application/json

Type: object

Schema: [AuditService_ConsentRecordResponse](/api-reference/schemas/auditservice-consentrecordresponse-e946da96db.md)

- `id` (required)
  Type: string

- `user_id` (required)
  Type: string

- `consent_type` (required)
  Type: string

- `is_granted` (required)
  Type: boolean

- `granted_at` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `revoked_at` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `created_at` (required)
  Type: string

- 422: Validation Error

Content type: application/json

Type: object

Schema: [AuditService_HTTPValidationError](/api-reference/schemas/auditservice-httpvalidationerror-3f968f5485.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [AuditService_ValidationError](/api-reference/schemas/auditservice-validationerror-e7f58675b6.md); Type: object

## Examples

### cURL

```bash
curl -X POST 'http://localhost:8013/api/v1/audit/compliance/consent' \
  -H 'Authorization: Bearer YOUR_TOKEN' \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "user_id": "string",
  "consent_type": "string",
  "is_granted": true,
  "ip_address": "string",
  "metadata": {}
}'
```

### JavaScript

```javascript
const body = `{
  "user_id": "string",
  "consent_type": "string",
  "is_granted": true,
  "ip_address": "string",
  "metadata": {}
}`;

const response = await fetch('http://localhost:8013/api/v1/audit/compliance/consent', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer YOUR_TOKEN',
    'Content-Type': 'application/json',
  },
  body,
});

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

### Python

```python
import requests

body = '''{
  "user_id": "string",
  "consent_type": "string",
  "is_granted": true,
  "ip_address": "string",
  "metadata": {}
}'''

response = requests.post(
    'http://localhost:8013/api/v1/audit/compliance/consent',
    data=body.encode('utf-8'),
    headers={
        'Authorization': 'Bearer YOUR_TOKEN',
        'Content-Type': 'application/json',
    },
)
print(response.text)
```


## Get User Consents

`GET /api/v1/audit/compliance/consent/{user_id}`

Get all consent records for a specific user.

Authentication (security requirement alternatives):

```json
[
  {
    "HTTPBearer": []
  }
]
```

- HTTPBearer: http (bearer)

Parameters:

- `user_id` (path, string, required)
  Type: string

Responses:

- 200: Successful Response

Content type: application/json

Type: array

Items:
  Reference: [AuditService_ConsentRecordResponse](/api-reference/schemas/auditservice-consentrecordresponse-e946da96db.md); Type: object

- 422: Validation Error

Content type: application/json

Type: object

Schema: [AuditService_HTTPValidationError](/api-reference/schemas/auditservice-httpvalidationerror-3f968f5485.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [AuditService_ValidationError](/api-reference/schemas/auditservice-validationerror-e7f58675b6.md); Type: object

## Examples

### cURL

```bash
curl -X GET 'http://localhost:8013/api/v1/audit/compliance/consent/string' \
  -H 'Authorization: Bearer YOUR_TOKEN'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8013/api/v1/audit/compliance/consent/string', {
  method: 'GET',
  headers: {
    'Authorization': 'Bearer YOUR_TOKEN',
  },
});

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

### Python

```python
import requests

response = requests.get(
    'http://localhost:8013/api/v1/audit/compliance/consent/string',
    headers={
        'Authorization': 'Bearer YOUR_TOKEN',
    },
)
print(response.text)
```


## Export Audit Logs

`POST /api/v1/audit/export`

Export audit logs in the specified format (json or csv).

Enforces a maximum of 50,000 records. Use date filtering to narrow the range
when the export exceeds this limit.

Authentication (security requirement alternatives):

```json
[
  {
    "HTTPBearer": []
  }
]
```

- HTTPBearer: http (bearer)

Parameters:

- `format` (query, string, optional) - Export format: json or csv
  Type: string
  
  Export format: json or csv
  
  default: "json"

- `service_name` (query, unknown, optional) - Filter by service name
  Type: unknown
  
  Filter by service name
  
  anyOf:
    Type: string
  
    Type: null

- `action` (query, unknown, optional) - Filter by action
  Type: unknown
  
  Filter by action
  
  anyOf:
    Type: string
  
    Type: null

- `user_id` (query, unknown, optional) - Filter by user ID
  Type: unknown
  
  Filter by user ID
  
  anyOf:
    Type: string
  
    Type: null

- `resource_type` (query, unknown, optional) - Filter by resource type
  Type: unknown
  
  Filter by resource type
  
  anyOf:
    Type: string
  
    Type: null

- `date_from` (query, unknown, optional) - Filter from date (ISO format)
  Type: unknown
  
  Filter from date (ISO format)
  
  anyOf:
    Type: string
  
    Type: null

- `date_to` (query, unknown, optional) - Filter to date (ISO format)
  Type: unknown
  
  Filter to date (ISO format)
  
  anyOf:
    Type: string
  
    Type: null

Responses:

- 200: Successful Response

Content type: application/json

Type: unknown

- 422: Validation Error

Content type: application/json

Type: object

Schema: [AuditService_HTTPValidationError](/api-reference/schemas/auditservice-httpvalidationerror-3f968f5485.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [AuditService_ValidationError](/api-reference/schemas/auditservice-validationerror-e7f58675b6.md); Type: object

## Examples

### cURL

```bash
curl -X POST 'http://localhost:8013/api/v1/audit/export?format=json' \
  -H 'Authorization: Bearer YOUR_TOKEN'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8013/api/v1/audit/export?format=json', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer YOUR_TOKEN',
  },
});

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

### Python

```python
import requests

response = requests.post(
    'http://localhost:8013/api/v1/audit/export?format=json',
    headers={
        'Authorization': 'Bearer YOUR_TOKEN',
    },
)
print(response.text)
```


## Invalidate Tenant Plan Context

`POST /internal/tenants/{tenant_id}/plan-context/invalidate`

Internal endpoint: invalidate the cached plan context for a single tenant.

Used by backend service after Stripe webhook processing commits subscription
state changes, ensuring entitlement propagation with minimal delay.

Authentication: X-Internal-Service header must equal "backend" and
X-Service-Token must match the FEATURE_FLAGS_SERVICE_TOKEN.

Returns success even when no cache entry exists.

Authentication: no security requirement declared for this operation.

Parameters:

- `tenant_id` (path, string, required)
  Type: string

Responses:

- 200: Successful Response

Content type: application/json

Type: object

Schema: [FeatureFlagsService_InvalidateResponse](/api-reference/schemas/featureflagsservice-invalidateresponse-0a5b67a609.md)

- `tenant_id` (required)
  Type: string

- `invalidated` (required)
  Type: boolean

- `message` (required)
  Type: string

- 422: Validation Error

Content type: application/json

Type: object

Schema: [FeatureFlagsService_HTTPValidationError](/api-reference/schemas/featureflagsservice-httpvalidationerror-323f73e647.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [FeatureFlagsService_ValidationError](/api-reference/schemas/featureflagsservice-validationerror-8a86fa3019.md); Type: object

## Examples

### cURL

```bash
curl -X POST 'http://localhost:8014/internal/tenants/string/plan-context/invalidate'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8014/internal/tenants/string/plan-context/invalidate', {
  method: 'POST',
});

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

### Python

```python
import requests

response = requests.post('http://localhost:8014/internal/tenants/string/plan-context/invalidate')
print(response.text)
```


## List Flags

`GET /api/v1/flags`

List all feature flags with pagination. Requires feature_flag:read.

Authentication (security requirement alternatives):

```json
[
  {
    "HTTPBearer": []
  }
]
```

- HTTPBearer: http (bearer)

Parameters:

- `skip` (query, integer, optional)
  Type: integer
  
  default: 0
  
  minimum: 0

- `limit` (query, integer, optional)
  Type: integer
  
  default: 20
  
  minimum: 1
  
  maximum: 100

Responses:

- 200: Successful Response

Content type: application/json

Type: object

Schema: [FeatureFlagsService_FlagListResponse](/api-reference/schemas/featureflagsservice-flaglistresponse-3b98034a38.md)

- `items` (required)
  Type: array
  
  Items:
    Reference: [FeatureFlagsService_FlagResponse](/api-reference/schemas/featureflagsservice-flagresponse-0b1ca4f946.md); Type: object

- `total` (required)
  Type: integer

- `skip` (required)
  Type: integer

- `limit` (required)
  Type: integer

- `has_next` (required)
  Type: boolean

- `has_previous` (required)
  Type: boolean

- 422: Validation Error

Content type: application/json

Type: object

Schema: [FeatureFlagsService_HTTPValidationError](/api-reference/schemas/featureflagsservice-httpvalidationerror-323f73e647.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [FeatureFlagsService_ValidationError](/api-reference/schemas/featureflagsservice-validationerror-8a86fa3019.md); Type: object

## Examples

### cURL

```bash
curl -X GET 'http://localhost:8014/api/v1/flags?skip=0&limit=20' \
  -H 'Authorization: Bearer YOUR_TOKEN'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8014/api/v1/flags?skip=0&limit=20', {
  method: 'GET',
  headers: {
    'Authorization': 'Bearer YOUR_TOKEN',
  },
});

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

### Python

```python
import requests

response = requests.get(
    'http://localhost:8014/api/v1/flags?skip=0&limit=20',
    headers={
        'Authorization': 'Bearer YOUR_TOKEN',
    },
)
print(response.text)
```


## Create Flag

`POST /api/v1/flags`

Create a new feature flag. Requires feature_flag:create.

Authentication (security requirement alternatives):

```json
[
  {
    "HTTPBearer": []
  }
]
```

- HTTPBearer: http (bearer)

Request body: application/json (required)

Type: object

Schema: [FeatureFlagsService_FlagCreateRequest](/api-reference/schemas/featureflagsservice-flagcreaterequest-7e586dac33.md)

- `key` (required)
  Type: string

- `name` (required)
  Type: string

- `description` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `flag_type` (optional)
  Type: string
  
  default: "boolean"

- `default_value` (optional)
  Type: unknown
  
  default: false

- `is_enabled` (optional)
  Type: boolean
  
  default: true

- `tags` (optional)
  Type: unknown
  
  anyOf:
    Type: array
    
    Items:
      Type: string
  
    Type: null

- `environment` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `plan_tier` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `feature_category` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

Responses:

- 201: Successful Response

Content type: application/json

Type: object

Schema: [FeatureFlagsService_FlagResponse](/api-reference/schemas/featureflagsservice-flagresponse-0b1ca4f946.md)

- `id` (required)
  Type: string

- `key` (required)
  Type: string

- `name` (required)
  Type: string

- `description` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `flag_type` (required)
  Type: string

- `default_value` (required)
  Type: unknown

- `is_enabled` (required)
  Type: boolean

- `is_archived` (required)
  Type: boolean

- `tags` (required)
  Type: array
  
  Items:
    Type: string

- `evaluation_count` (required)
  Type: integer

- `last_evaluated_at` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `created_at` (required)
  Type: string

- `updated_at` (required)
  Type: string

- `plan_tier` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `feature_category` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- 422: Validation Error

Content type: application/json

Type: object

Schema: [FeatureFlagsService_HTTPValidationError](/api-reference/schemas/featureflagsservice-httpvalidationerror-323f73e647.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [FeatureFlagsService_ValidationError](/api-reference/schemas/featureflagsservice-validationerror-8a86fa3019.md); Type: object

## Examples

### cURL

```bash
curl -X POST 'http://localhost:8014/api/v1/flags' \
  -H 'Authorization: Bearer YOUR_TOKEN' \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "key": "string",
  "name": "string",
  "description": "string",
  "flag_type": "boolean",
  "default_value": false,
  "is_enabled": true,
  "tags": [
    "string"
  ],
  "environment": "string",
  "plan_tier": "string",
  "feature_category": "string"
}'
```

### JavaScript

```javascript
const body = `{
  "key": "string",
  "name": "string",
  "description": "string",
  "flag_type": "boolean",
  "default_value": false,
  "is_enabled": true,
  "tags": [
    "string"
  ],
  "environment": "string",
  "plan_tier": "string",
  "feature_category": "string"
}`;

const response = await fetch('http://localhost:8014/api/v1/flags', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer YOUR_TOKEN',
    'Content-Type': 'application/json',
  },
  body,
});

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

### Python

```python
import requests

body = '''{
  "key": "string",
  "name": "string",
  "description": "string",
  "flag_type": "boolean",
  "default_value": false,
  "is_enabled": true,
  "tags": [
    "string"
  ],
  "environment": "string",
  "plan_tier": "string",
  "feature_category": "string"
}'''

response = requests.post(
    'http://localhost:8014/api/v1/flags',
    data=body.encode('utf-8'),
    headers={
        'Authorization': 'Bearer YOUR_TOKEN',
        'Content-Type': 'application/json',
    },
)
print(response.text)
```


## Get Flag

`GET /api/v1/flags/{flag_key}`

Get a feature flag by key. Requires feature_flag:read.

Authentication (security requirement alternatives):

```json
[
  {
    "HTTPBearer": []
  }
]
```

- HTTPBearer: http (bearer)

Parameters:

- `flag_key` (path, string, required)
  Type: string

Responses:

- 200: Successful Response

Content type: application/json

Type: object

Schema: [FeatureFlagsService_FlagResponse](/api-reference/schemas/featureflagsservice-flagresponse-0b1ca4f946.md)

- `id` (required)
  Type: string

- `key` (required)
  Type: string

- `name` (required)
  Type: string

- `description` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `flag_type` (required)
  Type: string

- `default_value` (required)
  Type: unknown

- `is_enabled` (required)
  Type: boolean

- `is_archived` (required)
  Type: boolean

- `tags` (required)
  Type: array
  
  Items:
    Type: string

- `evaluation_count` (required)
  Type: integer

- `last_evaluated_at` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `created_at` (required)
  Type: string

- `updated_at` (required)
  Type: string

- `plan_tier` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `feature_category` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- 422: Validation Error

Content type: application/json

Type: object

Schema: [FeatureFlagsService_HTTPValidationError](/api-reference/schemas/featureflagsservice-httpvalidationerror-323f73e647.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [FeatureFlagsService_ValidationError](/api-reference/schemas/featureflagsservice-validationerror-8a86fa3019.md); Type: object

## Examples

### cURL

```bash
curl -X GET 'http://localhost:8014/api/v1/flags/string' \
  -H 'Authorization: Bearer YOUR_TOKEN'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8014/api/v1/flags/string', {
  method: 'GET',
  headers: {
    'Authorization': 'Bearer YOUR_TOKEN',
  },
});

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

### Python

```python
import requests

response = requests.get(
    'http://localhost:8014/api/v1/flags/string',
    headers={
        'Authorization': 'Bearer YOUR_TOKEN',
    },
)
print(response.text)
```


## Update Flag

`PUT /api/v1/flags/{flag_key}`

Update a feature flag. Requires feature_flag:update.

Authentication (security requirement alternatives):

```json
[
  {
    "HTTPBearer": []
  }
]
```

- HTTPBearer: http (bearer)

Parameters:

- `flag_key` (path, string, required)
  Type: string

Request body: application/json (required)

Type: object

Schema: [FeatureFlagsService_FlagUpdateRequest](/api-reference/schemas/featureflagsservice-flagupdaterequest-57720e5cb6.md)

- `name` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `description` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `default_value` (optional)
  Type: unknown
  
  anyOf:
    Type: unknown
  
    Type: null

- `is_enabled` (optional)
  Type: unknown
  
  anyOf:
    Type: boolean
  
    Type: null

- `tags` (optional)
  Type: unknown
  
  anyOf:
    Type: array
    
    Items:
      Type: string
  
    Type: null

- `plan_tier` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `feature_category` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

Responses:

- 200: Successful Response

Content type: application/json

Type: object

Schema: [FeatureFlagsService_FlagResponse](/api-reference/schemas/featureflagsservice-flagresponse-0b1ca4f946.md)

- `id` (required)
  Type: string

- `key` (required)
  Type: string

- `name` (required)
  Type: string

- `description` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `flag_type` (required)
  Type: string

- `default_value` (required)
  Type: unknown

- `is_enabled` (required)
  Type: boolean

- `is_archived` (required)
  Type: boolean

- `tags` (required)
  Type: array
  
  Items:
    Type: string

- `evaluation_count` (required)
  Type: integer

- `last_evaluated_at` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `created_at` (required)
  Type: string

- `updated_at` (required)
  Type: string

- `plan_tier` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `feature_category` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- 422: Validation Error

Content type: application/json

Type: object

Schema: [FeatureFlagsService_HTTPValidationError](/api-reference/schemas/featureflagsservice-httpvalidationerror-323f73e647.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [FeatureFlagsService_ValidationError](/api-reference/schemas/featureflagsservice-validationerror-8a86fa3019.md); Type: object

## Examples

### cURL

```bash
curl -X PUT 'http://localhost:8014/api/v1/flags/string' \
  -H 'Authorization: Bearer YOUR_TOKEN' \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "name": "string",
  "description": "string",
  "is_enabled": true,
  "tags": [
    "string"
  ],
  "plan_tier": "string",
  "feature_category": "string"
}'
```

### JavaScript

```javascript
const body = `{
  "name": "string",
  "description": "string",
  "is_enabled": true,
  "tags": [
    "string"
  ],
  "plan_tier": "string",
  "feature_category": "string"
}`;

const response = await fetch('http://localhost:8014/api/v1/flags/string', {
  method: 'PUT',
  headers: {
    'Authorization': 'Bearer YOUR_TOKEN',
    'Content-Type': 'application/json',
  },
  body,
});

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

### Python

```python
import requests

body = '''{
  "name": "string",
  "description": "string",
  "is_enabled": true,
  "tags": [
    "string"
  ],
  "plan_tier": "string",
  "feature_category": "string"
}'''

response = requests.put(
    'http://localhost:8014/api/v1/flags/string',
    data=body.encode('utf-8'),
    headers={
        'Authorization': 'Bearer YOUR_TOKEN',
        'Content-Type': 'application/json',
    },
)
print(response.text)
```


## Delete Flag

`DELETE /api/v1/flags/{flag_key}`

Delete a feature flag and all associated rules/evaluations. Requires feature_flag:delete.

Authentication (security requirement alternatives):

```json
[
  {
    "HTTPBearer": []
  }
]
```

- HTTPBearer: http (bearer)

Parameters:

- `flag_key` (path, string, required)
  Type: string

Responses:

- 200: Successful Response

Content type: application/json

Type: unknown

- 422: Validation Error

Content type: application/json

Type: object

Schema: [FeatureFlagsService_HTTPValidationError](/api-reference/schemas/featureflagsservice-httpvalidationerror-323f73e647.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [FeatureFlagsService_ValidationError](/api-reference/schemas/featureflagsservice-validationerror-8a86fa3019.md); Type: object

## Examples

### cURL

```bash
curl -X DELETE 'http://localhost:8014/api/v1/flags/string' \
  -H 'Authorization: Bearer YOUR_TOKEN'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8014/api/v1/flags/string', {
  method: 'DELETE',
  headers: {
    'Authorization': 'Bearer YOUR_TOKEN',
  },
});

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

### Python

```python
import requests

response = requests.delete(
    'http://localhost:8014/api/v1/flags/string',
    headers={
        'Authorization': 'Bearer YOUR_TOKEN',
    },
)
print(response.text)
```


## Toggle Flag

`POST /api/v1/flags/{flag_key}/toggle`

Toggle a feature flag's enabled state. Requires feature_flag:toggle.

Authentication (security requirement alternatives):

```json
[
  {
    "HTTPBearer": []
  }
]
```

- HTTPBearer: http (bearer)

Parameters:

- `flag_key` (path, string, required)
  Type: string

Responses:

- 200: Successful Response

Content type: application/json

Type: object

Schema: [FeatureFlagsService_FlagResponse](/api-reference/schemas/featureflagsservice-flagresponse-0b1ca4f946.md)

- `id` (required)
  Type: string

- `key` (required)
  Type: string

- `name` (required)
  Type: string

- `description` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `flag_type` (required)
  Type: string

- `default_value` (required)
  Type: unknown

- `is_enabled` (required)
  Type: boolean

- `is_archived` (required)
  Type: boolean

- `tags` (required)
  Type: array
  
  Items:
    Type: string

- `evaluation_count` (required)
  Type: integer

- `last_evaluated_at` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `created_at` (required)
  Type: string

- `updated_at` (required)
  Type: string

- `plan_tier` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `feature_category` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- 422: Validation Error

Content type: application/json

Type: object

Schema: [FeatureFlagsService_HTTPValidationError](/api-reference/schemas/featureflagsservice-httpvalidationerror-323f73e647.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [FeatureFlagsService_ValidationError](/api-reference/schemas/featureflagsservice-validationerror-8a86fa3019.md); Type: object

## Examples

### cURL

```bash
curl -X POST 'http://localhost:8014/api/v1/flags/string/toggle' \
  -H 'Authorization: Bearer YOUR_TOKEN'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8014/api/v1/flags/string/toggle', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer YOUR_TOKEN',
  },
});

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

### Python

```python
import requests

response = requests.post(
    'http://localhost:8014/api/v1/flags/string/toggle',
    headers={
        'Authorization': 'Bearer YOUR_TOKEN',
    },
)
print(response.text)
```


## Archive Flag

`POST /api/v1/flags/{flag_key}/archive`

Archive a feature flag (disables and hides from list). Requires feature_flag:update.

Archive has no verb of its own in the catalog. It is mapped to `update`
rather than `delete` because it is reversible -- the flag row and its rules
survive, and only the archived state changes.

Authentication (security requirement alternatives):

```json
[
  {
    "HTTPBearer": []
  }
]
```

- HTTPBearer: http (bearer)

Parameters:

- `flag_key` (path, string, required)
  Type: string

Responses:

- 200: Successful Response

Content type: application/json

Type: object

Schema: [FeatureFlagsService_FlagResponse](/api-reference/schemas/featureflagsservice-flagresponse-0b1ca4f946.md)

- `id` (required)
  Type: string

- `key` (required)
  Type: string

- `name` (required)
  Type: string

- `description` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `flag_type` (required)
  Type: string

- `default_value` (required)
  Type: unknown

- `is_enabled` (required)
  Type: boolean

- `is_archived` (required)
  Type: boolean

- `tags` (required)
  Type: array
  
  Items:
    Type: string

- `evaluation_count` (required)
  Type: integer

- `last_evaluated_at` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `created_at` (required)
  Type: string

- `updated_at` (required)
  Type: string

- `plan_tier` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `feature_category` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- 422: Validation Error

Content type: application/json

Type: object

Schema: [FeatureFlagsService_HTTPValidationError](/api-reference/schemas/featureflagsservice-httpvalidationerror-323f73e647.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [FeatureFlagsService_ValidationError](/api-reference/schemas/featureflagsservice-validationerror-8a86fa3019.md); Type: object

## Examples

### cURL

```bash
curl -X POST 'http://localhost:8014/api/v1/flags/string/archive' \
  -H 'Authorization: Bearer YOUR_TOKEN'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8014/api/v1/flags/string/archive', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer YOUR_TOKEN',
  },
});

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

### Python

```python
import requests

response = requests.post(
    'http://localhost:8014/api/v1/flags/string/archive',
    headers={
        'Authorization': 'Bearer YOUR_TOKEN',
    },
)
print(response.text)
```


## Evaluate Flag

`POST /api/v1/evaluate`

Evaluate a single feature flag against the provided context.

Authentication (security requirement alternatives):

```json
[
  {
    "HTTPBearer": []
  }
]
```

- HTTPBearer: http (bearer)

Request body: application/json (required)

Type: object

Schema: [FeatureFlagsService_EvaluateRequest](/api-reference/schemas/featureflagsservice-evaluaterequest-7fe3d20a3e.md)

- `flag_key` (required)
  Type: string

- `context` (optional)
  Type: unknown
  
  anyOf:
    Type: object
    
    Additional properties: true
  
    Type: null

Responses:

- 200: Successful Response

Content type: application/json

Type: object

Schema: [FeatureFlagsService_EvaluateResponse](/api-reference/schemas/featureflagsservice-evaluateresponse-67c5746a2d.md)

- `flag_key` (required)
  Type: string

- `value` (required)
  Type: unknown

- `is_enabled` (required)
  Type: boolean

- `matched_rule` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- 422: Validation Error

Content type: application/json

Type: object

Schema: [FeatureFlagsService_HTTPValidationError](/api-reference/schemas/featureflagsservice-httpvalidationerror-323f73e647.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [FeatureFlagsService_ValidationError](/api-reference/schemas/featureflagsservice-validationerror-8a86fa3019.md); Type: object

## Examples

### cURL

```bash
curl -X POST 'http://localhost:8014/api/v1/evaluate' \
  -H 'Authorization: Bearer YOUR_TOKEN' \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "flag_key": "string",
  "context": {}
}'
```

### JavaScript

```javascript
const body = `{
  "flag_key": "string",
  "context": {}
}`;

const response = await fetch('http://localhost:8014/api/v1/evaluate', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer YOUR_TOKEN',
    'Content-Type': 'application/json',
  },
  body,
});

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

### Python

```python
import requests

body = '''{
  "flag_key": "string",
  "context": {}
}'''

response = requests.post(
    'http://localhost:8014/api/v1/evaluate',
    data=body.encode('utf-8'),
    headers={
        'Authorization': 'Bearer YOUR_TOKEN',
        'Content-Type': 'application/json',
    },
)
print(response.text)
```


## Evaluate Batch

`POST /api/v1/evaluate/batch`

Evaluate multiple feature flags in a single request.

Authentication (security requirement alternatives):

```json
[
  {
    "HTTPBearer": []
  }
]
```

- HTTPBearer: http (bearer)

Request body: application/json (required)

Type: object

Schema: [FeatureFlagsService_BatchEvaluateRequest](/api-reference/schemas/featureflagsservice-batchevaluaterequest-49691e6feb.md)

- `flags` (required)
  Type: array
  
  Items:
    Reference: [FeatureFlagsService_EvaluateRequest](/api-reference/schemas/featureflagsservice-evaluaterequest-7fe3d20a3e.md); Type: object

Responses:

- 200: Successful Response

Content type: application/json

Type: object

Schema: [FeatureFlagsService_BatchEvaluateResponse](/api-reference/schemas/featureflagsservice-batchevaluateresponse-947d9945a9.md)

- `results` (required)
  Type: array
  
  Items:
    Reference: [FeatureFlagsService_EvaluateResponse](/api-reference/schemas/featureflagsservice-evaluateresponse-67c5746a2d.md); Type: object

- 422: Validation Error

Content type: application/json

Type: object

Schema: [FeatureFlagsService_HTTPValidationError](/api-reference/schemas/featureflagsservice-httpvalidationerror-323f73e647.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [FeatureFlagsService_ValidationError](/api-reference/schemas/featureflagsservice-validationerror-8a86fa3019.md); Type: object

## Examples

### cURL

```bash
curl -X POST 'http://localhost:8014/api/v1/evaluate/batch' \
  -H 'Authorization: Bearer YOUR_TOKEN' \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "flags": [
    {
      "flag_key": "string",
      "context": {}
    }
  ]
}'
```

### JavaScript

```javascript
const body = `{
  "flags": [
    {
      "flag_key": "string",
      "context": {}
    }
  ]
}`;

const response = await fetch('http://localhost:8014/api/v1/evaluate/batch', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer YOUR_TOKEN',
    'Content-Type': 'application/json',
  },
  body,
});

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

### Python

```python
import requests

body = '''{
  "flags": [
    {
      "flag_key": "string",
      "context": {}
    }
  ]
}'''

response = requests.post(
    'http://localhost:8014/api/v1/evaluate/batch',
    data=body.encode('utf-8'),
    headers={
        'Authorization': 'Bearer YOUR_TOKEN',
        'Content-Type': 'application/json',
    },
)
print(response.text)
```


## List Plans

`GET /api/v1/plans`

List all available subscription plans and their features.

Authentication: no security requirement declared for this operation.

Responses:

- 200: Successful Response

Content type: application/json

Type: object

Schema: [FeatureFlagsService_PlanListResponse](/api-reference/schemas/featureflagsservice-planlistresponse-627f656d5c.md)

- `items` (required)
  Type: array
  
  Items:
    Reference: [FeatureFlagsService_PlanDto](/api-reference/schemas/featureflagsservice-plandto-c31934468f.md); Type: object

## Examples

### cURL

```bash
curl -X GET 'http://localhost:8014/api/v1/plans'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8014/api/v1/plans', {
  method: 'GET',
});

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

### Python

```python
import requests

response = requests.get('http://localhost:8014/api/v1/plans')
print(response.text)
```


## Get Entitlement Catalogue

`GET /api/v1/plans/catalogue`

Return the canonical Phase 2 entitlement catalogue metadata.

Authentication: no security requirement declared for this operation.

Responses:

- 200: Successful Response

Content type: application/json

Type: object

Schema: [FeatureFlagsService_EntitlementCatalogueResponse](/api-reference/schemas/featureflagsservice-entitlementcatalogueresponse-db77f3cc05.md)

- `items` (required)
  Type: array
  
  Items:
    Reference: [FeatureFlagsService_EntitlementCatalogueItem](/api-reference/schemas/featureflagsservice-entitlementcatalogueitem-00de5604a9.md); Type: object

## Examples

### cURL

```bash
curl -X GET 'http://localhost:8014/api/v1/plans/catalogue'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8014/api/v1/plans/catalogue', {
  method: 'GET',
});

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

### Python

```python
import requests

response = requests.get('http://localhost:8014/api/v1/plans/catalogue')
print(response.text)
```


## Get Plan

`GET /api/v1/plans/{tier}`

Get details for a specific plan tier.

Authentication: no security requirement declared for this operation.

Parameters:

- `tier` (path, string, required)
  Type: string

Responses:

- 200: Successful Response

Content type: application/json

Type: object

Schema: [FeatureFlagsService_PlanDto](/api-reference/schemas/featureflagsservice-plandto-c31934468f.md)

- `id` (required)
  Type: string

- `name` (required)
  Type: string

- `description` (required)
  Type: string

- `price_id` (required)
  Type: string

- `amount` (required)
  Type: number

- `currency` (required)
  Type: string

- `interval` (required)
  Type: string

- `features` (required)
  Type: array
  
  Items:
    Reference: [FeatureFlagsService_PlanFeatureDto](/api-reference/schemas/featureflagsservice-planfeaturedto-afc9543684.md); Type: object

- `limits` (optional)
  Type: array
  
  Items:
    Reference: [FeatureFlagsService_PlanLimitDto](/api-reference/schemas/featureflagsservice-planlimitdto-e61d1af0e6.md); Type: object

- 422: Validation Error

Content type: application/json

Type: object

Schema: [FeatureFlagsService_HTTPValidationError](/api-reference/schemas/featureflagsservice-httpvalidationerror-323f73e647.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [FeatureFlagsService_ValidationError](/api-reference/schemas/featureflagsservice-validationerror-8a86fa3019.md); Type: object

## Examples

### cURL

```bash
curl -X GET 'http://localhost:8014/api/v1/plans/string'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8014/api/v1/plans/string', {
  method: 'GET',
});

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

### Python

```python
import requests

response = requests.get('http://localhost:8014/api/v1/plans/string')
print(response.text)
```


## Get Tenant Plan Tier

`GET /api/v1/plans/{tenant_id}/tier`

Get plan tier for a tenant. Looks up from backend API.

Authentication: no security requirement declared for this operation.

Parameters:

- `tenant_id` (path, string, required)
  Type: string

Responses:

- 200: Successful Response

Content type: application/json

Type: object

Additional properties: true

- 422: Validation Error

Content type: application/json

Type: object

Schema: [FeatureFlagsService_HTTPValidationError](/api-reference/schemas/featureflagsservice-httpvalidationerror-323f73e647.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [FeatureFlagsService_ValidationError](/api-reference/schemas/featureflagsservice-validationerror-8a86fa3019.md); Type: object

## Examples

### cURL

```bash
curl -X GET 'http://localhost:8014/api/v1/plans/string/tier'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8014/api/v1/plans/string/tier', {
  method: 'GET',
});

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

### Python

```python
import requests

response = requests.get('http://localhost:8014/api/v1/plans/string/tier')
print(response.text)
```


## Get Tenant Limits

`GET /api/v1/plans/{tenant_id}/limits`

Get limits for a tenant.

Returns limit values based on tenant's plan tier.
Used by quota-service and plan-enforcement-sdk.

Authentication: no security requirement declared for this operation.

Parameters:

- `tenant_id` (path, string, required)
  Type: string

Responses:

- 200: Successful Response

Content type: application/json

Type: object

Schema: [FeatureFlagsService_TenantLimitsResponse](/api-reference/schemas/featureflagsservice-tenantlimitsresponse-29dca159bc.md)

- `items` (required)
  Type: array
  
  Items:
    Type: object
    
    Additional properties: true

- `tier` (required)
  Type: string

- `tenant_id` (required)
  Type: string

- 422: Validation Error

Content type: application/json

Type: object

Schema: [FeatureFlagsService_HTTPValidationError](/api-reference/schemas/featureflagsservice-httpvalidationerror-323f73e647.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [FeatureFlagsService_ValidationError](/api-reference/schemas/featureflagsservice-validationerror-8a86fa3019.md); Type: object

## Examples

### cURL

```bash
curl -X GET 'http://localhost:8014/api/v1/plans/string/limits'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8014/api/v1/plans/string/limits', {
  method: 'GET',
});

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

### Python

```python
import requests

response = requests.get('http://localhost:8014/api/v1/plans/string/limits')
print(response.text)
```


## Get Tenant Features

`GET /api/v1/plans/{tenant_id}/features`

Get feature flags for a tenant.

Returns boolean feature flags based on tenant's plan tier.
Used by plan-enforcement-sdk for feature gate checks.

Authentication: no security requirement declared for this operation.

Parameters:

- `tenant_id` (path, string, required)
  Type: string

Responses:

- 200: Successful Response

Content type: application/json

Type: object

Schema: [FeatureFlagsService_TenantFeaturesResponse](/api-reference/schemas/featureflagsservice-tenantfeaturesresponse-5556aaa956.md)

- `items` (required)
  Type: array
  
  Items:
    Type: object
    
    Additional properties: true

- `tier` (required)
  Type: string

- 422: Validation Error

Content type: application/json

Type: object

Schema: [FeatureFlagsService_HTTPValidationError](/api-reference/schemas/featureflagsservice-httpvalidationerror-323f73e647.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [FeatureFlagsService_ValidationError](/api-reference/schemas/featureflagsservice-validationerror-8a86fa3019.md); Type: object

## Examples

### cURL

```bash
curl -X GET 'http://localhost:8014/api/v1/plans/string/features'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8014/api/v1/plans/string/features', {
  method: 'GET',
});

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

### Python

```python
import requests

response = requests.get('http://localhost:8014/api/v1/plans/string/features')
print(response.text)
```


## Get Tenant Entitlements

`GET /api/v1/plans/{tenant_id}/entitlements`

Get normalized plan limits, feature entitlements, and subscription state.

Authentication: no security requirement declared for this operation.

Parameters:

- `tenant_id` (path, string, required)
  Type: string

Responses:

- 200: Successful Response

Content type: application/json

Type: object

Schema: [FeatureFlagsService_TenantEntitlementsResponse](/api-reference/schemas/featureflagsservice-tenantentitlementsresponse-e6fe4f0451.md)

- `tenant_id` (required)
  Type: string

- `tier` (required)
  Type: string

- `subscription_status` (required)
  Type: string

- `active` (required)
  Type: boolean

- `trial` (required)
  Type: boolean

- `trial_end_at` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `dormant` (required)
  Type: boolean

- `limits` (required)
  Type: array
  
  Items:
    Reference: [FeatureFlagsService_LimitItem](/api-reference/schemas/featureflagsservice-limititem-03bc0c04f8.md); Type: object

- `features` (required)
  Type: array
  
  Items:
    Type: object
    
    Additional properties: true

- 422: Validation Error

Content type: application/json

Type: object

Schema: [FeatureFlagsService_HTTPValidationError](/api-reference/schemas/featureflagsservice-httpvalidationerror-323f73e647.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [FeatureFlagsService_ValidationError](/api-reference/schemas/featureflagsservice-validationerror-8a86fa3019.md); Type: object

## Examples

### cURL

```bash
curl -X GET 'http://localhost:8014/api/v1/plans/string/entitlements'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:8014/api/v1/plans/string/entitlements', {
  method: 'GET',
});

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

### Python

```python
import requests

response = requests.get('http://localhost:8014/api/v1/plans/string/entitlements')
print(response.text)
```


## Check Limit

`POST /api/v1/quota/check`

Check if quota is available.

For time-based limits (responses_per_month, exports_per_month, api_calls_per_minute):
checks Redis counters with monthly window reset.

For absolute limits (surveys, storage_mb, etc.): returns limit from plan
but does NOT check Redis — each consumer service self-enforces from its own DB.

Authentication: no security requirement declared for this operation.

Request body: application/json (required)

Type: object

Request to check quota availability.

Schema: [QuotaService_CheckLimitRequest](/api-reference/schemas/quotaservice-checklimitrequest-07b483f81a.md)

- `limit_type` (required)
  Type: string
  
  Type of limit (e.g., 'surveys')

- `amount` (optional)
  Type: integer
  
  Amount to check
  
  default: 1
  
  minimum: 1

Responses:

- 200: Successful Response

Content type: application/json

Type: object

Response from quota operations.

Schema: [QuotaService_QuotaResponse](/api-reference/schemas/quotaservice-quotaresponse-8cc523fb43.md)

- `success` (required)
  Type: boolean

- `allowed` (required)
  Type: boolean

- `current` (required)
  Type: integer

- `limit` (required)
  Type: integer

- `remaining` (required)
  Type: integer

- `reset_at` (optional)
  Type: unknown
  
  anyOf:
    Type: string, date-time
  
    Type: null

- `unlimited` (optional)
  Type: boolean
  
  default: false

- 422: Validation Error

Content type: application/json

Type: object

Schema: [QuotaService_HTTPValidationError](/api-reference/schemas/quotaservice-httpvalidationerror-ee21a36cae.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [QuotaService_ValidationError](/api-reference/schemas/quotaservice-validationerror-b3c616c755.md); Type: object

## Examples

### cURL

```bash
curl -X POST 'http://localhost:6380/api/v1/quota/check' \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "limit_type": "string",
  "amount": 1
}'
```

### JavaScript

```javascript
const body = `{
  "limit_type": "string",
  "amount": 1
}`;

const response = await fetch('http://localhost:6380/api/v1/quota/check', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
  },
  body,
});

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

### Python

```python
import requests

body = '''{
  "limit_type": "string",
  "amount": 1
}'''

response = requests.post(
    'http://localhost:6380/api/v1/quota/check',
    data=body.encode('utf-8'),
    headers={
        'Content-Type': 'application/json',
    },
)
print(response.text)
```


## Consume Quota

`POST /api/v1/quota/consume`

Consume quota after successful operation.

For time-based limits: atomically increments the Redis counter.
For absolute limits: no-op (services self-track from their own DB).

Authentication: no security requirement declared for this operation.

Request body: application/json (required)

Type: object

Request to consume quota.

Schema: [QuotaService_ConsumeQuotaRequest](/api-reference/schemas/quotaservice-consumequotarequest-18a33820bc.md)

- `limit_type` (required)
  Type: string
  
  Type of limit

- `amount` (optional)
  Type: integer
  
  Amount to consume
  
  default: 1
  
  minimum: 1

- `idempotency_key` (optional)
  Type: unknown
  
  Tenant-scoped usage idempotency key
  
  anyOf:
    Type: string
    
    maxLength: 255
  
    Type: null

Responses:

- 200: Successful Response

Content type: application/json

Type: object

Response from quota operations.

Schema: [QuotaService_QuotaResponse](/api-reference/schemas/quotaservice-quotaresponse-8cc523fb43.md)

- `success` (required)
  Type: boolean

- `allowed` (required)
  Type: boolean

- `current` (required)
  Type: integer

- `limit` (required)
  Type: integer

- `remaining` (required)
  Type: integer

- `reset_at` (optional)
  Type: unknown
  
  anyOf:
    Type: string, date-time
  
    Type: null

- `unlimited` (optional)
  Type: boolean
  
  default: false

- 422: Validation Error

Content type: application/json

Type: object

Schema: [QuotaService_HTTPValidationError](/api-reference/schemas/quotaservice-httpvalidationerror-ee21a36cae.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [QuotaService_ValidationError](/api-reference/schemas/quotaservice-validationerror-b3c616c755.md); Type: object

## Examples

### cURL

```bash
curl -X POST 'http://localhost:6380/api/v1/quota/consume' \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "limit_type": "string",
  "amount": 1,
  "idempotency_key": "string"
}'
```

### JavaScript

```javascript
const body = `{
  "limit_type": "string",
  "amount": 1,
  "idempotency_key": "string"
}`;

const response = await fetch('http://localhost:6380/api/v1/quota/consume', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
  },
  body,
});

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

### Python

```python
import requests

body = '''{
  "limit_type": "string",
  "amount": 1,
  "idempotency_key": "string"
}'''

response = requests.post(
    'http://localhost:6380/api/v1/quota/consume',
    data=body.encode('utf-8'),
    headers={
        'Content-Type': 'application/json',
    },
)
print(response.text)
```


## Rollback Quota

`POST /api/v1/quota/rollback`

Rollback quota consumption.

For time-based limits: atomically decrements the Redis counter.
For absolute limits: no-op (services self-track from their own DB).

Authentication: no security requirement declared for this operation.

Request body: application/json (required)

Type: object

Request to rollback quota.

Schema: [QuotaService_RollbackRequest](/api-reference/schemas/quotaservice-rollbackrequest-c6f2bbc3ff.md)

- `limit_type` (required)
  Type: string
  
  Type of limit

- `amount` (optional)
  Type: integer
  
  Amount to rollback
  
  default: 1
  
  minimum: 1

Responses:

- 200: Successful Response

Content type: application/json

Type: object

Response from quota operations.

Schema: [QuotaService_QuotaResponse](/api-reference/schemas/quotaservice-quotaresponse-8cc523fb43.md)

- `success` (required)
  Type: boolean

- `allowed` (required)
  Type: boolean

- `current` (required)
  Type: integer

- `limit` (required)
  Type: integer

- `remaining` (required)
  Type: integer

- `reset_at` (optional)
  Type: unknown
  
  anyOf:
    Type: string, date-time
  
    Type: null

- `unlimited` (optional)
  Type: boolean
  
  default: false

- 422: Validation Error

Content type: application/json

Type: object

Schema: [QuotaService_HTTPValidationError](/api-reference/schemas/quotaservice-httpvalidationerror-ee21a36cae.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [QuotaService_ValidationError](/api-reference/schemas/quotaservice-validationerror-b3c616c755.md); Type: object

## Examples

### cURL

```bash
curl -X POST 'http://localhost:6380/api/v1/quota/rollback' \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "limit_type": "string",
  "amount": 1
}'
```

### JavaScript

```javascript
const body = `{
  "limit_type": "string",
  "amount": 1
}`;

const response = await fetch('http://localhost:6380/api/v1/quota/rollback', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
  },
  body,
});

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

### Python

```python
import requests

body = '''{
  "limit_type": "string",
  "amount": 1
}'''

response = requests.post(
    'http://localhost:6380/api/v1/quota/rollback',
    data=body.encode('utf-8'),
    headers={
        'Content-Type': 'application/json',
    },
)
print(response.text)
```


## Get Usage

`GET /api/v1/quota/usage/{limit_type}`

Get current usage for a limit type.

For time-based limits: returns actual Redis counter.
For absolute limits: returns limit from plan, current=0 (service self-reports).

Authentication: no security requirement declared for this operation.

Parameters:

- `limit_type` (path, string, required)
  Type: string

Responses:

- 200: Successful Response

Content type: application/json

Type: object

Response from quota operations.

Schema: [QuotaService_QuotaResponse](/api-reference/schemas/quotaservice-quotaresponse-8cc523fb43.md)

- `success` (required)
  Type: boolean

- `allowed` (required)
  Type: boolean

- `current` (required)
  Type: integer

- `limit` (required)
  Type: integer

- `remaining` (required)
  Type: integer

- `reset_at` (optional)
  Type: unknown
  
  anyOf:
    Type: string, date-time
  
    Type: null

- `unlimited` (optional)
  Type: boolean
  
  default: false

- 422: Validation Error

Content type: application/json

Type: object

Schema: [QuotaService_HTTPValidationError](/api-reference/schemas/quotaservice-httpvalidationerror-ee21a36cae.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [QuotaService_ValidationError](/api-reference/schemas/quotaservice-validationerror-b3c616c755.md); Type: object

## Examples

### cURL

```bash
curl -X GET 'http://localhost:6380/api/v1/quota/usage/string'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:6380/api/v1/quota/usage/string', {
  method: 'GET',
});

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

### Python

```python
import requests

response = requests.get('http://localhost:6380/api/v1/quota/usage/string')
print(response.text)
```


## Get All Usage

`GET /api/v1/quota/usage`

Get all usage counters for tenant.

Authentication: no security requirement declared for this operation.

Responses:

- 200: Successful Response

Content type: application/json

Type: object

Additional properties: true

## Examples

### cURL

```bash
curl -X GET 'http://localhost:6380/api/v1/quota/usage'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:6380/api/v1/quota/usage', {
  method: 'GET',
});

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

### Python

```python
import requests

response = requests.get('http://localhost:6380/api/v1/quota/usage')
print(response.text)
```


## Reset Tenant

`POST /api/v1/quota/reset`

Reset all counters for tenant (admin only).

Authentication: no security requirement declared for this operation.

Responses:

- 200: Successful Response

Content type: application/json

Type: unknown

## Examples

### cURL

```bash
curl -X POST 'http://localhost:6380/api/v1/quota/reset'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:6380/api/v1/quota/reset', {
  method: 'POST',
});

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

### Python

```python
import requests

response = requests.post('http://localhost:6380/api/v1/quota/reset')
print(response.text)
```


## Readiness Check

`GET /ready`

Readiness check endpoint.

Authentication: no security requirement declared for this operation.

Responses:

- 200: Successful Response

Content type: application/json

Type: unknown

## Examples

### cURL

```bash
curl -X GET 'http://localhost:6380/ready'
```

### JavaScript

```javascript
const response = await fetch('http://localhost:6380/ready', {
  method: 'GET',
});

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

### Python

```python
import requests

response = requests.get('http://localhost:6380/ready')
print(response.text)
```


## Backend_ActivateTrialDto

Type: object

Schema: [Backend_ActivateTrialDto](/api-reference/schemas/backend-activatetrialdto-ec86f2e80e.md)

- `address` (required)
  Reference: [Backend_BillingAddressDto](/api-reference/schemas/backend-billingaddressdto-4cf9dcd9fa.md); Type: object

- `tax_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

## Backend_AppConfigurationDto

Type: object

Schema: [Backend_AppConfigurationDto](/api-reference/schemas/backend-appconfigurationdto-b43b803f65.md)

- `is_multi_tenant_enabled` (required)
  Type: boolean

- `multi_tenancy_strategy` (required)
  Type: string

- `host_main_domain` (required)
  Type: string

- `is_user_logged_in` (optional)
  Type: unknown
  
  default: false
  
  anyOf:
    Type: boolean
  
    Type: null

- `user_preferences` (optional)
  Type: unknown
  
  anyOf:
    Reference: [Backend_UserPreferenceDto](/api-reference/schemas/backend-userpreferencedto-82d1d1bb6a.md); Type: object
  
    Type: null

- `current_tenant` (optional)
  Type: unknown
  
  anyOf:
    Reference: [Backend_TenantDto](/api-reference/schemas/backend-tenantdto-b9c2bf7a81.md); Type: object
  
    Type: null

- `environment` (required)
  Type: string

- `runtime_security_config` (optional)
  Type: unknown
  
  anyOf:
    Reference: [Backend_RuntimeSecurityConfigConfigDto](/api-reference/schemas/backend-runtimesecurityconfigconfigdto-eb429fabf3.md); Type: object
  
    Type: null

- `tenant_data_governances` (optional)
  Type: unknown
  
  anyOf:
    Type: array
    
    Items:
      Reference: [Backend_TenantDataGovernanceConfigDto](/api-reference/schemas/backend-tenantdatagovernanceconfigdto-014c260309.md); Type: object
  
    Type: null

- `mobile_security_policy` (optional)
  Type: unknown
  
  anyOf:
    Reference: [Backend_DeprecatedMobileSecurityPolicyConfigDto](/api-reference/schemas/backend-deprecatedmobilesecuritypolicyconfigdto-9e2199afb4.md); Type: object
    
    DEPRECATED: For old mobile clients. Remove after migration window.
  
    Type: null

## Backend_AppVersionCheckResponseDto

Type: object

Schema: [Backend_AppVersionCheckResponseDto](/api-reference/schemas/backend-appversioncheckresponsedto-6c72b8eade.md)

- `latest_version` (required)
  Type: string
  
  Example:
  
  ```json
  "2.1.0"
  ```

- `download_url` (optional)
  Type: unknown
  
  Example:
  
  ```json
  "https://releases.mquad.local/v2.1.0/mquad.apk"
  ```
  
  anyOf:
    Type: string
  
    Type: null

- `checksum_sha256` (optional)
  Type: unknown
  
  Example:
  
  ```json
  "a1b2c3d4e5f6..."
  ```
  
  anyOf:
    Type: string
  
    Type: null

- `min_version` (optional)
  Type: unknown
  
  Example:
  
  ```json
  "1.5.0"
  ```
  
  anyOf:
    Type: string
  
    Type: null

- `release_notes` (optional)
  Type: unknown
  
  Example:
  
  ```json
  "Fixed sync conflicts, improved offline stability"
  ```
  
  anyOf:
    Type: string
  
    Type: null

## Backend_AuditEventIngestRequest

Type: object

Client-originated audit event relayed to the centralized audit-service.

Mirrors the schema the browser sends via the generated AuditLogsService
(createAuditLog). Unknown fields are preserved (extra="allow") so the relay
forwards the payload faithfully to the audit-service, which owns validation.

Schema: [Backend_AuditEventIngestRequest](/api-reference/schemas/backend-auditeventingestrequest-5835f9775d.md)

- `event_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `event_type` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `log_schema_version` (optional)
  Type: unknown
  
  default: "1.0"
  
  anyOf:
    Type: string
  
    Type: null

- `service_name` (optional)
  Type: string
  
  default: "frontend"

- `action` (required)
  Type: string

- `actor_type` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `actor_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `actor_email` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `tenant_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `resource_type` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `resource_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `status` (optional)
  Type: unknown
  
  default: "success"
  
  anyOf:
    Type: string
  
    Type: null

- `ip_address` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `user_agent` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `request_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `trace_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `parent_trace_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `http_method` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `http_path` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `http_status` (optional)
  Type: unknown
  
  anyOf:
    Type: integer
  
    Type: null

- `duration_ms` (optional)
  Type: unknown
  
  anyOf:
    Type: integer
  
    Type: null

- `metadata` (optional)
  Type: unknown
  
  anyOf:
    Type: object
    
    Additional properties: true
  
    Type: null

- `event_idempotency_key` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `data_classification` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

Additional properties: true

## Backend_AuditLogDto

Type: object

Schema: [Backend_AuditLogDto](/api-reference/schemas/backend-auditlogdto-5cac555828.md)

- `id` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `entity` (required)
  Type: string

- `service_name` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `action` (required)
  Type: string
  
  enum: ["create","update","delete","read","login","logout","error","download"]

- `changes` (optional)
  Type: object
  
  Additional properties: true

- `user_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `timestamp` (optional)
  Type: string
  
  default: ""

- `tenant_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `actor_name` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `actor_email` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `resource_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `resource_name` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `category` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `severity` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `description` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `failure_reason` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `correlation_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `status` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `ip_address` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `user_agent` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `event_type` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

## Backend_AuditLogListDto

Type: object

Schema: [Backend_AuditLogListDto](/api-reference/schemas/backend-auditloglistdto-38ea4dd52f.md)

- `total` (required)
  Type: integer

- `items` (required)
  Type: array
  
  Items:
    Reference: [Backend_AuditLogDto](/api-reference/schemas/backend-auditlogdto-5cac555828.md); Type: object

- `has_next` (required)
  Type: boolean

- `has_previous` (required)
  Type: boolean

- `limit` (required)
  Type: integer

- `skip` (required)
  Type: integer

## Backend_AuthenticatorTransport

Type: string

How an authenticator communicates to the client/browser.

Members:
    `USB`: USB wired connection
    `NFC`: Near Field Communication
    `BLE`: Bluetooth Low Energy
    `INTERNAL`: Direct connection (read: a platform authenticator)
    `CABLE`: Cloud Assisted Bluetooth Low Energy
    `HYBRID`: A combination of (often separate) data-transport and proximity mechanisms

https://www.w3.org/TR/webauthn-2/#enum-transport

Schema: [Backend_AuthenticatorTransport](/api-reference/schemas/backend-authenticatortransport-99cba1153f.md)

enum: ["usb","nfc","ble","smart-card","internal","cable","hybrid"]

## Backend_BillingAddressDto

Type: object

Schema: [Backend_BillingAddressDto](/api-reference/schemas/backend-billingaddressdto-4cf9dcd9fa.md)

- `individual_name` (required)
  Type: string

- `business_name` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `line1` (required)
  Type: string

- `line2` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `city` (required)
  Type: string

- `state` (required)
  Type: string

- `postal_code` (required)
  Type: string

- `country` (required)
  Type: string

## Backend_BillingConfigDto

Type: object

Schema: [Backend_BillingConfigDto](/api-reference/schemas/backend-billingconfigdto-a2a6ee7028.md)

- `publishable_key` (required)
  Type: string

## Backend_BillingRecordDto

Type: object

Schema: [Backend_BillingRecordDto](/api-reference/schemas/backend-billingrecorddto-b31535330f.md)

- `id` (required)
  Type: string

- `created_at` (required)
  Type: string

- `scope` (required)
  Type: string
  
  enum: ["host","tenant"]

- `actor` (required)
  Type: string
  
  enum: ["tenant","end_user"]

- `user_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `user_name` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `user_email` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `payment_type` (required)
  Type: string

- `currency` (required)
  Type: string

- `amount` (optional)
  Type: unknown
  
  anyOf:
    Type: integer
  
    Type: null

- `amount_formatted` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `stripe_customer_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `stripe_subscription_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `stripe_session_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `stripe_invoice_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `stripe_payment_intent_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `product_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `price_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `status` (required)
  Type: string
  
  enum: ["pending","requires_payment_method","requires_action","active","succeeded","payment_failed","canceled","incomplete"]

- `current_period_end` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `canceled_at` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `cancellation_reason` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `invoice_url` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `invoice_pdf_url` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `receipt_url` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `metadata` (optional)
  Type: unknown
  
  anyOf:
    Type: object
    
    Additional properties: true
  
    Type: null

## Backend_BillingRecordListDto

Type: object

Schema: [Backend_BillingRecordListDto](/api-reference/schemas/backend-billingrecordlistdto-f4e335d23c.md)

- `items` (required)
  Type: array
  
  Items:
    Reference: [Backend_BillingRecordDto](/api-reference/schemas/backend-billingrecorddto-b31535330f.md); Type: object

- `skip` (required)
  Type: integer

- `limit` (required)
  Type: integer

- `total` (required)
  Type: integer

- `has_previous` (required)
  Type: boolean

- `has_next` (required)
  Type: boolean

## Backend_Body_bulk_upload_users_api_v1_users_bulk_upload_post

Type: object

Schema: [Backend_Body_bulk_upload_users_api_v1_users_bulk_upload_post](/api-reference/schemas/backend-body-bulk-upload-users-api-v1-users-bulk-upload-post-40ef5bd154.md)

- `tenant_id` (required)
  Type: string
  
  Tenant ID to add users to

- `default_role_id` (optional)
  Type: unknown
  
  Default role ID for new users
  
  anyOf:
    Type: string
  
    Type: null

- `default_role_name` (optional)
  Type: unknown
  
  Default role name for new users (e.g., 'Admin', 'User')
  
  anyOf:
    Type: string
  
    Type: null

- `send_invitation` (optional)
  Type: boolean
  
  Whether to send invitation emails
  
  default: true

- `file` (required)
  Type: string, binary
  
  CSV or Excel file with user data

## Backend_Body_login_api_v1_account_login_post

Type: object

Schema: [Backend_Body_login_api_v1_account_login_post](/api-reference/schemas/backend-body-login-api-v1-account-login-post-418fb31a87.md)

- `grant_type` (optional)
  Type: unknown
  
  anyOf:
    Type: string
    
    pattern: "^password$"
  
    Type: null

- `username` (required)
  Type: string

- `password` (required)
  Type: string, password

- `scope` (optional)
  Type: string
  
  default: ""

- `client_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `client_secret` (optional)
  Type: unknown, password
  
  anyOf:
    Type: string
  
    Type: null

## Backend_Body_login_host_admin_api_v1_account_login_host_admin_post

Type: object

Schema: [Backend_Body_login_host_admin_api_v1_account_login_host_admin_post](/api-reference/schemas/backend-body-login-host-admin-api-v1-account-login-host-admin-post-63044dcdec.md)

- `grant_type` (optional)
  Type: unknown
  
  anyOf:
    Type: string
    
    pattern: "^password$"
  
    Type: null

- `username` (required)
  Type: string

- `password` (required)
  Type: string, password

- `scope` (optional)
  Type: string
  
  default: ""

- `client_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `client_secret` (optional)
  Type: unknown, password
  
  anyOf:
    Type: string
  
    Type: null

## Backend_Body_login_new_api_v1_account_login_new_post

Type: object

Schema: [Backend_Body_login_new_api_v1_account_login_new_post](/api-reference/schemas/backend-body-login-new-api-v1-account-login-new-post-7a5f901167.md)

- `grant_type` (optional)
  Type: unknown
  
  anyOf:
    Type: string
    
    pattern: "^password$"
  
    Type: null

- `username` (required)
  Type: string

- `password` (required)
  Type: string, password

- `scope` (optional)
  Type: string
  
  default: ""

- `client_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `client_secret` (optional)
  Type: unknown, password
  
  anyOf:
    Type: string
  
    Type: null

## Backend_Body_login_super_admin_api_v1_account_login_super_admin_post

Type: object

Schema: [Backend_Body_login_super_admin_api_v1_account_login_super_admin_post](/api-reference/schemas/backend-body-login-super-admin-api-v1-account-login-super-admin-post-e9417ea90b.md)

- `grant_type` (optional)
  Type: unknown
  
  anyOf:
    Type: string
    
    pattern: "^password$"
  
    Type: null

- `username` (required)
  Type: string

- `password` (required)
  Type: string, password

- `scope` (optional)
  Type: string
  
  default: ""

- `client_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `client_secret` (optional)
  Type: unknown, password
  
  anyOf:
    Type: string
  
    Type: null

## Backend_Body_passkey_login_api_v1_account_passkey_login_post

Type: object

Schema: [Backend_Body_passkey_login_api_v1_account_passkey_login_post](/api-reference/schemas/backend-body-passkey-login-api-v1-account-passkey-login-post-130d3781b9.md)

- `email` (required)
  Type: string, email

- `credential` (required)
  Type: object
  
  Additional properties: true

## Backend_Body_passkey_register_api_v1_account_passkey_register_post

Type: object

Schema: [Backend_Body_passkey_register_api_v1_account_passkey_register_post](/api-reference/schemas/backend-body-passkey-register-api-v1-account-passkey-register-post-fac7a81cba.md)

- `email` (required)
  Type: string, email

- `credential` (required)
  Type: object
  
  Additional properties: true

## Backend_Body_update_profile_picture_api_v1_users__user_id__update_profile_picture_put

Type: object

Schema: [Backend_Body_update_profile_picture_api_v1_users__user_id__update_profile_picture_put](/api-reference/schemas/backend-body-update-profile-picture-api-v1-users-user-id-update-profile-picture-put-f81a5c112c.md)

- `file` (required)
  Type: string, binary

## Backend_BulkUserRequestDto

Type: object

Schema: [Backend_BulkUserRequestDto](/api-reference/schemas/backend-bulkuserrequestdto-cc1956263f.md)

- `user_ids` (required)
  Type: array
  
  Items:
    Type: string

## Backend_BulkUserUploadResponseDto

Type: object

DTO for bulk user upload response

Schema: [Backend_BulkUserUploadResponseDto](/api-reference/schemas/backend-bulkuseruploadresponsedto-0571e0cd8f.md)

- `total` (required)
  Type: integer

- `success` (required)
  Type: integer

- `failed` (required)
  Type: integer

- `results` (required)
  Type: array
  
  Items:
    Reference: [Backend_BulkUserUploadResultDto](/api-reference/schemas/backend-bulkuseruploadresultdto-48f2f6aebf.md); Type: object
    
    DTO for individual user upload result

## Backend_BulkUserUploadResultDto

Type: object

DTO for individual user upload result

Schema: [Backend_BulkUserUploadResultDto](/api-reference/schemas/backend-bulkuseruploadresultdto-48f2f6aebf.md)

- `email` (required)
  Type: string

- `success` (required)
  Type: boolean

- `user_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `message` (required)
  Type: string

- `error` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

## Backend_CeleryMetricsDto

Type: object

Schema: [Backend_CeleryMetricsDto](/api-reference/schemas/backend-celerymetricsdto-49e2d9128d.md)

- `workers_online` (required)
  Type: integer

- `active_tasks` (required)
  Type: integer

- `scheduled_tasks` (required)
  Type: integer

- `reserved_tasks` (required)
  Type: integer

- `worker_details` (required)
  Type: object
  
  Additional properties: true

## Backend_ChangeEmailConfirmRequestDto

Type: object

Schema: [Backend_ChangeEmailConfirmRequestDto](/api-reference/schemas/backend-changeemailconfirmrequestdto-2605c9b641.md)

- `token` (required)
  Type: string

## Backend_ChangeEmailRequestDto

Type: object

Schema: [Backend_ChangeEmailRequestDto](/api-reference/schemas/backend-changeemailrequestdto-6feb699532.md)

- `new_email` (required)
  Type: string, email

## Backend_ChangeEmailResponseDto

Type: object

Schema: [Backend_ChangeEmailResponseDto](/api-reference/schemas/backend-changeemailresponsedto-20e1488c62.md)

- `message` (required)
  Type: string

## Backend_CheckoutRequestDto

Type: object

Schema: [Backend_CheckoutRequestDto](/api-reference/schemas/backend-checkoutrequestdto-481b5dd219.md)

- `price_id` (required)
  Type: string

- `tenant_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `mode` (optional)
  Type: string
  
  default: "subscription"
  
  enum: ["payment","subscription","setup"]

- `email` (required)
  Type: string, email

## Backend_CheckoutResponseDto

Type: object

Schema: [Backend_CheckoutResponseDto](/api-reference/schemas/backend-checkoutresponsedto-4588ecfd01.md)

- `checkout_url` (required)
  Type: string

## Backend_CompleteIncompletePaymentRequestDto

Type: object

Schema: [Backend_CompleteIncompletePaymentRequestDto](/api-reference/schemas/backend-completeincompletepaymentrequestdto-fd9a34863a.md)

- `subscription_id` (required)
  Type: string

- `tenant_id` (required)
  Type: string

## Backend_ConfirmNativeSubscriptionRequestDto

Type: object

Schema: [Backend_ConfirmNativeSubscriptionRequestDto](/api-reference/schemas/backend-confirmnativesubscriptionrequestdto-c9b2ae4bcc.md)

- `billing_record_id` (required)
  Type: string

## Backend_CreateNativeSubscriptionRequestDto

Type: object

Schema: [Backend_CreateNativeSubscriptionRequestDto](/api-reference/schemas/backend-createnativesubscriptionrequestdto-355a817343.md)

- `price_id` (required)
  Type: string

- `tenant_id` (required)
  Type: string

- `mode` (optional)
  Type: string
  
  default: "subscription"
  
  enum: ["subscription","payment"]

- `email` (required)
  Type: string

## Backend_CreateNotificationBannerSettingDto

Type: object

Schema: [Backend_CreateNotificationBannerSettingDto](/api-reference/schemas/backend-createnotificationbannersettingdto-c10872f428.md)

- `is_enabled` (required)
  Type: boolean

- `message` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

## Backend_CreatePlanDto

Type: object

Schema: [Backend_CreatePlanDto](/api-reference/schemas/backend-createplandto-5f23e90b85.md)

- `currency` (optional)
  Type: string
  
  Must be a supported currency: https://docs.stripe.com/currencies
  
  default: "usd"

- `interval` (required)
  Type: string
  
  enum: ["month","year"]

- `product_id` (required)
  Type: string
  
  The product whose pricing the created plan will represent. This must be the ID of an existing product.

- `amount` (required)
  Type: integer

- `trial_period_days` (optional)
  Type: unknown
  
  Number of days for the trial period. Set > 0 to enable trials.
  
  anyOf:
    Type: integer
  
    Type: null

## Backend_CreatePricingDto

Type: object

Schema: [Backend_CreatePricingDto](/api-reference/schemas/backend-createpricingdto-c5ec814c3d.md)

- `currency` (optional)
  Type: string
  
  Currency code, e.g., 'usd'
  
  default: "usd"

- `unit_amount` (required)
  Type: integer
  
  A positive integer in cents (or 0 for a free price) representing how much to charge. One of unit_amount, unit_amount_decimal, or custom_unit_amount is required, unless billing_scheme=tiered.

- `product` (required)
  Type: string
  
  The ID of the product this price is associated with

- `active` (optional)
  Type: boolean
  
  Whether the price is active or not
  
  default: true

- `recurring` (required)
  Reference: [Backend_RecurringDto](/api-reference/schemas/backend-recurringdto-a1f533306f.md); Type: object

## Backend_CreateProductDto

Type: object

Schema: [Backend_CreateProductDto](/api-reference/schemas/backend-createproductdto-f35d014276.md)

- `name` (required)
  Type: string

- `description` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `tax_code` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `active` (optional)
  Type: boolean
  
  default: true

## Backend_CreateRoleDto

Type: object

Schema: [Backend_CreateRoleDto](/api-reference/schemas/backend-createroledto-0210bfd3a8.md)

- `name` (required)
  Type: string

- `description` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `tenant_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `permissions` (optional)
  Type: array
  
  Items:
    Reference: [Backend_Permission](/api-reference/schemas/backend-permission-f0b845e64b.md); Type: string
    
    enum: ["super:admin","full:access","user:read_and_write_only","user:delete_only","user:self_read_and_write_only","user:role_assign_or_remove_only","user:view_only","role:view_only","role:read_and_write_only","role:delete_only","role:permission_read_and_write_only","host:manage_tenants","manage:storage_settings","manage:tenant_settings","manage:billing","manage:payments_settings","manage:products_and_pricing","audit_logs:view_only","audit_logs:download","audit_logs:write","compliance:manage","forms:render","forms:preview","forms:render_anonymous","forms:submit","forms:submit_anonymous","forms:submit_offline","forms:draft_create","forms:draft_read","forms:draft_update","forms:draft_delete","forms:draft_read_all","forms:session_create","forms:session_read","forms:session_delete","forms:session_read_all","forms:config_read","forms:config_write","forms:analytics_view","forms:analytics_export","forms:admin","dashboard:view","dashboard:read","dashboard:create","dashboard:update","dashboard:delete","billing:read","config:read","config:write","survey:manage","survey:create","survey:read","survey:update","survey:delete","survey:publish","survey:unpublish","survey:grant_access","survey:manage_access","survey:response_view","survey:response_download","template:read","template:create","template:update","template:delete","template:manage","submission:create","submission:read","submission:update","submission:update_own","submission:delete","submission:view","submission:export","submission:approve","submission:assign","workspace:create","workspace:read","workspace:update","workspace:delete","workspace:manage","workspace:manage_members","project:create","project:read","project:update","project:delete","project:manage","analytics:view","analytics:export","analytics:admin","report:view","report:create","export:create","export:view","export:download","export:cancel","export:template:create","export:template:view","webhook:create","webhook:read","webhook:update","webhook:delete","webhook:manage","search:execute","search:manage","notification:send","notification:view","notification:read_all","notification:delete","notification:manage","notification:template:view","notification:template:create","notification:template:update","notification:template:delete","notification:preferences:read","notification:preferences:write","media:upload","media:read","media:update","media:delete","media:library_upload","media:library_read","media:library_delete","media:manage","feature_flag:read","feature_flag:create","feature_flag:update","feature_flag:delete","feature_flag:toggle","response:create","response:read","response:update","response:delete","response:export","response:approve","response:revise_own","attachment:create","attachment:read","attachment:delete","odk:view","odk:submit","odk:manage"]

- `is_immutable` (optional)
  Type: boolean
  
  default: false

## Backend_CreateRoleResponseDto

Type: object

Schema: [Backend_CreateRoleResponseDto](/api-reference/schemas/backend-createroleresponsedto-7610ae55ee.md)

- `id` (required)
  Type: string

## Backend_CreateTenantDataGovernanceDto

Type: object

Schema: [Backend_CreateTenantDataGovernanceDto](/api-reference/schemas/backend-createtenantdatagovernancedto-c53f3be484.md)

- `tenant_id` (required)
  Type: string

- `max_offline_duration_hours` (optional)
  Type: integer
  
  default: 0
  
  minimum: 0

- `force_revalidation_hours` (optional)
  Type: integer
  
  default: 0
  
  minimum: 0

- `media_upload_max_size_mb` (optional)
  Type: integer
  
  default: 50
  
  minimum: 1
  
  maximum: 500

- `media_upload_allowed_types` (optional)
  Type: unknown
  
  anyOf:
    Type: array
    
    Items:
      Type: unknown
  
    Type: null

- `local_retention_days` (optional)
  Type: integer
  
  default: 0
  
  minimum: 0

- `remote_wipe_enabled` (optional)
  Type: boolean
  
  default: false

## Backend_CreateTenantDto

Type: object

Schema: [Backend_CreateTenantDto](/api-reference/schemas/backend-createtenantdto-cd200d76a4.md)

- `name` (required)
  Type: string

- `subdomain` (required)
  Type: string

- `admin_email` (required)
  Type: string, email

- `admin_password` (required)
  Type: string

- `first_name` (required)
  Type: string

- `last_name` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `gender` (required)
  Reference: [Backend_Gender](/api-reference/schemas/backend-gender-58aaeec09d.md); Type: string
  
  enum: ["male","female","other","prefer_not_to_say"]

## Backend_CreateTenantResponseDto

Type: object

Schema: [Backend_CreateTenantResponseDto](/api-reference/schemas/backend-createtenantresponsedto-24778c2f0b.md)

- `id` (required)
  Type: string

## Backend_CreateUserDto

Type: object

Schema: [Backend_CreateUserDto](/api-reference/schemas/backend-createuserdto-b424e7defc.md)

- `first_name` (required)
  Type: string

- `last_name` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `email` (required)
  Type: string, email

- `gender` (optional)
  Type: unknown
  
  default: "prefer_not_to_say"
  
  anyOf:
    Reference: [Backend_Gender](/api-reference/schemas/backend-gender-58aaeec09d.md); Type: string
    
    enum: ["male","female","other","prefer_not_to_say"]
  
    Type: null

- `tenant_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `role_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `password` (required)
  Type: string

- `sub_domain` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `agreed_to_terms` (optional)
  Type: boolean
  
  default: true

## Backend_CreateUserResponseDto

Type: object

Schema: [Backend_CreateUserResponseDto](/api-reference/schemas/backend-createuserresponsedto-b14d646235.md)

- `id` (required)
  Type: string

## Backend_DashboardMetricsDto

Type: object

Schema: [Backend_DashboardMetricsDto](/api-reference/schemas/backend-dashboardmetricsdto-4d17501d37.md)

- `filter` (required)
  Type: string
  
  enum: ["today","this_week","last_3_months","all"]

- `joined_users` (required)
  Type: integer

- `total_users` (required)
  Type: integer

- `timeseries` (required)
  Type: array
  
  Items:
    Reference: [Backend_TimeSeriesDto](/api-reference/schemas/backend-timeseriesdto-59f782b33b.md); Type: object

## Backend_DeprecatedMobileSecurityPolicyConfigDto

Type: object

DEPRECATED: For old mobile clients. Remove after migration window.

Schema: [Backend_DeprecatedMobileSecurityPolicyConfigDto](/api-reference/schemas/backend-deprecatedmobilesecuritypolicyconfigdto-9e2199afb4.md)

- `global_mode` (optional)
  Type: string
  
  default: "warning"

- `screenshot_prevention_mode` (optional)
  Type: string
  
  default: "disabled"

- `root_detection_mode` (optional)
  Type: string
  
  default: "warning"

- `max_offline_duration_hours` (optional)
  Type: integer
  
  default: 0

- `force_revalidation_hours` (optional)
  Type: integer
  
  default: 0

- `media_upload_max_size_mb` (optional)
  Type: integer
  
  default: 50

- `media_upload_allowed_types` (optional)
  Type: unknown
  
  anyOf:
    Type: array
    
    Items:
      Type: unknown
  
    Type: null

- `wifi_only_sync` (optional)
  Type: boolean
  
  default: false

- `battery_aware_sync` (optional)
  Type: boolean
  
  default: false

- `battery_low_threshold_percent` (optional)
  Type: integer
  
  default: 20

- `block_sync_on_roaming` (optional)
  Type: boolean
  
  default: false

- `local_retention_days` (optional)
  Type: integer
  
  default: 0

- `remote_wipe_enabled` (optional)
  Type: boolean
  
  default: false

- `biometric_required_mode` (optional)
  Type: string
  
  default: "disabled"

- `session_timeout_minutes` (optional)
  Type: integer
  
  default: 0

## Backend_DeprecatedMobileSecurityPolicyDto

Type: object

Backward-compatible adapter for old mobile clients.

Maps from RuntimeSecurityConfig + TenantDataGovernance into
the old monolithic MobileSecurityPolicyDto format.
This is TEMPORARY — remove after migration window.

DEPRECATED: Use RuntimeSecurityConfigDto + TenantDataGovernanceDto instead.

Schema: [Backend_DeprecatedMobileSecurityPolicyDto](/api-reference/schemas/backend-deprecatedmobilesecuritypolicydto-26fe21cbe3.md)

- `id` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `tenant_id` (required)
  Type: string

- `global_mode` (optional)
  Type: string
  
  default: "warning"

- `screenshot_prevention_mode` (optional)
  Type: string
  
  default: "disabled"

- `root_detection_mode` (optional)
  Type: string
  
  default: "warning"

- `biometric_required_mode` (optional)
  Type: string
  
  default: "disabled"

- `session_timeout_minutes` (optional)
  Type: integer
  
  default: 0

- `wifi_only_sync` (optional)
  Type: boolean
  
  default: false

- `battery_aware_sync` (optional)
  Type: boolean
  
  default: false

- `battery_low_threshold_percent` (optional)
  Type: integer
  
  default: 20

- `block_sync_on_roaming` (optional)
  Type: boolean
  
  default: false

- `max_offline_duration_hours` (optional)
  Type: integer
  
  default: 0

- `force_revalidation_hours` (optional)
  Type: integer
  
  default: 0

- `media_upload_max_size_mb` (optional)
  Type: integer
  
  default: 50

- `media_upload_allowed_types` (optional)
  Type: unknown
  
  anyOf:
    Type: array
    
    Items:
      Type: unknown
  
    Type: null

- `local_retention_days` (optional)
  Type: integer
  
  default: 0

- `remote_wipe_enabled` (optional)
  Type: boolean
  
  default: false

## Backend_DownloadAuditRequestDto

Type: object

Schema: [Backend_DownloadAuditRequestDto](/api-reference/schemas/backend-downloadauditrequestdto-c5e1bd9710.md)

- `action` (optional)
  Type: unknown
  
  anyOf:
    Type: string
    
    enum: ["create","update","delete","read","login","logout","error","download"]
  
    Type: null

- `total_records` (required)
  Type: integer

## Backend_DownloadResponseDto

Type: object

Schema: [Backend_DownloadResponseDto](/api-reference/schemas/backend-downloadresponsedto-f11523e62f.md)

- `message` (required)
  Type: string

## Backend_EnterpriseSignupDto

Type: object

Schema: [Backend_EnterpriseSignupDto](/api-reference/schemas/backend-enterprisesignupdto-a0b8b97769.md)

- `name` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `email` (required)
  Type: string, email

- `company` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `phone` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `message` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `tenant_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

## Backend_Feature

Type: string

Schema: [Backend_Feature](/api-reference/schemas/backend-feature-2027695221.md)

enum: ["chat","report","analytics","organization","teams","stripe"]

## Backend_FeatureDto

Type: object

Schema: [Backend_FeatureDto](/api-reference/schemas/backend-featuredto-af3e00c271.md)

- `name` (required)
  Reference: [Backend_Feature](/api-reference/schemas/backend-feature-2027695221.md); Type: string
  
  enum: ["chat","report","analytics","organization","teams","stripe"]

- `enabled` (required)
  Type: boolean

## Backend_FrontendLogEntry

Type: object

Frontend log entry model

Schema: [Backend_FrontendLogEntry](/api-reference/schemas/backend-frontendlogentry-306ecae18a.md)

- `timestamp` (required)
  Type: string

- `level` (required)
  Type: string

- `message` (required)
  Type: string

- `context` (optional)
  Type: unknown
  
  anyOf:
    Type: object
    
    Additional properties: true
  
    Type: null

- `stack` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `userAgent` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `url` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `userId` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `tenantId` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

## Backend_Gender

Type: string

Schema: [Backend_Gender](/api-reference/schemas/backend-gender-58aaeec09d.md)

enum: ["male","female","other","prefer_not_to_say"]

## Backend_HTTPValidationError

Type: object

Schema: [Backend_HTTPValidationError](/api-reference/schemas/backend-httpvalidationerror-b82f7839b1.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [Backend_ValidationError](/api-reference/schemas/backend-validationerror-b5b4376c23.md); Type: object

## Backend_HasPasskeysDto

Type: object

Schema: [Backend_HasPasskeysDto](/api-reference/schemas/backend-haspasskeysdto-9d9918b377.md)

- `has_passkeys` (required)
  Type: boolean

## Backend_HealthCheckResponseDto

Type: object

Schema: [Backend_HealthCheckResponseDto](/api-reference/schemas/backend-healthcheckresponsedto-7e1accbe82.md)

- `status` (required)
  Type: string
  
  Example:
  
  ```json
  "Ok"
  ```

- `postgres_status` (optional)
  Type: unknown
  
  Example:
  
  ```json
  "Ok"
  ```
  
  anyOf:
    Type: string
  
    Type: null

- `redis_status` (optional)
  Type: unknown
  
  Example:
  
  ```json
  "Ok"
  ```
  
  anyOf:
    Type: string
  
    Type: null

## Backend_IncidentDto

Type: object

Schema: [Backend_IncidentDto](/api-reference/schemas/backend-incidentdto-c1705fbacc.md)

- `id` (required)
  Type: string

- `type` (required)
  Type: string

- `severity` (required)
  Type: string
  
  enum: ["critical","warning","info"]

- `message` (required)
  Type: string

- `tenant_id` (required)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `created_at` (required)
  Type: string, date-time

## Backend_InfrastructureMetricsDto

Type: object

Schema: [Backend_InfrastructureMetricsDto](/api-reference/schemas/backend-infrastructuremetricsdto-68d176034f.md)

- `celery_queue_size` (required)
  Type: integer

- `redis_memory_mb` (required)
  Type: number

- `db_connections` (required)
  Type: integer

- `storage_used_gb` (required)
  Type: number

- `webhook_failures` (required)
  Type: integer

## Backend_InvoiceDto

Type: object

Schema: [Backend_InvoiceDto](/api-reference/schemas/backend-invoicedto-1b8b9080ea.md)

- `id` (required)
  Type: string

- `amount_due` (optional)
  Type: integer
  
  default: 0

- `amount_paid` (optional)
  Type: integer
  
  default: 0

- `amount_remaining` (optional)
  Type: integer
  
  default: 0

- `amount_overpaid` (optional)
  Type: integer
  
  default: 0

- `attempt_count` (optional)
  Type: integer
  
  default: 0

- `attempted` (optional)
  Type: boolean
  
  default: false

- `auto_advance` (optional)
  Type: boolean
  
  default: false

- `billing_reason` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `collection_method` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `created` (required)
  Type: integer

- `currency` (optional)
  Type: string
  
  default: "usd"

- `customer` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `customer_name` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `status` (optional)
  Type: string
  
  default: "open"

- `total` (optional)
  Type: integer
  
  default: 0

- `receipt_number` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `amount_country` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `account_name` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `invoice_pdf` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `hosted_invoice_url` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

## Backend_InvoiceListDto

Type: object

Schema: [Backend_InvoiceListDto](/api-reference/schemas/backend-invoicelistdto-a5e37bf2bc.md)

- `items` (required)
  Type: array
  
  Items:
    Reference: [Backend_InvoiceDto](/api-reference/schemas/backend-invoicedto-1b8b9080ea.md); Type: object

- `total` (required)
  Type: integer

- `skip` (optional)
  Type: integer
  
  default: 0

- `limit` (optional)
  Type: integer
  
  default: 10

- `has_next` (optional)
  Type: boolean
  
  default: false

- `has_previous` (optional)
  Type: boolean
  
  default: false

## Backend_LoginResponseDto

Type: object

Response after successful login with tenant selection info

Schema: [Backend_LoginResponseDto](/api-reference/schemas/backend-loginresponsedto-5578e3d759.md)

- `user` (required)
  Reference: [Backend_UserInfoDto](/api-reference/schemas/backend-userinfodto-ff6ae5e858.md); Type: object
  
  User information returned after login

- `tenants` (required)
  Type: array
  
  Items:
    Reference: [Backend_TenantInfoDto](/api-reference/schemas/backend-tenantinfodto-3aa396b19f.md); Type: object
    
    Tenant information for selection

- `requires_tenant_selection` (required)
  Type: boolean

- `is_super_admin` (required)
  Type: boolean

- `message` (optional)
  Type: string
  
  default: "Login successful"

- `token` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `refresh_token` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

## Backend_MagicLinkResponseDto

Type: object

Schema: [Backend_MagicLinkResponseDto](/api-reference/schemas/backend-magiclinkresponsedto-31a68a6458.md)

- `message` (required)
  Type: string

## Backend_MeResponseDto

Type: object

Schema: [Backend_MeResponseDto](/api-reference/schemas/backend-meresponsedto-007f2a14fa.md)

- `id` (required)
  Type: string

- `first_name` (required)
  Type: string

- `last_name` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `email` (required)
  Type: string, email

- `gender` (required)
  Reference: [Backend_Gender](/api-reference/schemas/backend-gender-58aaeec09d.md); Type: string
  
  enum: ["male","female","other","prefer_not_to_say"]

- `role_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `role_name` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `is_active` (required)
  Type: boolean

- `member_active` (optional)
  Type: boolean
  
  default: true

- `activated_at` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `image_url` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `user_code` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `created_at` (required)
  Type: string

- `updated_at` (required)
  Type: string

- `tenant_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `permissions` (optional)
  Type: unknown
  
  anyOf:
    Type: array
    
    Items:
      Type: string
  
    Type: null

- `agreed_to_terms` (optional)
  Type: boolean
  
  default: false

- `role` (required)
  Reference: [Backend_RoleDto](/api-reference/schemas/backend-roledto-67a8c19f32.md); Type: object

- `subscription` (required)
  Type: unknown
  
  anyOf:
    Reference: [Backend_SubscriptionPlanDto](/api-reference/schemas/backend-subscriptionplandto-3536ed2a97.md); Type: object
  
    Type: null

## Backend_NativeSubscriptionResponseDto

Type: object

Schema: [Backend_NativeSubscriptionResponseDto](/api-reference/schemas/backend-nativesubscriptionresponsedto-22bafd8b40.md)

- `client_secret` (required)
  Type: string

- `subscription_id` (required)
  Type: string

- `customer_id` (required)
  Type: string

- `billing_record_id` (required)
  Type: string

- `is_upgrade` (optional)
  Type: boolean
  
  default: false

- `requires_confirmation` (optional)
  Type: boolean
  
  default: true

## Backend_NotificationBannerSettingDto

Type: object

Schema: [Backend_NotificationBannerSettingDto](/api-reference/schemas/backend-notificationbannersettingdto-28e88cbb83.md)

- `is_enabled` (required)
  Type: boolean

- `message` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `id` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `tenant_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `created_at` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `updated_at` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

## Backend_OSMetricsDto

Type: object

Schema: [Backend_OSMetricsDto](/api-reference/schemas/backend-osmetricsdto-21f13fe5f1.md)

- `cpu_percent` (required)
  Type: number

- `memory_percent` (required)
  Type: number

- `memory_total_mb` (required)
  Type: number

- `memory_used_mb` (required)
  Type: number

## Backend_PasswordResetConfirmRequestDto

Type: object

Schema: [Backend_PasswordResetConfirmRequestDto](/api-reference/schemas/backend-passwordresetconfirmrequestdto-be829b2357.md)

- `new_password` (required)
  Type: string

## Backend_PasswordResetRequestDto

Type: object

Schema: [Backend_PasswordResetRequestDto](/api-reference/schemas/backend-passwordresetrequestdto-6feb304a01.md)

- `email` (required)
  Type: string, email

## Backend_PasswordResetResponseDto

Type: object

Schema: [Backend_PasswordResetResponseDto](/api-reference/schemas/backend-passwordresetresponsedto-6dd4522789.md)

- `message` (required)
  Type: string

## Backend_PaymentMethodCardDto

Type: object

Schema: [Backend_PaymentMethodCardDto](/api-reference/schemas/backend-paymentmethodcarddto-8a5b08d4b2.md)

- `brand` (required)
  Type: string

- `last4` (required)
  Type: string

- `exp_month` (required)
  Type: integer

- `exp_year` (required)
  Type: integer

- `country` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

## Backend_PaymentMethodDto

Type: object

Schema: [Backend_PaymentMethodDto](/api-reference/schemas/backend-paymentmethoddto-e072310f2c.md)

- `id` (required)
  Type: string

- `type` (required)
  Type: string

- `card` (optional)
  Type: unknown
  
  anyOf:
    Reference: [Backend_PaymentMethodCardDto](/api-reference/schemas/backend-paymentmethodcarddto-8a5b08d4b2.md); Type: object
  
    Type: null

- `created` (required)
  Type: integer

- `is_default` (optional)
  Type: boolean
  
  default: false

## Backend_PaymentMethodListDto

Type: object

Schema: [Backend_PaymentMethodListDto](/api-reference/schemas/backend-paymentmethodlistdto-e8814be407.md)

- `items` (required)
  Type: array
  
  Items:
    Reference: [Backend_PaymentMethodDto](/api-reference/schemas/backend-paymentmethoddto-e072310f2c.md); Type: object

- `customer_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

## Backend_Permission

Type: string

Schema: [Backend_Permission](/api-reference/schemas/backend-permission-f0b845e64b.md)

enum: ["super:admin","full:access","user:read_and_write_only","user:delete_only","user:self_read_and_write_only","user:role_assign_or_remove_only","user:view_only","role:view_only","role:read_and_write_only","role:delete_only","role:permission_read_and_write_only","host:manage_tenants","manage:storage_settings","manage:tenant_settings","manage:billing","manage:payments_settings","manage:products_and_pricing","audit_logs:view_only","audit_logs:download","audit_logs:write","compliance:manage","forms:render","forms:preview","forms:render_anonymous","forms:submit","forms:submit_anonymous","forms:submit_offline","forms:draft_create","forms:draft_read","forms:draft_update","forms:draft_delete","forms:draft_read_all","forms:session_create","forms:session_read","forms:session_delete","forms:session_read_all","forms:config_read","forms:config_write","forms:analytics_view","forms:analytics_export","forms:admin","dashboard:view","dashboard:read","dashboard:create","dashboard:update","dashboard:delete","billing:read","config:read","config:write","survey:manage","survey:create","survey:read","survey:update","survey:delete","survey:publish","survey:unpublish","survey:grant_access","survey:manage_access","survey:response_view","survey:response_download","template:read","template:create","template:update","template:delete","template:manage","submission:create","submission:read","submission:update","submission:update_own","submission:delete","submission:view","submission:export","submission:approve","submission:assign","workspace:create","workspace:read","workspace:update","workspace:delete","workspace:manage","workspace:manage_members","project:create","project:read","project:update","project:delete","project:manage","analytics:view","analytics:export","analytics:admin","report:view","report:create","export:create","export:view","export:download","export:cancel","export:template:create","export:template:view","webhook:create","webhook:read","webhook:update","webhook:delete","webhook:manage","search:execute","search:manage","notification:send","notification:view","notification:read_all","notification:delete","notification:manage","notification:template:view","notification:template:create","notification:template:update","notification:template:delete","notification:preferences:read","notification:preferences:write","media:upload","media:read","media:update","media:delete","media:library_upload","media:library_read","media:library_delete","media:manage","feature_flag:read","feature_flag:create","feature_flag:update","feature_flag:delete","feature_flag:toggle","response:create","response:read","response:update","response:delete","response:export","response:approve","response:revise_own","attachment:create","attachment:read","attachment:delete","odk:view","odk:submit","odk:manage"]

## Backend_PermissionCategory

Type: string

Logical grouping of permissions.

Schema: [Backend_PermissionCategory](/api-reference/schemas/backend-permissioncategory-accd03496d.md)

enum: ["User Management","Role Management","Survey Management","Form Management","Response Management","Workspace Management","Analytics","Reporting","Export","Notification","Media","System","Billing","Feature Flags","Compliance","Audit","Platform"]

## Backend_PermissionDangerLevel

Type: string

Categorizes permissions by potential system impact.

Schema: [Backend_PermissionDangerLevel](/api-reference/schemas/backend-permissiondangerlevel-4c05f0768a.md)

enum: ["low","medium","high","dangerous"]

## Backend_PermissionDto

Type: object

Schema: [Backend_PermissionDto](/api-reference/schemas/backend-permissiondto-fff0936857.md)

- `name` (required)
  Type: string

- `display_name` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `description` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `category` (optional)
  Type: unknown
  
  anyOf:
    Reference: [Backend_PermissionCategory](/api-reference/schemas/backend-permissioncategory-accd03496d.md); Type: string
    
    Logical grouping of permissions.
    
    enum: ["User Management","Role Management","Survey Management","Form Management","Response Management","Workspace Management","Analytics","Reporting","Export","Notification","Media","System","Billing","Feature Flags","Compliance","Audit","Platform"]
  
    Type: null

- `danger_level` (optional)
  Reference: [Backend_PermissionDangerLevel](/api-reference/schemas/backend-permissiondangerlevel-4c05f0768a.md); Type: string
  
  Categorizes permissions by potential system impact.
  
  default: "low"
  
  enum: ["low","medium","high","dangerous"]

## Backend_PermissionGroupedDto

Type: object

Schema: [Backend_PermissionGroupedDto](/api-reference/schemas/backend-permissiongroupeddto-e4796298d2.md)

- `category` (required)
  Reference: [Backend_PermissionCategory](/api-reference/schemas/backend-permissioncategory-accd03496d.md); Type: string
  
  Logical grouping of permissions.
  
  enum: ["User Management","Role Management","Survey Management","Form Management","Response Management","Workspace Management","Analytics","Reporting","Export","Notification","Media","System","Billing","Feature Flags","Compliance","Audit","Platform"]

- `permissions` (required)
  Type: array
  
  Items:
    Reference: [Backend_PermissionDto](/api-reference/schemas/backend-permissiondto-fff0936857.md); Type: object

## Backend_PlanDto

Type: object

Schema: [Backend_PlanDto](/api-reference/schemas/backend-plandto-591471c431.md)

- `id` (required)
  Type: string

- `active` (required)
  Type: boolean

- `amount` (required)
  Type: integer

- `amount_decimal` (required)
  Type: string

- `billing_scheme` (required)
  Type: string

- `currency` (optional)
  Type: string
  
  default: "usd"

- `interval` (required)
  Type: string

- `interval_count` (required)
  Type: integer

- `product` (required)
  Type: string

- `trial_period_days` (optional)
  Type: unknown
  
  anyOf:
    Type: integer
  
    Type: null

- `usage_type` (required)
  Type: string

## Backend_PlanListDto

Type: object

Schema: [Backend_PlanListDto](/api-reference/schemas/backend-planlistdto-c6e93917e7.md)

- `items` (required)
  Type: array
  
  Items:
    Reference: [Backend_PlanDto](/api-reference/schemas/backend-plandto-591471c431.md); Type: object

- `total` (required)
  Type: integer

- `skip` (optional)
  Type: integer
  
  default: 0

- `limit` (optional)
  Type: integer
  
  default: 10

- `has_next` (optional)
  Type: boolean
  
  default: false

- `has_previous` (optional)
  Type: boolean
  
  default: false

## Backend_PlanTierResponseDto

Type: object

Schema: [Backend_PlanTierResponseDto](/api-reference/schemas/backend-plantierresponsedto-d96e30612f.md)

- `tier` (required)
  Type: string

- `name` (required)
  Type: string

## Backend_PlatformHealthDto

Type: object

Schema: [Backend_PlatformHealthDto](/api-reference/schemas/backend-platformhealthdto-d90af6144e.md)

- `status` (required)
  Type: string
  
  enum: ["healthy","degraded","down"]

- `api_uptime_seconds` (required)
  Type: number

- `last_incident_at` (required)
  Type: unknown
  
  anyOf:
    Type: string, date-time
  
    Type: null

- `active_incidents` (required)
  Type: integer

## Backend_PricingDto

Type: object

Schema: [Backend_PricingDto](/api-reference/schemas/backend-pricingdto-6f370db28d.md)

- `id` (required)
  Type: string

- `currency` (required)
  Type: string

- `unit_amount` (required)
  Type: integer

- `product` (required)
  Type: string

- `active` (required)
  Type: boolean

- `recurring` (required)
  Reference: [Backend_RecurringDto](/api-reference/schemas/backend-recurringdto-a1f533306f.md); Type: object

- `tax_behavior` (required)
  Type: string

- `type` (required)
  Type: string

- `unit_amount_decimal` (required)
  Type: string

## Backend_PricingListDto

Type: object

Schema: [Backend_PricingListDto](/api-reference/schemas/backend-pricinglistdto-39d7e3ce33.md)

- `pricings` (required)
  Type: array
  
  Items:
    Reference: [Backend_PricingDto](/api-reference/schemas/backend-pricingdto-6f370db28d.md); Type: object

- `has_more` (required)
  Type: boolean

## Backend_ProductDto

Type: object

Schema: [Backend_ProductDto](/api-reference/schemas/backend-productdto-45e8c99190.md)

- `id` (required)
  Type: string

- `name` (required)
  Type: string

- `description` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `tax_code` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `active` (required)
  Type: boolean

## Backend_ProductListDto

Type: object

Schema: [Backend_ProductListDto](/api-reference/schemas/backend-productlistdto-a35d4183a4.md)

- `products` (required)
  Type: array
  
  Items:
    Reference: [Backend_ProductDto](/api-reference/schemas/backend-productdto-45e8c99190.md); Type: object

- `has_more` (required)
  Type: boolean

## Backend_ProvisionUserDto

Type: object

DTO for provisioning a user to a tenant (create or invite)

Schema: [Backend_ProvisionUserDto](/api-reference/schemas/backend-provisionuserdto-a7d98511b1.md)

- `email` (required)
  Type: string, email

- `role_id` (required)
  Type: string

- `password` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `first_name` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `last_name` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `gender` (optional)
  Type: unknown
  
  anyOf:
    Reference: [Backend_Gender](/api-reference/schemas/backend-gender-58aaeec09d.md); Type: string
    
    enum: ["male","female","other","prefer_not_to_say"]
  
    Type: null

## Backend_ProvisionUserResponseDto

Type: object

Response DTO for user provisioning

Schema: [Backend_ProvisionUserResponseDto](/api-reference/schemas/backend-provisionuserresponsedto-af603590a1.md)

- `id` (required)
  Type: string

- `status` (required)
  Type: string

- `message` (required)
  Type: string

## Backend_RecurringDto

Type: object

Schema: [Backend_RecurringDto](/api-reference/schemas/backend-recurringdto-a1f533306f.md)

- `interval` (optional)
  Type: string
  
  Billing interval, e.g., 'month'
  
  default: "month"
  
  enum: ["day","week","month","year"]

- `interval_count` (optional)
  Type: integer
  
  Number of intervals between each billing cycle
  
  default: 1

- `usage_type` (optional)
  Type: string
  
  Configures how the quantity per period should be determined. Can be either metered or licensed. licensed automatically bills the quantity set when adding it to a subscription. metered aggregates the total usage based on usage records. Defaults to licensed.
  
  default: "licensed"
  
  enum: ["licensed","metered"]

## Backend_RegisteredPasskeyCredentialsDto

Type: object

Schema: [Backend_RegisteredPasskeyCredentialsDto](/api-reference/schemas/backend-registeredpasskeycredentialsdto-97afa0e470.md)

- `credential_id` (required)
  Type: string

- `public_key` (required)
  Type: string

- `sigin_count` (required)
  Type: integer

- `transports` (optional)
  Type: array
  
  default: []
  
  Items:
    Reference: [Backend_AuthenticatorTransport](/api-reference/schemas/backend-authenticatortransport-99cba1153f.md); Type: string
    
    How an authenticator communicates to the client/browser.
    
    Members:
        `USB`: USB wired connection
        `NFC`: Near Field Communication
        `BLE`: Bluetooth Low Energy
        `INTERNAL`: Direct connection (read: a platform authenticator)
        `CABLE`: Cloud Assisted Bluetooth Low Energy
        `HYBRID`: A combination of (often separate) data-transport and proximity mechanisms
    
    https://www.w3.org/TR/webauthn-2/#enum-transport
    
    enum: ["usb","nfc","ble","smart-card","internal","cable","hybrid"]

- `created_at` (required)
  Type: string, date-time

- `last_used_at` (optional)
  Type: unknown
  
  anyOf:
    Type: string, date-time
  
    Type: null

## Backend_RemoteWipeCommandDto

Type: object

Schema: [Backend_RemoteWipeCommandDto](/api-reference/schemas/backend-remotewipecommanddto-4077d15808.md)

- `target_user_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `reason` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

## Backend_ReservedSubdomainsDto

Type: object

Schema: [Backend_ReservedSubdomainsDto](/api-reference/schemas/backend-reservedsubdomainsdto-0b3de77ddf.md)

- `subdomains` (required)
  Type: array
  
  Items:
    Type: string

## Backend_RoleDto

Type: object

Schema: [Backend_RoleDto](/api-reference/schemas/backend-roledto-67a8c19f32.md)

- `id` (required)
  Type: string

- `name` (required)
  Type: string

- `description` (required)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `permissions` (optional)
  Type: array
  
  default: []
  
  Items:
    Reference: [Backend_Permission](/api-reference/schemas/backend-permission-f0b845e64b.md); Type: string
    
    enum: ["super:admin","full:access","user:read_and_write_only","user:delete_only","user:self_read_and_write_only","user:role_assign_or_remove_only","user:view_only","role:view_only","role:read_and_write_only","role:delete_only","role:permission_read_and_write_only","host:manage_tenants","manage:storage_settings","manage:tenant_settings","manage:billing","manage:payments_settings","manage:products_and_pricing","audit_logs:view_only","audit_logs:download","audit_logs:write","compliance:manage","forms:render","forms:preview","forms:render_anonymous","forms:submit","forms:submit_anonymous","forms:submit_offline","forms:draft_create","forms:draft_read","forms:draft_update","forms:draft_delete","forms:draft_read_all","forms:session_create","forms:session_read","forms:session_delete","forms:session_read_all","forms:config_read","forms:config_write","forms:analytics_view","forms:analytics_export","forms:admin","dashboard:view","dashboard:read","dashboard:create","dashboard:update","dashboard:delete","billing:read","config:read","config:write","survey:manage","survey:create","survey:read","survey:update","survey:delete","survey:publish","survey:unpublish","survey:grant_access","survey:manage_access","survey:response_view","survey:response_download","template:read","template:create","template:update","template:delete","template:manage","submission:create","submission:read","submission:update","submission:update_own","submission:delete","submission:view","submission:export","submission:approve","submission:assign","workspace:create","workspace:read","workspace:update","workspace:delete","workspace:manage","workspace:manage_members","project:create","project:read","project:update","project:delete","project:manage","analytics:view","analytics:export","analytics:admin","report:view","report:create","export:create","export:view","export:download","export:cancel","export:template:create","export:template:view","webhook:create","webhook:read","webhook:update","webhook:delete","webhook:manage","search:execute","search:manage","notification:send","notification:view","notification:read_all","notification:delete","notification:manage","notification:template:view","notification:template:create","notification:template:update","notification:template:delete","notification:preferences:read","notification:preferences:write","media:upload","media:read","media:update","media:delete","media:library_upload","media:library_read","media:library_delete","media:manage","feature_flag:read","feature_flag:create","feature_flag:update","feature_flag:delete","feature_flag:toggle","response:create","response:read","response:update","response:delete","response:export","response:approve","response:revise_own","attachment:create","attachment:read","attachment:delete","odk:view","odk:submit","odk:manage"]

- `is_immutable` (optional)
  Type: boolean
  
  default: false

- `created_at` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `updated_at` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `tenant_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `scope` (optional)
  Reference: [Backend_RoleScope](/api-reference/schemas/backend-rolescope-986b18b833.md); Type: string
  
  Defines where a role can be used.
  
  default: "tenant_custom"
  
  enum: ["platform","system","tenant_custom"]

- `users_count` (optional)
  Type: integer
  
  default: 0

## Backend_RoleListDto

Type: object

Schema: [Backend_RoleListDto](/api-reference/schemas/backend-rolelistdto-5c10c1c004.md)

- `items` (required)
  Type: array
  
  Items:
    Reference: [Backend_RoleDto](/api-reference/schemas/backend-roledto-67a8c19f32.md); Type: object

- `skip` (required)
  Type: integer

- `limit` (required)
  Type: integer

- `total` (required)
  Type: integer

- `has_previous` (required)
  Type: boolean

- `has_next` (required)
  Type: boolean

## Backend_RoleScope

Type: string

Defines where a role can be used.

Schema: [Backend_RoleScope](/api-reference/schemas/backend-rolescope-986b18b833.md)

enum: ["platform","system","tenant_custom"]

## Backend_RuntimeSecurityConfigConfigDto

Type: object

Schema: [Backend_RuntimeSecurityConfigConfigDto](/api-reference/schemas/backend-runtimesecurityconfigconfigdto-eb429fabf3.md)

- `screenshot_prevention_mode` (optional)
  Type: string
  
  default: "disabled"

- `root_detection_mode` (optional)
  Type: string
  
  default: "warning"

- `biometric_required_mode` (optional)
  Type: string
  
  default: "disabled"

- `session_timeout_minutes` (optional)
  Type: integer
  
  default: 0

- `wifi_only_sync` (optional)
  Type: boolean
  
  default: false

- `battery_aware_sync` (optional)
  Type: boolean
  
  default: false

- `battery_low_threshold_percent` (optional)
  Type: integer
  
  default: 20

- `block_sync_on_roaming` (optional)
  Type: boolean
  
  default: false

- `background_sync_enabled` (optional)
  Type: boolean
  
  default: true

- `crash_reporting_enabled` (optional)
  Type: boolean
  
  default: true

- `telemetry_enabled` (optional)
  Type: boolean
  
  default: true

- `global_mode` (optional)
  Type: string
  
  default: "warning"

- `version_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

## Backend_RuntimeSecurityConfigDto

Type: object

Schema: [Backend_RuntimeSecurityConfigDto](/api-reference/schemas/backend-runtimesecurityconfigdto-6fd5420810.md)

- `id` (optional)
  Type: string
  
  default: "system_default"

- `screenshot_prevention_mode` (optional)
  Type: string
  
  default: "disabled"
  
  enum: ["strict","warning","disabled"]

- `root_detection_mode` (optional)
  Type: string
  
  default: "warning"
  
  enum: ["strict","warning","disabled"]

- `biometric_required_mode` (optional)
  Type: string
  
  default: "disabled"
  
  enum: ["strict","warning","disabled"]

- `session_timeout_minutes` (optional)
  Type: integer
  
  default: 0

- `wifi_only_sync` (optional)
  Type: boolean
  
  default: false

- `battery_aware_sync` (optional)
  Type: boolean
  
  default: false

- `battery_low_threshold_percent` (optional)
  Type: integer
  
  default: 20

- `block_sync_on_roaming` (optional)
  Type: boolean
  
  default: false

- `background_sync_enabled` (optional)
  Type: boolean
  
  default: true

- `crash_reporting_enabled` (optional)
  Type: boolean
  
  default: true

- `telemetry_enabled` (optional)
  Type: boolean
  
  default: true

- `global_mode` (optional)
  Type: string
  
  default: "warning"
  
  enum: ["strict","warning","disabled"]

- `version_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `updated_at` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `updated_by` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

## Backend_SetPrimaryTenantDto

Type: object

DTO for setting primary tenant

Schema: [Backend_SetPrimaryTenantDto](/api-reference/schemas/backend-setprimarytenantdto-2023e6d94c.md)

- `tenant_id` (required)
  Type: string

## Backend_SetupIntentDto

Type: object

Schema: [Backend_SetupIntentDto](/api-reference/schemas/backend-setupintentdto-cffd034048.md)

- `client_secret` (required)
  Type: string

- `setup_intent_id` (required)
  Type: string

## Backend_SubdomainAvailabilityDto

Type: object

Schema: [Backend_SubdomainAvailabilityDto](/api-reference/schemas/backend-subdomainavailabilitydto-1443b51036.md)

- `is_available` (required)
  Type: boolean

- `reason` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

## Backend_SubmissionMetricsDto

Type: object

Schema: [Backend_SubmissionMetricsDto](/api-reference/schemas/backend-submissionmetricsdto-53063ef6d6.md)

- `submissions_today` (required)
  Type: integer

- `submissions_this_week` (required)
  Type: integer

- `submissions_this_month` (required)
  Type: integer

- `submissions_trend` (required)
  Type: array
  
  Items:
    Type: object
    
    Additional properties: 
      Type: integer

## Backend_SubscriptionMetricsDto

Type: object

Schema: [Backend_SubscriptionMetricsDto](/api-reference/schemas/backend-subscriptionmetricsdto-b8ff6de0f8.md)

- `mrr` (required)
  Type: number

- `active_subscriptions` (required)
  Type: integer

- `trials_running` (required)
  Type: integer

- `cancelled_this_month` (required)
  Type: integer

- `plans_breakdown` (required)
  Type: object
  
  Additional properties: 
    Type: integer

## Backend_SubscriptionPlanDto

Type: object

Schema: [Backend_SubscriptionPlanDto](/api-reference/schemas/backend-subscriptionplandto-3536ed2a97.md)

- `id` (required)
  Type: string

- `plan_levels` (required)
  Type: object
  
  e.g., {'basic': 0, 'pro': 1, 'enterprise': 2}
  
  Additional properties: 
    Type: integer

- `is_trial` (required)
  Type: boolean
  
  Indicates if the subscription is a trial

- `tenant_id` (required)
  Type: unknown
  
  The tenant who owns the subscription
  
  anyOf:
    Type: string
  
    Type: null

- `actor` (required)
  Type: string
  
  who it is applied to, If end_user, then user_id must be set

- `user_id` (required)
  Type: unknown
  
  The end user who has this subscription, if applicable
  
  anyOf:
    Type: string
  
    Type: null

- `plan_id` (required)
  Type: string
  
  Corresponding Stripe Price ID

- `plan_name` (optional)
  Type: unknown
  
  Plan name like Free, Starter, Pro, Enterprise
  
  anyOf:
    Type: string
  
    Type: null

- `stripe_subscription_status` (optional)
  Type: unknown
  
  Stripe subscription status: active, trialing, incomplete, past_due, etc.
  
  anyOf:
    Type: string
  
    Type: null

- `trial_end_at` (optional)
  Type: unknown
  
  Trial end date if applicable
  
  anyOf:
    Type: string
  
    Type: null

## Backend_SuperadminDashboardDto

Type: object

Schema: [Backend_SuperadminDashboardDto](/api-reference/schemas/backend-superadmindashboarddto-2f95ba6abf.md)

- `tenants` (required)
  Reference: [Backend_TenantMetricsDto](/api-reference/schemas/backend-tenantmetricsdto-ad649af931.md); Type: object

- `submissions` (required)
  Reference: [Backend_SubmissionMetricsDto](/api-reference/schemas/backend-submissionmetricsdto-53063ef6d6.md); Type: object

- `users` (required)
  Reference: [Backend_UserMetricsDto](/api-reference/schemas/backend-usermetricsdto-a515a0d4e1.md); Type: object

- `subscriptions` (required)
  Reference: [Backend_SubscriptionMetricsDto](/api-reference/schemas/backend-subscriptionmetricsdto-b8ff6de0f8.md); Type: object

- `infrastructure` (required)
  Reference: [Backend_InfrastructureMetricsDto](/api-reference/schemas/backend-infrastructuremetricsdto-68d176034f.md); Type: object

- `incidents` (required)
  Type: array
  
  Items:
    Reference: [Backend_IncidentDto](/api-reference/schemas/backend-incidentdto-c1705fbacc.md); Type: object

- `platform_health` (required)
  Reference: [Backend_PlatformHealthDto](/api-reference/schemas/backend-platformhealthdto-d90af6144e.md); Type: object

- `submissions_trend` (required)
  Type: array
  
  Items:
    Reference: [Backend_TimeSeriesPointDto](/api-reference/schemas/backend-timeseriespointdto-f9a436c50d.md); Type: object

- `tenant_growth_trend` (required)
  Type: array
  
  Items:
    Reference: [Backend_TimeSeriesPointDto](/api-reference/schemas/backend-timeseriespointdto-f9a436c50d.md); Type: object

- `recent_tenant_activity` (required)
  Type: array
  
  Items:
    Reference: [Backend_TenantActivityDto](/api-reference/schemas/backend-tenantactivitydto-7dcc16ba06.md); Type: object

## Backend_SwitchTenantRequestDto

Type: object

Request to switch active tenant

Schema: [Backend_SwitchTenantRequestDto](/api-reference/schemas/backend-switchtenantrequestdto-109a073cee.md)

- `tenant_id` (required)
  Type: string

## Backend_SwitchTenantResponseDto

Type: object

Response after switching tenant with new tokens and context

Schema: [Backend_SwitchTenantResponseDto](/api-reference/schemas/backend-switchtenantresponsedto-557e91b7a6.md)

- `access_token` (required)
  Type: string

- `token_type` (optional)
  Type: string
  
  default: "bearer"

- `expires_in` (required)
  Type: integer

- `refresh_token` (required)
  Type: string

- `refresh_token_expires_in` (required)
  Type: integer

- `user` (required)
  Reference: [Backend_UserInfoDto](/api-reference/schemas/backend-userinfodto-ff6ae5e858.md); Type: object
  
  User information returned after login

- `tenant` (required)
  Reference: [Backend_TenantInfoDto](/api-reference/schemas/backend-tenantinfodto-3aa396b19f.md); Type: object
  
  Tenant information for selection

- `previous_tenant_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `message` (optional)
  Type: string
  
  default: "Tenant switched successfully"

## Backend_SystemMetricsResponseDto

Type: object

Schema: [Backend_SystemMetricsResponseDto](/api-reference/schemas/backend-systemmetricsresponsedto-d200f89821.md)

- `os_metrics` (required)
  Reference: [Backend_OSMetricsDto](/api-reference/schemas/backend-osmetricsdto-21f13fe5f1.md); Type: object

- `celery_metrics` (optional)
  Type: unknown
  
  anyOf:
    Reference: [Backend_CeleryMetricsDto](/api-reference/schemas/backend-celerymetricsdto-49e2d9128d.md); Type: object
  
    Type: null

## Backend_TenantAccessUpdateDto

Type: object

DTO for updating a user's per-tenant access (activate/deactivate in the active tenant)

Schema: [Backend_TenantAccessUpdateDto](/api-reference/schemas/backend-tenantaccessupdatedto-3177c8ec59.md)

- `is_active` (required)
  Type: boolean

## Backend_TenantActivityDto

Type: object

Schema: [Backend_TenantActivityDto](/api-reference/schemas/backend-tenantactivitydto-7dcc16ba06.md)

- `tenant_id` (required)
  Type: string

- `tenant_name` (required)
  Type: string

- `subdomain` (required)
  Type: string

- `plan` (required)
  Type: string

- `users_count` (required)
  Type: integer

- `surveys_count` (required)
  Type: integer

- `submissions_count` (required)
  Type: integer

- `last_activity_at` (required)
  Type: unknown
  
  anyOf:
    Type: string, date-time
  
    Type: null

- `status` (required)
  Type: string
  
  enum: ["active","idle","suspended","empty"]

## Backend_TenantDataGovernanceConfigDto

Type: object

Schema: [Backend_TenantDataGovernanceConfigDto](/api-reference/schemas/backend-tenantdatagovernanceconfigdto-014c260309.md)

- `tenant_id` (required)
  Type: string

- `max_offline_duration_hours` (optional)
  Type: integer
  
  default: 0

- `force_revalidation_hours` (optional)
  Type: integer
  
  default: 0

- `media_upload_max_size_mb` (optional)
  Type: integer
  
  default: 50

- `media_upload_allowed_types` (optional)
  Type: unknown
  
  anyOf:
    Type: array
    
    Items:
      Type: string
  
    Type: null

- `local_retention_days` (optional)
  Type: integer
  
  default: 0

- `remote_wipe_enabled` (optional)
  Type: boolean
  
  default: false

- `version_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

## Backend_TenantDataGovernanceDto

Type: object

Schema: [Backend_TenantDataGovernanceDto](/api-reference/schemas/backend-tenantdatagovernancedto-180efcbf5f.md)

- `id` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `tenant_id` (required)
  Type: string

- `max_offline_duration_hours` (optional)
  Type: integer
  
  default: 0

- `force_revalidation_hours` (optional)
  Type: integer
  
  default: 0

- `media_upload_max_size_mb` (optional)
  Type: integer
  
  default: 50

- `media_upload_allowed_types` (optional)
  Type: unknown
  
  anyOf:
    Type: array
    
    Items:
      Type: unknown
  
    Type: null

- `local_retention_days` (optional)
  Type: integer
  
  default: 0

- `remote_wipe_enabled` (optional)
  Type: boolean
  
  default: false

- `version_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

## Backend_TenantDataGovernanceResponseDto

Type: object

Schema: [Backend_TenantDataGovernanceResponseDto](/api-reference/schemas/backend-tenantdatagovernanceresponsedto-d90a8842aa.md)

- `message` (required)
  Type: string

- `governance` (optional)
  Type: unknown
  
  anyOf:
    Reference: [Backend_TenantDataGovernanceDto](/api-reference/schemas/backend-tenantdatagovernancedto-180efcbf5f.md); Type: object
  
    Type: null

## Backend_TenantDto

Type: object

Schema: [Backend_TenantDto](/api-reference/schemas/backend-tenantdto-b9c2bf7a81.md)

- `id` (required)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `name` (required)
  Type: string

- `subdomain` (required)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `is_active` (required)
  Type: boolean

- `custom_domain` (required)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `custom_domain_status` (optional)
  Type: string
  
  default: "failed"
  
  enum: ["active","failed","activation-progress"]

- `features` (optional)
  Type: array
  
  default: []
  
  Items:
    Reference: [Backend_FeatureDto](/api-reference/schemas/backend-featuredto-af3e00c271.md); Type: object

- `subscription_id` (required)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `plan_tier` (optional)
  Type: string
  
  default: "free"

- `is_trial` (optional)
  Type: boolean
  
  default: false

- `trial_end_at` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `has_had_trial` (optional)
  Type: boolean
  
  default: false

- `is_dormant` (optional)
  Type: boolean
  
  default: false

- `billing_individual_name` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `billing_business_name` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `billing_address_line1` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `billing_address_line2` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `billing_address_city` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `billing_address_state` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `billing_address_postal_code` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `billing_address_country` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `tax_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

## Backend_TenantInfoDto

Type: object

Tenant information for selection

Schema: [Backend_TenantInfoDto](/api-reference/schemas/backend-tenantinfodto-3aa396b19f.md)

- `id` (required)
  Type: string

- `name` (required)
  Type: string

- `subdomain` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `custom_domain` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `logo_url` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `role` (optional)
  Type: unknown
  
  anyOf:
    Reference: [Backend_RoleDto](/api-reference/schemas/backend-roledto-67a8c19f32.md); Type: object
  
    Type: null

## Backend_TenantInvoiceExportDto

Type: object

Schema: [Backend_TenantInvoiceExportDto](/api-reference/schemas/backend-tenantinvoiceexportdto-341c930220.md)

- `id` (required)
  Type: string

- `invoice_number` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `created` (required)
  Type: integer

- `due_date` (optional)
  Type: unknown
  
  anyOf:
    Type: integer
  
    Type: null

- `status` (optional)
  Type: string
  
  default: "open"

- `currency` (optional)
  Type: string
  
  default: "usd"

- `amount_due` (optional)
  Type: integer
  
  default: 0

- `amount_paid` (optional)
  Type: integer
  
  default: 0

- `tax_amount` (optional)
  Type: integer
  
  default: 0

- `total` (optional)
  Type: integer
  
  default: 0

- `billing_reason` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `customer_name` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `tenant_name` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `tenant_tax_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `invoice_pdf` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `hosted_invoice_url` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `line_items` (optional)
  Type: array
  
  default: []
  
  Items:
    Reference: [Backend_TenantInvoiceLineItemDto](/api-reference/schemas/backend-tenantinvoicelineitemdto-5c5e2870ad.md); Type: object

## Backend_TenantInvoiceLineItemDto

Type: object

Schema: [Backend_TenantInvoiceLineItemDto](/api-reference/schemas/backend-tenantinvoicelineitemdto-5c5e2870ad.md)

- `description` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `quantity` (optional)
  Type: integer
  
  default: 1

- `unit_amount` (optional)
  Type: integer
  
  default: 0

- `amount` (optional)
  Type: integer
  
  default: 0

- `currency` (optional)
  Type: string
  
  default: "usd"

## Backend_TenantInvoiceListDto

Type: object

Schema: [Backend_TenantInvoiceListDto](/api-reference/schemas/backend-tenantinvoicelistdto-d564a4d9d3.md)

- `items` (required)
  Type: array
  
  Items:
    Reference: [Backend_TenantInvoiceExportDto](/api-reference/schemas/backend-tenantinvoiceexportdto-341c930220.md); Type: object

- `total` (required)
  Type: integer

- `skip` (optional)
  Type: integer
  
  default: 0

- `limit` (optional)
  Type: integer
  
  default: 10

- `has_next` (optional)
  Type: boolean
  
  default: false

- `has_previous` (optional)
  Type: boolean
  
  default: false

## Backend_TenantListDto

Type: object

Schema: [Backend_TenantListDto](/api-reference/schemas/backend-tenantlistdto-bb0dd28b63.md)

- `items` (required)
  Type: array
  
  Items:
    Reference: [Backend_TenantDto](/api-reference/schemas/backend-tenantdto-b9c2bf7a81.md); Type: object

- `skip` (required)
  Type: integer

- `limit` (required)
  Type: integer

- `total` (required)
  Type: integer

- `has_previous` (required)
  Type: boolean

- `has_next` (required)
  Type: boolean

## Backend_TenantMetricsDto

Type: object

Schema: [Backend_TenantMetricsDto](/api-reference/schemas/backend-tenantmetricsdto-ad649af931.md)

- `total_tenants` (required)
  Type: integer

- `active_tenants_30d` (required)
  Type: integer

- `new_tenants_this_month` (required)
  Type: integer

- `suspended_tenants` (required)
  Type: integer

## Backend_TenantPlanContextResponseDto

Type: object

Schema: [Backend_TenantPlanContextResponseDto](/api-reference/schemas/backend-tenantplancontextresponsedto-cfe702fa66.md)

- `tenant_id` (required)
  Type: string

- `tier` (required)
  Type: string

- `name` (required)
  Type: string

- `subscription_status` (optional)
  Type: string
  
  default: "inactive"

- `is_active` (optional)
  Type: boolean
  
  default: false

- `is_trial` (optional)
  Type: boolean
  
  default: false

- `trial_end_at` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `is_dormant` (optional)
  Type: boolean
  
  default: false

- `features` (optional)
  Type: array
  
  Items:
    Type: object
    
    Additional properties: true

## Backend_TenantSelectionRequestDto

Type: object

Request to select a tenant and get tokens

Schema: [Backend_TenantSelectionRequestDto](/api-reference/schemas/backend-tenantselectionrequestdto-36226bd840.md)

- `tenant_id` (required)
  Type: string

## Backend_TenantSelectionResponseDto

Type: object

Response after tenant selection with tokens

Schema: [Backend_TenantSelectionResponseDto](/api-reference/schemas/backend-tenantselectionresponsedto-e9c438b891.md)

- `access_token` (required)
  Type: string

- `token_type` (optional)
  Type: string
  
  default: "bearer"

- `expires_in` (required)
  Type: integer

- `refresh_token` (required)
  Type: string

- `refresh_token_expires_in` (required)
  Type: integer

- `user` (required)
  Reference: [Backend_UserInfoDto](/api-reference/schemas/backend-userinfodto-ff6ae5e858.md); Type: object
  
  User information returned after login

- `tenant` (optional)
  Type: unknown
  
  anyOf:
    Reference: [Backend_TenantInfoDto](/api-reference/schemas/backend-tenantinfodto-3aa396b19f.md); Type: object
    
    Tenant information for selection
  
    Type: null

## Backend_TimeSeriesDto

Type: object

Schema: [Backend_TimeSeriesDto](/api-reference/schemas/backend-timeseriesdto-59f782b33b.md)

- `time_or_date` (required)
  Type: string

- `count` (required)
  Type: integer

## Backend_TimeSeriesPointDto

Type: object

Schema: [Backend_TimeSeriesPointDto](/api-reference/schemas/backend-timeseriespointdto-f9a436c50d.md)

- `date` (required)
  Type: string

- `count` (required)
  Type: integer

## Backend_TokenSetDto

Type: object

Schema: [Backend_TokenSetDto](/api-reference/schemas/backend-tokensetdto-c03c3c3d30.md)

- `refresh_token` (required)
  Type: string

- `refresh_token_expires_in` (required)
  Type: integer

- `access_token` (required)
  Type: string

- `token_type` (required)
  Type: string

- `expires_in` (required)
  Type: integer

## Backend_UpdateBillingAddressDto

Type: object

Schema: [Backend_UpdateBillingAddressDto](/api-reference/schemas/backend-updatebillingaddressdto-a96c248e7a.md)

- `address` (required)
  Reference: [Backend_BillingAddressDto](/api-reference/schemas/backend-billingaddressdto-4cf9dcd9fa.md); Type: object

- `tax_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

## Backend_UpdatePlanDto

Type: object

Schema: [Backend_UpdatePlanDto](/api-reference/schemas/backend-updateplandto-2433de4034.md)

- `trial_period_days` (required)
  Type: integer

- `active` (optional)
  Type: boolean
  
  default: true

- `metadata` (optional)
  Type: unknown
  
  anyOf:
    Type: object
    
    Additional properties: true
  
    Type: null

## Backend_UpdatePricingDto

Type: object

Schema: [Backend_UpdatePricingDto](/api-reference/schemas/backend-updatepricingdto-6a5173adda.md)

- `active` (required)
  Type: boolean

- `metadata` (optional)
  Type: unknown
  
  anyOf:
    Type: object
    
    Additional properties: true
  
    Type: null

- `tax_behavior` (optional)
  Type: unknown
  
  anyOf:
    Type: string
    
    enum: ["exclusive","inclusive","unspecified"]
  
    Type: null

## Backend_UpdateRoleDto

Type: object

Schema: [Backend_UpdateRoleDto](/api-reference/schemas/backend-updateroledto-11a3356246.md)

- `name` (required)
  Type: string

- `description` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `tenant_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `permissions` (optional)
  Type: array
  
  Items:
    Reference: [Backend_Permission](/api-reference/schemas/backend-permission-f0b845e64b.md); Type: string
    
    enum: ["super:admin","full:access","user:read_and_write_only","user:delete_only","user:self_read_and_write_only","user:role_assign_or_remove_only","user:view_only","role:view_only","role:read_and_write_only","role:delete_only","role:permission_read_and_write_only","host:manage_tenants","manage:storage_settings","manage:tenant_settings","manage:billing","manage:payments_settings","manage:products_and_pricing","audit_logs:view_only","audit_logs:download","audit_logs:write","compliance:manage","forms:render","forms:preview","forms:render_anonymous","forms:submit","forms:submit_anonymous","forms:submit_offline","forms:draft_create","forms:draft_read","forms:draft_update","forms:draft_delete","forms:draft_read_all","forms:session_create","forms:session_read","forms:session_delete","forms:session_read_all","forms:config_read","forms:config_write","forms:analytics_view","forms:analytics_export","forms:admin","dashboard:view","dashboard:read","dashboard:create","dashboard:update","dashboard:delete","billing:read","config:read","config:write","survey:manage","survey:create","survey:read","survey:update","survey:delete","survey:publish","survey:unpublish","survey:grant_access","survey:manage_access","survey:response_view","survey:response_download","template:read","template:create","template:update","template:delete","template:manage","submission:create","submission:read","submission:update","submission:update_own","submission:delete","submission:view","submission:export","submission:approve","submission:assign","workspace:create","workspace:read","workspace:update","workspace:delete","workspace:manage","workspace:manage_members","project:create","project:read","project:update","project:delete","project:manage","analytics:view","analytics:export","analytics:admin","report:view","report:create","export:create","export:view","export:download","export:cancel","export:template:create","export:template:view","webhook:create","webhook:read","webhook:update","webhook:delete","webhook:manage","search:execute","search:manage","notification:send","notification:view","notification:read_all","notification:delete","notification:manage","notification:template:view","notification:template:create","notification:template:update","notification:template:delete","notification:preferences:read","notification:preferences:write","media:upload","media:read","media:update","media:delete","media:library_upload","media:library_read","media:library_delete","media:manage","feature_flag:read","feature_flag:create","feature_flag:update","feature_flag:delete","feature_flag:toggle","response:create","response:read","response:update","response:delete","response:export","response:approve","response:revise_own","attachment:create","attachment:read","attachment:delete","odk:view","odk:submit","odk:manage"]

- `is_immutable` (optional)
  Type: boolean
  
  default: false

## Backend_UpdateRolePermissionsDto

Type: object

Schema: [Backend_UpdateRolePermissionsDto](/api-reference/schemas/backend-updaterolepermissionsdto-cc5e27857c.md)

- `permissions` (optional)
  Type: array
  
  Items:
    Reference: [Backend_Permission](/api-reference/schemas/backend-permission-f0b845e64b.md); Type: string
    
    enum: ["super:admin","full:access","user:read_and_write_only","user:delete_only","user:self_read_and_write_only","user:role_assign_or_remove_only","user:view_only","role:view_only","role:read_and_write_only","role:delete_only","role:permission_read_and_write_only","host:manage_tenants","manage:storage_settings","manage:tenant_settings","manage:billing","manage:payments_settings","manage:products_and_pricing","audit_logs:view_only","audit_logs:download","audit_logs:write","compliance:manage","forms:render","forms:preview","forms:render_anonymous","forms:submit","forms:submit_anonymous","forms:submit_offline","forms:draft_create","forms:draft_read","forms:draft_update","forms:draft_delete","forms:draft_read_all","forms:session_create","forms:session_read","forms:session_delete","forms:session_read_all","forms:config_read","forms:config_write","forms:analytics_view","forms:analytics_export","forms:admin","dashboard:view","dashboard:read","dashboard:create","dashboard:update","dashboard:delete","billing:read","config:read","config:write","survey:manage","survey:create","survey:read","survey:update","survey:delete","survey:publish","survey:unpublish","survey:grant_access","survey:manage_access","survey:response_view","survey:response_download","template:read","template:create","template:update","template:delete","template:manage","submission:create","submission:read","submission:update","submission:update_own","submission:delete","submission:view","submission:export","submission:approve","submission:assign","workspace:create","workspace:read","workspace:update","workspace:delete","workspace:manage","workspace:manage_members","project:create","project:read","project:update","project:delete","project:manage","analytics:view","analytics:export","analytics:admin","report:view","report:create","export:create","export:view","export:download","export:cancel","export:template:create","export:template:view","webhook:create","webhook:read","webhook:update","webhook:delete","webhook:manage","search:execute","search:manage","notification:send","notification:view","notification:read_all","notification:delete","notification:manage","notification:template:view","notification:template:create","notification:template:update","notification:template:delete","notification:preferences:read","notification:preferences:write","media:upload","media:read","media:update","media:delete","media:library_upload","media:library_read","media:library_delete","media:manage","feature_flag:read","feature_flag:create","feature_flag:update","feature_flag:delete","feature_flag:toggle","response:create","response:read","response:update","response:delete","response:export","response:approve","response:revise_own","attachment:create","attachment:read","attachment:delete","odk:view","odk:submit","odk:manage"]

## Backend_UpdateRuntimeSecurityConfigDto

Type: object

Schema: [Backend_UpdateRuntimeSecurityConfigDto](/api-reference/schemas/backend-updateruntimesecurityconfigdto-71765e5a41.md)

- `screenshot_prevention_mode` (optional)
  Type: unknown
  
  anyOf:
    Type: string
    
    enum: ["strict","warning","disabled"]
  
    Type: null

- `root_detection_mode` (optional)
  Type: unknown
  
  anyOf:
    Type: string
    
    enum: ["strict","warning","disabled"]
  
    Type: null

- `biometric_required_mode` (optional)
  Type: unknown
  
  anyOf:
    Type: string
    
    enum: ["strict","warning","disabled"]
  
    Type: null

- `session_timeout_minutes` (optional)
  Type: unknown
  
  anyOf:
    Type: integer
    
    minimum: 0
    
    maximum: 1440
  
    Type: null

- `wifi_only_sync` (optional)
  Type: unknown
  
  anyOf:
    Type: boolean
  
    Type: null

- `battery_aware_sync` (optional)
  Type: unknown
  
  anyOf:
    Type: boolean
  
    Type: null

- `battery_low_threshold_percent` (optional)
  Type: unknown
  
  anyOf:
    Type: integer
    
    minimum: 1
    
    maximum: 100
  
    Type: null

- `block_sync_on_roaming` (optional)
  Type: unknown
  
  anyOf:
    Type: boolean
  
    Type: null

- `background_sync_enabled` (optional)
  Type: unknown
  
  anyOf:
    Type: boolean
  
    Type: null

- `crash_reporting_enabled` (optional)
  Type: unknown
  
  anyOf:
    Type: boolean
  
    Type: null

- `telemetry_enabled` (optional)
  Type: unknown
  
  anyOf:
    Type: boolean
  
    Type: null

- `global_mode` (optional)
  Type: unknown
  
  anyOf:
    Type: string
    
    enum: ["strict","warning","disabled"]
  
    Type: null

## Backend_UpdateTenantDataGovernanceDto

Type: object

Schema: [Backend_UpdateTenantDataGovernanceDto](/api-reference/schemas/backend-updatetenantdatagovernancedto-54fa3b7f30.md)

- `max_offline_duration_hours` (optional)
  Type: unknown
  
  anyOf:
    Type: integer
    
    minimum: 0
  
    Type: null

- `force_revalidation_hours` (optional)
  Type: unknown
  
  anyOf:
    Type: integer
    
    minimum: 0
  
    Type: null

- `media_upload_max_size_mb` (optional)
  Type: unknown
  
  anyOf:
    Type: integer
    
    minimum: 1
    
    maximum: 500
  
    Type: null

- `media_upload_allowed_types` (optional)
  Type: unknown
  
  anyOf:
    Type: array
    
    Items:
      Type: unknown
  
    Type: null

- `local_retention_days` (optional)
  Type: unknown
  
  anyOf:
    Type: integer
    
    minimum: 0
  
    Type: null

- `remote_wipe_enabled` (optional)
  Type: unknown
  
  anyOf:
    Type: boolean
  
    Type: null

## Backend_UpdateTenantDto

Type: object

Schema: [Backend_UpdateTenantDto](/api-reference/schemas/backend-updatetenantdto-dc31cf016f.md)

- `is_active` (optional)
  Type: unknown
  
  anyOf:
    Type: boolean
  
    Type: null

- `is_dormant` (optional)
  Type: unknown
  
  anyOf:
    Type: boolean
  
    Type: null

- `custom_domain` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `subscription_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `plan_tier` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `custom_domain_status` (optional)
  Type: unknown
  
  anyOf:
    Type: string
    
    enum: ["active","failed","activation-progress"]
  
    Type: null

- `billing_individual_name` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `billing_business_name` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `billing_address_line1` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `billing_address_line2` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `billing_address_city` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `billing_address_state` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `billing_address_postal_code` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `billing_address_country` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `tax_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

## Backend_UpdateTenantResponseDto

Type: object

Schema: [Backend_UpdateTenantResponseDto](/api-reference/schemas/backend-updatetenantresponsedto-f75aa0d8da.md)

- `message` (required)
  Type: string

## Backend_UpdateUserDto

Type: object

Schema: [Backend_UpdateUserDto](/api-reference/schemas/backend-updateuserdto-f76ba6d54a.md)

- `first_name` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `last_name` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `email` (optional)
  Type: unknown
  
  anyOf:
    Type: string, email
  
    Type: null

- `gender` (optional)
  Type: unknown
  
  anyOf:
    Reference: [Backend_Gender](/api-reference/schemas/backend-gender-58aaeec09d.md); Type: string
    
    enum: ["male","female","other","prefer_not_to_say"]
  
    Type: null

- `image_url` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `role_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `is_active` (optional)
  Type: unknown
  
  anyOf:
    Type: boolean
  
    Type: null

- `activated_at` (optional)
  Type: unknown
  
  anyOf:
    Type: string, date-time
  
    Type: null

- `tenant_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `password` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

## Backend_UserActivationRequestDto

Type: object

Schema: [Backend_UserActivationRequestDto](/api-reference/schemas/backend-useractivationrequestdto-4493d0eebd.md)

- `token` (required)
  Type: string

## Backend_UserCountDto

Type: object

Schema: [Backend_UserCountDto](/api-reference/schemas/backend-usercountdto-fcc6c2e8f0.md)

- `total` (required)
  Type: integer

## Backend_UserDto

Type: object

Schema: [Backend_UserDto](/api-reference/schemas/backend-userdto-dff074e6e0.md)

- `id` (required)
  Type: string

- `first_name` (required)
  Type: string

- `last_name` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `email` (required)
  Type: string, email

- `gender` (required)
  Reference: [Backend_Gender](/api-reference/schemas/backend-gender-58aaeec09d.md); Type: string
  
  enum: ["male","female","other","prefer_not_to_say"]

- `role_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `role_name` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `is_active` (required)
  Type: boolean

- `member_active` (optional)
  Type: boolean
  
  default: true

- `activated_at` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `image_url` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `user_code` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `created_at` (required)
  Type: string

- `updated_at` (required)
  Type: string

- `tenant_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `permissions` (optional)
  Type: unknown
  
  anyOf:
    Type: array
    
    Items:
      Type: string
  
    Type: null

- `agreed_to_terms` (optional)
  Type: boolean
  
  default: false

## Backend_UserInfoDto

Type: object

User information returned after login

Schema: [Backend_UserInfoDto](/api-reference/schemas/backend-userinfodto-ff6ae5e858.md)

- `id` (required)
  Type: string

- `email` (required)
  Type: string

- `first_name` (required)
  Type: string

- `last_name` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `image_url` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `is_active` (required)
  Type: boolean

- `activated_at` (optional)
  Type: unknown
  
  anyOf:
    Type: string, date-time
  
    Type: null

- `role` (optional)
  Type: unknown
  
  anyOf:
    Reference: [Backend_RoleDto](/api-reference/schemas/backend-roledto-67a8c19f32.md); Type: object
  
    Type: null

- `user_code` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

## Backend_UserListDto

Type: object

Schema: [Backend_UserListDto](/api-reference/schemas/backend-userlistdto-f264831fe0.md)

- `items` (required)
  Type: array
  
  Items:
    Reference: [Backend_UserDto](/api-reference/schemas/backend-userdto-dff074e6e0.md); Type: object

- `skip` (required)
  Type: integer

- `limit` (required)
  Type: integer

- `total` (required)
  Type: integer

- `has_previous` (required)
  Type: boolean

- `has_next` (required)
  Type: boolean

## Backend_UserMetricsDto

Type: object

Schema: [Backend_UserMetricsDto](/api-reference/schemas/backend-usermetricsdto-a515a0d4e1.md)

- `total_users` (required)
  Type: integer

- `active_users_30d` (required)
  Type: integer

- `new_users_this_month` (required)
  Type: integer

## Backend_UserPreferenceDto

Type: object

Schema: [Backend_UserPreferenceDto](/api-reference/schemas/backend-userpreferencedto-82d1d1bb6a.md)

- `user_id` (required)
  Type: string

- `preferences` (required)
  Type: object
  
  Additional properties: true

## Backend_UserProfileImageUpdateDto

Type: object

Schema: [Backend_UserProfileImageUpdateDto](/api-reference/schemas/backend-userprofileimageupdatedto-3f65b4d22e.md)

- `image_url` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

## Backend_UserResendActivationEmailRequestDto

Type: object

Schema: [Backend_UserResendActivationEmailRequestDto](/api-reference/schemas/backend-userresendactivationemailrequestdto-c1e2c2a500.md)

- `email` (required)
  Type: string, email

- `id` (required)
  Type: string

- `first_name` (required)
  Type: string

- `tenant_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

## Backend_UserRoleUpdateRequestDto

Type: object

Schema: [Backend_UserRoleUpdateRequestDto](/api-reference/schemas/backend-userroleupdaterequestdto-8e940551d0.md)

- `role_id` (required)
  Type: string

## Backend_UserTenantCreateDto

Type: object

DTO for creating user-tenant relationship

Schema: [Backend_UserTenantCreateDto](/api-reference/schemas/backend-usertenantcreatedto-9349389c4c.md)

- `user_id` (required)
  Type: string

- `tenant_id` (required)
  Type: string

- `role_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `is_primary` (optional)
  Type: boolean
  
  default: false

- `is_active` (optional)
  Type: boolean
  
  default: true

## Backend_UserTenantDto

Type: object

DTO for user-tenant relationship

Schema: [Backend_UserTenantDto](/api-reference/schemas/backend-usertenantdto-55d675b543.md)

- `id` (required)
  Type: string

- `user_id` (required)
  Type: string

- `tenant_id` (required)
  Type: string

- `tenant_name` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `role_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `role_name` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `permissions` (optional)
  Type: array
  
  default: []
  
  Items:
    Type: string

- `is_primary` (required)
  Type: boolean

- `is_active` (optional)
  Type: boolean
  
  default: true

- `joined_at` (required)
  Type: string

## Backend_UserTenantListDto

Type: object

DTO for listing user tenants

Schema: [Backend_UserTenantListDto](/api-reference/schemas/backend-usertenantlistdto-0548bfc1ea.md)

- `items` (required)
  Type: array
  
  Items:
    Reference: [Backend_UserTenantDto](/api-reference/schemas/backend-usertenantdto-55d675b543.md); Type: object
    
    DTO for user-tenant relationship

- `total` (required)
  Type: integer

- `skip` (optional)
  Type: integer
  
  default: 0

- `limit` (optional)
  Type: integer
  
  default: 10

- `has_next` (optional)
  Type: boolean
  
  default: false

- `has_previous` (optional)
  Type: boolean
  
  default: false

## Backend_UserTenantUpdateDto

Type: object

DTO for updating user-tenant relationship

Schema: [Backend_UserTenantUpdateDto](/api-reference/schemas/backend-usertenantupdatedto-0d1b7de16b.md)

- `role_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `is_primary` (optional)
  Type: unknown
  
  anyOf:
    Type: boolean
  
    Type: null

- `is_active` (optional)
  Type: unknown
  
  anyOf:
    Type: boolean
  
    Type: null

## Backend_ValidationError

Type: object

Schema: [Backend_ValidationError](/api-reference/schemas/backend-validationerror-b5b4376c23.md)

- `loc` (required)
  Type: array
  
  Items:
    Type: unknown
    
    anyOf:
      Type: string
    
      Type: integer

- `msg` (required)
  Type: string

- `type` (required)
  Type: string

## SurveyService_AddQuestionToSurveyRequest

Type: object

Schema: [SurveyService_AddQuestionToSurveyRequest](/api-reference/schemas/surveyservice-addquestiontosurveyrequest-77e3a6e34e.md)

- `question_id` (required)
  Type: string
  
  minLength: 1

- `survey_id` (required)
  Type: string
  
  minLength: 1

## SurveyService_AddQuestionToSurveyResponse

Type: object

Schema: [SurveyService_AddQuestionToSurveyResponse](/api-reference/schemas/surveyservice-addquestiontosurveyresponse-ae78e0a89a.md)

- `survey_id` (required)
  Type: string

- `question_id` (required)
  Type: string

- `question_name` (required)
  Type: string

- `question` (required)
  Type: object
  
  Additional properties: true

## SurveyService_AvailableTriggersResponse

Type: object

Response model for available trigger values with assignment info.

Schema: [SurveyService_AvailableTriggersResponse](/api-reference/schemas/surveyservice-availabletriggersresponse-4eb9e05311.md)

- `trigger_questions` (required)
  Type: array
  
  Items:
    Type: string

- `available_values` (required)
  Type: object
  
  Additional properties: 
    Type: array
    
    Items:
      Type: string

- `assigned_values` (required)
  Type: object
  
  Additional properties: 
    Type: object
    
    Additional properties: 
      Type: unknown
      
      anyOf:
        Type: string
      
        Type: null

## SurveyService_BackfillAnchorSchema

Type: object

Anchor configuration for timeline-aware backfill

Schema: [SurveyService_BackfillAnchorSchema](/api-reference/schemas/surveyservice-backfillanchorschema-d4b5cb9bc6.md)

- `type` (required)
  Type: string
  
  Anchor type
  
  pattern: "^(current_month|from_answer_month|before_rule|after_rule)$"

- `question` (optional)
  Type: unknown
  
  Question name (for from_answer_month type)
  
  anyOf:
    Type: string
  
    Type: null

- `rule_id` (optional)
  Type: unknown
  
  Rule ID to anchor to (for before_rule/after_rule types)
  
  anyOf:
    Type: string
  
    Type: null

## SurveyService_Body_import_questions_api_v1_surveys_question_bank_questions_import_post

Type: object

Schema: [SurveyService_Body_import_questions_api_v1_surveys_question_bank_questions_import_post](/api-reference/schemas/surveyservice-body-import-questions-api-v1-surveys-question-bank-questions-import-post-60ac611716.md)

- `file` (required)
  Type: string

- `category_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

## SurveyService_Body_import_template_from_xlsform_api_v1_templates_import_xlsform_post

Type: object

Schema: [SurveyService_Body_import_template_from_xlsform_api_v1_templates_import_xlsform_post](/api-reference/schemas/surveyservice-body-import-template-from-xlsform-api-v1-templates-import-xlsform-post-9975f0f41d.md)

- `file` (required)
  Type: string
  
  XLSForm Excel file (.xlsx)

- `name` (required)
  Type: string
  
  Template name
  
  minLength: 1
  
  maxLength: 255

- `category_id` (required)
  Type: string
  
  Template category ID
  
  minLength: 1

- `description` (optional)
  Type: unknown
  
  Template description
  
  anyOf:
    Type: string
    
    maxLength: 2000
  
    Type: null

- `is_public` (optional)
  Type: boolean
  
  Whether the template is public
  
  default: false

## SurveyService_Body_import_xlsform_api_v1_surveys_import_xlsform_post

Type: object

Schema: [SurveyService_Body_import_xlsform_api_v1_surveys_import_xlsform_post](/api-reference/schemas/surveyservice-body-import-xlsform-api-v1-surveys-import-xlsform-post-b3f0fa6048.md)

- `file` (required)
  Type: string
  
  XLSForm Excel file (.xlsx)

- `name` (required)
  Type: string
  
  Survey name
  
  minLength: 1
  
  maxLength: 255

- `description` (optional)
  Type: unknown
  
  Survey description
  
  anyOf:
    Type: string
    
    maxLength: 5000
  
    Type: null

- `project_id` (required)
  Type: string, uuid
  
  Project ID from workspace-service

- `workspace_id` (required)
  Type: string, uuid
  
  Workspace ID for the project

- `is_anonymous` (optional)
  Type: boolean
  
  Whether responses are anonymous
  
  default: false

- `allow_multiple_responses` (optional)
  Type: boolean
  
  Allow multiple responses per user
  
  default: false

- `scheduling_enabled` (optional)
  Type: boolean
  
  Enable survey scheduling (auto open/close)
  
  default: false

- `open_at` (optional)
  Type: unknown
  
  Scheduled open timestamp (ISO 8601)
  
  anyOf:
    Type: string, date-time
  
    Type: null

- `close_at` (optional)
  Type: unknown
  
  Scheduled close timestamp (ISO 8601)
  
  anyOf:
    Type: string, date-time
  
    Type: null

## SurveyService_Body_upload_survey_media_api_v1_surveys__survey_id__media_post

Type: object

Schema: [SurveyService_Body_upload_survey_media_api_v1_surveys__survey_id__media_post](/api-reference/schemas/surveyservice-body-upload-survey-media-api-v1-surveys-survey-id-media-post-8a256a406b.md)

- `file` (required)
  Type: string
  
  ZIP file containing media assets

## SurveyService_Body_upload_xlsform_as_new_version_api_v1_surveys__survey_id__versions_upload_post

Type: object

Schema: [SurveyService_Body_upload_xlsform_as_new_version_api_v1_surveys__survey_id__versions_upload_post](/api-reference/schemas/surveyservice-body-upload-xlsform-as-new-version-api-v1-surveys-survey-id-versions-upload-post-7627bf80b3.md)

- `file` (required)
  Type: string

## SurveyService_CalendarColumnSchema

Type: object

Column definition for calendar_grid question type

Schema: [SurveyService_CalendarColumnSchema](/api-reference/schemas/surveyservice-calendarcolumnschema-1ed497aaca.md)

- `key` (required)
  Type: string
  
  minLength: 1
  
  maxLength: 100

- `type` (optional)
  Type: string
  
  default: "select_one"
  
  pattern: "^(select_one|integer|text)$"

- `label` (optional)
  Type: string
  
  default: ""
  
  maxLength: 2000

- `label_translations` (optional)
  Type: unknown
  
  anyOf:
    Type: object
    
    Additional properties: 
      Type: string
  
    Type: null

- `choices` (optional)
  Type: unknown
  
  Choices for select_one type - name must be exactly 1 character
  
  anyOf:
    Type: array
    
    Items:
      Type: object
      
      Additional properties: true
  
    Type: null

- `relevant` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

## SurveyService_CalendarConfigSchema

Type: object

Configuration for calendar_grid question type

Schema: [SurveyService_CalendarConfigSchema](/api-reference/schemas/surveyservice-calendarconfigschema-547e3ac662.md)

- `mode` (optional)
  Type: string
  
  default: "monthly"
  
  pattern: "^(monthly|weekly)$"

- `months_back` (optional)
  Type: integer
  
  default: 12
  
  minimum: 1
  
  maximum: 120

- `start_from` (optional)
  Type: string
  
  default: "today"
  
  pattern: "^(today|survey_start)$"

- `allow_future` (optional)
  Type: boolean
  
  default: false

## SurveyService_CalendarRuleSchema

Type: object

Rule for auto-prefilling calendar column values

Schema: [SurveyService_CalendarRuleSchema](/api-reference/schemas/surveyservice-calendarruleschema-08f16a0fe4.md)

- `id` (optional)
  Type: unknown
  
  Unique rule ID
  
  anyOf:
    Type: string
  
    Type: null

- `trigger_question` (required)
  Type: string
  
  Question name that triggers this rule

- `target_column` (required)
  Type: string
  
  Calendar column key to fill

- `value_source` (optional)
  Type: string
  
  Where to get the value: constant, lookup, or xpath expression
  
  default: "constant"
  
  pattern: "^(constant|lookup|xpath)$"

- `source_value` (optional)
  Type: unknown
  
  Constant value to fill (for constant source)
  
  anyOf:
    Type: string
  
    Type: null

- `backfill_months` (optional)
  Type: unknown
  
  How many months to backfill from anchor
  
  default: 1
  
  anyOf:
    Type: integer
    
    minimum: 1
    
    maximum: 120
  
    Type: null

- `backfill_anchor` (optional)
  Type: unknown
  
  Anchor for backfill: 'current_month', or anchor config object
  
  default: "current_month"
  
  anyOf:
    Type: string
  
    Reference: [SurveyService_BackfillAnchorSchema](/api-reference/schemas/surveyservice-backfillanchorschema-d4b5cb9bc6.md); Type: object
    
    Anchor configuration for timeline-aware backfill
  
    Type: null

- `map_values` (optional)
  Type: unknown
  
  Map trigger values to calendar values (e.g., {'yes': 'Y', 'no': 'N'})
  
  anyOf:
    Type: object
    
    Additional properties: 
      Type: string
  
    Type: null

- `xpath_expression` (optional)
  Type: unknown
  
  XPath expression to calculate value (for xpath source)
  
  anyOf:
    Type: string
  
    Type: null

- `enabled` (optional)
  Type: boolean
  
  Whether rule is active
  
  default: true

- `conditions` (optional)
  Type: unknown
  
  Conditions for when the rule applies (Visual Rule Builder)
  
  anyOf:
    Type: array
    
    Items:
      Type: object
      
      Additional properties: true
  
    Type: null

- `months_scope` (optional)
  Type: unknown
  
  Months scope configuration for the rule
  
  anyOf:
    Type: object
    
    Additional properties: true
  
    Type: null

## SurveyService_ChoiceSchema

Type: object

Choice list item (XLSForm choices sheet)

Schema: [SurveyService_ChoiceSchema](/api-reference/schemas/surveyservice-choiceschema-d6eb4de0b4.md)

- `list_name` (required)
  Type: string
  
  minLength: 1
  
  maxLength: 100

- `name` (required)
  Type: string
  
  minLength: 1
  
  maxLength: 100

- `label` (required)
  Type: string
  
  minLength: 1
  
  maxLength: 500

- `labelTranslations` (optional)
  Type: unknown
  
  anyOf:
    Type: object
    
    Additional properties: 
      Type: string
  
    Type: null

- `media_file` (optional)
  Type: unknown
  
  anyOf:
    Type: string
    
    maxLength: 255
  
    Type: null

- `constraint` (optional)
  Type: unknown
  
  anyOf:
    Type: string
    
    maxLength: 500
  
    Type: null

Additional properties: true

## SurveyService_CollectionGrantResponse

Type: object

Schema: [SurveyService_CollectionGrantResponse](/api-reference/schemas/surveyservice-collectiongrantresponse-76f52aa023.md)

- `id` (required)
  Type: string

- `kind` (required)
  Type: string

- `survey_id` (required)
  Type: string

- `survey_version_id` (required)
  Type: string

- `user_id` (required)
  Type: string

- `device_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `interview_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `project_status_at_issue` (required)
  Type: string

- `granted_at` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `project_bound` (optional)
  Type: boolean
  
  default: true

## SurveyService_CreateSurveyFromTemplateRequest

Type: object

Schema: [SurveyService_CreateSurveyFromTemplateRequest](/api-reference/schemas/surveyservice-createsurveyfromtemplaterequest-a1896e60e4.md)

- `template_id` (required)
  Type: string
  
  Template ID to create survey from
  
  minLength: 1

- `name` (required)
  Type: string
  
  minLength: 1
  
  maxLength: 255

- `description` (optional)
  Type: unknown
  
  anyOf:
    Type: string
    
    maxLength: 2000
  
    Type: null

- `workspace_id` (required)
  Type: string
  
  Workspace ID for the new survey
  
  minLength: 1

- `project_id` (required)
  Type: string
  
  Project ID for the new survey
  
  minLength: 1

- `is_anonymous` (optional)
  Type: boolean
  
  default: false

- `allow_multiple_responses` (optional)
  Type: boolean
  
  default: false

- `scheduling_enabled` (optional)
  Type: boolean
  
  default: false

- `open_at` (optional)
  Type: unknown
  
  Scheduled open timestamp
  
  anyOf:
    Type: string, date-time
  
    Type: null

- `close_at` (optional)
  Type: unknown
  
  Scheduled close timestamp
  
  anyOf:
    Type: string, date-time
  
    Type: null

## SurveyService_CreateSurveyFromTemplateResponse

Type: object

Schema: [SurveyService_CreateSurveyFromTemplateResponse](/api-reference/schemas/surveyservice-createsurveyfromtemplateresponse-3531509aa6.md)

- `survey_id` (required)
  Type: string

- `name` (required)
  Type: string

- `template_id` (required)
  Type: string

- `created_at` (required)
  Type: string, date-time

## SurveyService_EnumeratorListResponse

Type: object

Schema: [SurveyService_EnumeratorListResponse](/api-reference/schemas/surveyservice-enumeratorlistresponse-e7b82581a7.md)

- `enumerator_ids` (required)
  Type: array
  
  Items:
    Type: string

## SurveyService_ExpressionValidationError

Type: object

A single validation error for expression validation.

Schema: [SurveyService_ExpressionValidationError](/api-reference/schemas/surveyservice-expressionvalidationerror-d772685b6f.md)

- `field` (required)
  Type: string

- `message` (required)
  Type: string

- `code` (required)
  Type: string

- `context` (optional)
  Type: unknown
  
  anyOf:
    Type: object
    
    Additional properties: true
  
    Type: null

## SurveyService_ExpressionValidationRequest

Type: object

Request body for expression validation endpoint.

Schema: [SurveyService_ExpressionValidationRequest](/api-reference/schemas/surveyservice-expressionvalidationrequest-851259c810.md)

- `expression` (required)
  Type: string
  
  The expression to validate (XPath format with ${field_name} references)

- `expression_type` (optional)
  Type: string
  
  Type of expression being validated
  
  default: "relevant"
  
  pattern: "^(relevant|constraint|calculation|default)$"

- `available_fields` (optional)
  Type: array
  
  List of available question/field names for reference validation
  
  Items:
    Type: string

## SurveyService_ExpressionValidationResponse

Type: object

Response from expression validation endpoint.

Schema: [SurveyService_ExpressionValidationResponse](/api-reference/schemas/surveyservice-expressionvalidationresponse-25d3eb1ba3.md)

- `is_valid` (required)
  Type: boolean

- `expression` (required)
  Type: string

- `expression_type` (required)
  Type: string

- `errors` (optional)
  Type: array
  
  Items:
    Reference: [SurveyService_ExpressionValidationError](/api-reference/schemas/surveyservice-expressionvalidationerror-d772685b6f.md); Type: object
    
    A single validation error for expression validation.

## SurveyService_FormAccessBulkCreate

Type: object

Schema: [SurveyService_FormAccessBulkCreate](/api-reference/schemas/surveyservice-formaccessbulkcreate-737da3f2db.md)

- `user_ids` (required)
  Type: array
  
  minItems: 1
  
  Items:
    Type: string, uuid

- `access_level` (optional)
  Reference: [SurveyService_FormAccessLevel](/api-reference/schemas/surveyservice-formaccesslevel-a40adf7632.md); Type: string
  
  default: "fill"
  
  enum: ["fill","view_only","approver"]

- `expires_at` (optional)
  Type: unknown
  
  anyOf:
    Type: string, date-time
  
    Type: null

- `assigned_triggers` (optional)
  Type: unknown
  
  anyOf:
    Type: array
    
    Items:
      Reference: [SurveyService_LookupTriggerAssignment](/api-reference/schemas/surveyservice-lookuptriggerassignment-6b6e025c79.md); Type: object
      
      A single trigger value assignment for an enumerator.
  
    Type: null

## SurveyService_FormAccessCheckResponse

Type: object

Schema: [SurveyService_FormAccessCheckResponse](/api-reference/schemas/surveyservice-formaccesscheckresponse-3c494d433e.md)

- `has_access` (required)
  Type: boolean

- `access_level` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `can_fill` (optional)
  Type: boolean
  
  default: false

- `can_view` (optional)
  Type: boolean
  
  default: false

- `can_approve` (optional)
  Type: boolean
  
  default: false

- `expires_at` (optional)
  Type: unknown
  
  anyOf:
    Type: string, date-time
  
    Type: null

- `is_open` (optional)
  Type: boolean
  
  default: true

- `open_at` (optional)
  Type: unknown
  
  anyOf:
    Type: string, date-time
  
    Type: null

- `close_at` (optional)
  Type: unknown
  
  anyOf:
    Type: string, date-time
  
    Type: null

- `scheduling_blocked_reason` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

## SurveyService_FormAccessCreate

Type: object

Schema: [SurveyService_FormAccessCreate](/api-reference/schemas/surveyservice-formaccesscreate-5aca3154b7.md)

- `user_id` (required)
  Type: string, uuid

- `access_level` (optional)
  Reference: [SurveyService_FormAccessLevel](/api-reference/schemas/surveyservice-formaccesslevel-a40adf7632.md); Type: string
  
  default: "fill"
  
  enum: ["fill","view_only","approver"]

- `expires_at` (optional)
  Type: unknown
  
  anyOf:
    Type: string, date-time
  
    Type: null

- `assigned_triggers` (optional)
  Type: unknown
  
  anyOf:
    Type: array
    
    Items:
      Reference: [SurveyService_LookupTriggerAssignment](/api-reference/schemas/surveyservice-lookuptriggerassignment-6b6e025c79.md); Type: object
      
      A single trigger value assignment for an enumerator.
  
    Type: null

## SurveyService_FormAccessLevel

Type: string

Schema: [SurveyService_FormAccessLevel](/api-reference/schemas/surveyservice-formaccesslevel-a40adf7632.md)

enum: ["fill","view_only","approver"]

## SurveyService_FormAccessListResponse

Type: object

Schema: [SurveyService_FormAccessListResponse](/api-reference/schemas/surveyservice-formaccesslistresponse-a2fac70f14.md)

- `items` (required)
  Type: array
  
  Items:
    Reference: [SurveyService_FormAccessWithUserResponse](/api-reference/schemas/surveyservice-formaccesswithuserresponse-e26bd799f9.md); Type: object

- `total` (required)
  Type: integer

- `skip` (required)
  Type: integer

- `limit` (required)
  Type: integer

- `has_next` (required)
  Type: boolean

- `has_previous` (required)
  Type: boolean

## SurveyService_FormAccessResponse

Type: object

Schema: [SurveyService_FormAccessResponse](/api-reference/schemas/surveyservice-formaccessresponse-0bba74834e.md)

- `id` (required)
  Type: string, uuid

- `tenant_id` (required)
  Type: string, uuid

- `survey_id` (required)
  Type: string, uuid

- `user_id` (required)
  Type: string, uuid

- `granted_by` (required)
  Type: string, uuid

- `access_level` (required)
  Type: string

- `expires_at` (optional)
  Type: unknown
  
  anyOf:
    Type: string, date-time
  
    Type: null

- `created_at` (required)
  Type: string, date-time

- `updated_at` (required)
  Type: string, date-time

- `revoked_at` (optional)
  Type: unknown
  
  anyOf:
    Type: string, date-time
  
    Type: null

- `revoked_by` (optional)
  Type: unknown
  
  anyOf:
    Type: string, uuid
  
    Type: null

- `revocation_reason` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

## SurveyService_FormAccessRevokeRequest

Type: object

Schema: [SurveyService_FormAccessRevokeRequest](/api-reference/schemas/surveyservice-formaccessrevokerequest-5db2d7647c.md)

- `reason` (optional)
  Type: unknown
  
  Auditable reason for revocation
  
  anyOf:
    Type: string
    
    maxLength: 255
  
    Type: null

## SurveyService_FormAccessRevokeResponse

Type: object

Schema: [SurveyService_FormAccessRevokeResponse](/api-reference/schemas/surveyservice-formaccessrevokeresponse-75f7697705.md)

- `message` (required)
  Type: string

- `user_id` (required)
  Type: string, uuid

- `survey_id` (required)
  Type: string, uuid

- `grant_id` (required)
  Type: string, uuid

- `revoked_at` (required)
  Type: string, date-time

- `revoked_by` (required)
  Type: string, uuid

- `revocation_reason` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

## SurveyService_FormAccessUpdate

Type: object

Schema: [SurveyService_FormAccessUpdate](/api-reference/schemas/surveyservice-formaccessupdate-aeac9deb5f.md)

- `access_level` (optional)
  Type: unknown
  
  anyOf:
    Reference: [SurveyService_FormAccessLevel](/api-reference/schemas/surveyservice-formaccesslevel-a40adf7632.md); Type: string
    
    enum: ["fill","view_only","approver"]
  
    Type: null

- `expires_at` (optional)
  Type: unknown
  
  anyOf:
    Type: string, date-time
  
    Type: null

- `assigned_triggers` (optional)
  Type: unknown
  
  anyOf:
    Type: array
    
    Items:
      Reference: [SurveyService_LookupTriggerAssignment](/api-reference/schemas/surveyservice-lookuptriggerassignment-6b6e025c79.md); Type: object
      
      A single trigger value assignment for an enumerator.
  
    Type: null

## SurveyService_FormAccessWithUserResponse

Type: object

Schema: [SurveyService_FormAccessWithUserResponse](/api-reference/schemas/surveyservice-formaccesswithuserresponse-e26bd799f9.md)

- `id` (required)
  Type: string, uuid

- `tenant_id` (required)
  Type: string, uuid

- `survey_id` (required)
  Type: string, uuid

- `user_id` (required)
  Type: string, uuid

- `granted_by` (required)
  Type: string, uuid

- `access_level` (required)
  Type: string

- `expires_at` (optional)
  Type: unknown
  
  anyOf:
    Type: string, date-time
  
    Type: null

- `created_at` (required)
  Type: string, date-time

- `updated_at` (required)
  Type: string, date-time

- `revoked_at` (optional)
  Type: unknown
  
  anyOf:
    Type: string, date-time
  
    Type: null

- `revoked_by` (optional)
  Type: unknown
  
  anyOf:
    Type: string, uuid
  
    Type: null

- `revocation_reason` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `user_email` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `user_first_name` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `user_last_name` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `user_code` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `user_role` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `assigned_triggers` (optional)
  Type: unknown
  
  anyOf:
    Type: array
    
    Items:
      Reference: [SurveyService_LookupTriggerAssignment](/api-reference/schemas/surveyservice-lookuptriggerassignment-6b6e025c79.md); Type: object
      
      A single trigger value assignment for an enumerator.
  
    Type: null

## SurveyService_HTTPValidationError

Type: object

Schema: [SurveyService_HTTPValidationError](/api-reference/schemas/surveyservice-httpvalidationerror-6237d5d2de.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [SurveyService_ValidationError](/api-reference/schemas/surveyservice-validationerror-21d2a3258e.md); Type: object

## SurveyService_HealthResponseDTO

Type: object

Health check response model.

Schema: [SurveyService_HealthResponseDTO](/api-reference/schemas/surveyservice-healthresponsedto-c86ea40b0a.md)

- `status` (required)
  Type: string

- `service` (required)
  Type: string

- `version` (required)
  Type: string

- `timestamp` (required)
  Type: string, date-time

## SurveyService_HistoricalAccessCheckResponse

Type: object

Schema: [SurveyService_HistoricalAccessCheckResponse](/api-reference/schemas/surveyservice-historicalaccesscheckresponse-cb621d4684.md)

- `has_access` (required)
  Type: boolean

- `grant_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string, uuid
  
    Type: null

- `access_level` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `created_at` (optional)
  Type: unknown
  
  anyOf:
    Type: string, date-time
  
    Type: null

- `revoked_at` (optional)
  Type: unknown
  
  anyOf:
    Type: string, date-time
  
    Type: null

- `revocation_reason` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `is_revoked` (optional)
  Type: boolean
  
  default: false

## SurveyService_IssueCollectionGrantRequest

Type: object

Schema: [SurveyService_IssueCollectionGrantRequest](/api-reference/schemas/surveyservice-issuecollectiongrantrequest-c252488a8b.md)

- `kind` (required)
  Type: string
  
  device_download | interview_reservation

- `user_id` (required)
  Type: string, uuid

- `survey_version_id` (required)
  Type: string, uuid

- `device_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string
    
    maxLength: 255
  
    Type: null

- `interview_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string, uuid
  
    Type: null

- `schema_hash` (optional)
  Type: unknown
  
  anyOf:
    Type: string
    
    maxLength: 64
  
    Type: null

## SurveyService_LanguageCreate

Type: object

Schema: [SurveyService_LanguageCreate](/api-reference/schemas/surveyservice-languagecreate-4380c928f6.md)

- `code` (required)
  Type: string
  
  Language code (e.g., 'en', 'hi')
  
  maxLength: 10

- `name` (required)
  Type: string
  
  Language name (e.g., 'English', 'Hindi')
  
  maxLength: 100

- `flag_emoji` (optional)
  Type: unknown
  
  Flag emoji (e.g., '🇺🇸')
  
  anyOf:
    Type: string
    
    maxLength: 10
  
    Type: null

- `is_active` (optional)
  Type: boolean
  
  Whether language is active
  
  default: true

- `display_order` (optional)
  Type: integer
  
  Display order for sorting
  
  default: 0

## SurveyService_LanguageListResponse

Type: object

Schema: [SurveyService_LanguageListResponse](/api-reference/schemas/surveyservice-languagelistresponse-419045d5e5.md)

- `languages` (required)
  Type: array
  
  Items:
    Reference: [SurveyService_LanguageResponse](/api-reference/schemas/surveyservice-languageresponse-316a38ba73.md); Type: object

- `total` (required)
  Type: integer

## SurveyService_LanguageReorderRequest

Type: object

Schema: [SurveyService_LanguageReorderRequest](/api-reference/schemas/surveyservice-languagereorderrequest-0f3187190c.md)

- `language_ids` (required)
  Type: array
  
  List of language codes in desired order
  
  Items:
    Type: string

## SurveyService_LanguageResponse

Type: object

Schema: [SurveyService_LanguageResponse](/api-reference/schemas/surveyservice-languageresponse-316a38ba73.md)

- `id` (required)
  Type: string, uuid

- `tenant_id` (required)
  Type: string, uuid

- `code` (required)
  Type: string

- `name` (required)
  Type: string

- `flag_emoji` (required)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `is_active` (required)
  Type: boolean

- `display_order` (required)
  Type: integer

## SurveyService_LanguageUpdate

Type: object

Schema: [SurveyService_LanguageUpdate](/api-reference/schemas/surveyservice-languageupdate-90b58bfe7e.md)

- `code` (optional)
  Type: unknown
  
  anyOf:
    Type: string
    
    maxLength: 10
  
    Type: null

- `name` (optional)
  Type: unknown
  
  anyOf:
    Type: string
    
    maxLength: 100
  
    Type: null

- `flag_emoji` (optional)
  Type: unknown
  
  anyOf:
    Type: string
    
    maxLength: 10
  
    Type: null

- `is_active` (optional)
  Type: unknown
  
  anyOf:
    Type: boolean
  
    Type: null

- `display_order` (optional)
  Type: unknown
  
  anyOf:
    Type: integer
  
    Type: null

## SurveyService_LimitSchema

Type: object

Limit configuration for text/number fields.
For text: min/max character count
For integer/decimal: min/max value

Schema: [SurveyService_LimitSchema](/api-reference/schemas/surveyservice-limitschema-6ae9a445e8.md)

- `min` (optional)
  Type: unknown
  
  anyOf:
    Type: integer
  
    Type: null

- `max` (optional)
  Type: unknown
  
  anyOf:
    Type: integer
  
    Type: null

## SurveyService_LookupConfigResponse

Type: object

Response model for lookup configuration.

Schema: [SurveyService_LookupConfigResponse](/api-reference/schemas/surveyservice-lookupconfigresponse-3484eec57a.md)

- `has_lookups` (required)
  Type: boolean

- `lookup_keys` (required)
  Type: array
  
  Items:
    Type: object
    
    Additional properties: true

- `trigger_questions` (required)
  Type: array
  
  Items:
    Type: string

- `referee_questions` (required)
  Type: object
  
  Additional properties: 
    Type: array
    
    Items:
      Type: string

## SurveyService_LookupResolveRequest

Type: object

Request model for lookup resolution.

Schema: [SurveyService_LookupResolveRequest](/api-reference/schemas/surveyservice-lookupresolverequest-c77eea897e.md)

- `trigger_question` (required)
  Type: string
  
  Name of the trigger question

- `trigger_value` (required)
  Type: string
  
  Selected value for the trigger question

- `current_values` (optional)
  Type: unknown
  
  Current values of all questions (for change detection)
  
  anyOf:
    Type: object
    
    Additional properties: true
  
    Type: null

## SurveyService_LookupResolveResponse

Type: object

Response model for lookup resolution.

Schema: [SurveyService_LookupResolveResponse](/api-reference/schemas/surveyservice-lookupresolveresponse-6588d37db2.md)

- `trigger_question` (required)
  Type: string

- `trigger_value` (required)
  Type: string

- `resolved_values` (required)
  Type: object
  
  Additional properties: true

- `fields_to_clear` (optional)
  Type: array
  
  Items:
    Type: string

- `is_valid` (optional)
  Type: boolean
  
  default: true

- `error_message` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

## SurveyService_LookupResponse

Type: object

Response model for lookup data

Schema: [SurveyService_LookupResponse](/api-reference/schemas/surveyservice-lookupresponse-39d07f7a0a.md)

- `lookup_name` (required)
  Type: string

- `key` (required)
  Type: string

- `value` (required)
  Type: string

- `parent_key` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `extra_data` (optional)
  Type: unknown
  
  anyOf:
    Type: object
    
    Additional properties: true
  
    Type: null

## SurveyService_LookupSchema

Type: object

Lookup data item (custom lookups worksheet).
Used for cascading selects and external data lookups.

Example:
- lookup_name: "countries" or "states"
- key: "us" or "ny"
- value: "United States" or "New York"
- parent_key: None for countries, "us" for states (cascading)
- extra_data: {"code": "USA", "region": "north_america"}

Schema: [SurveyService_LookupSchema](/api-reference/schemas/surveyservice-lookupschema-8dcae41908.md)

- `lookup_name` (required)
  Type: string
  
  minLength: 1
  
  maxLength: 100

- `key` (required)
  Type: string
  
  minLength: 1
  
  maxLength: 100

- `value` (required)
  Type: string
  
  minLength: 1
  
  maxLength: 500

- `parent_key` (optional)
  Type: unknown
  
  anyOf:
    Type: string
    
    maxLength: 100
  
    Type: null

- `extra_data` (optional)
  Type: unknown
  
  anyOf:
    Type: object
    
    Additional properties: true
  
    Type: null

## SurveyService_LookupStatisticsResponse

Type: object

Response model for lookup statistics.

Schema: [SurveyService_LookupStatisticsResponse](/api-reference/schemas/surveyservice-lookupstatisticsresponse-8e3d62556a.md)

- `trigger_questions` (required)
  Type: integer

- `total_values` (required)
  Type: integer

- `trigger_details` (required)
  Type: object
  
  Additional properties: 
    Type: object
    
    Additional properties: true

## SurveyService_LookupTriggerAssignment

Type: object

A single trigger value assignment for an enumerator.

Schema: [SurveyService_LookupTriggerAssignment](/api-reference/schemas/surveyservice-lookuptriggerassignment-6b6e025c79.md)

- `trigger_question` (required)
  Type: string
  
  Name of the trigger question, e.g., 's_state'

- `trigger_value` (required)
  Type: string
  
  Value of the trigger, e.g., 'rajasthan'

## SurveyService_LookupValidateRequest

Type: object

Request model for lookup validation.

Schema: [SurveyService_LookupValidateRequest](/api-reference/schemas/surveyservice-lookupvalidaterequest-b7d8c64a9f.md)

- `trigger_question` (required)
  Type: string
  
  Name of the trigger question

- `trigger_value` (required)
  Type: string
  
  Value to validate

## SurveyService_LookupValidateResponse

Type: object

Response model for lookup validation.

Schema: [SurveyService_LookupValidateResponse](/api-reference/schemas/surveyservice-lookupvalidateresponse-e2ef2d9f28.md)

- `is_valid` (required)
  Type: boolean

- `trigger_question` (required)
  Type: string

- `trigger_value` (required)
  Type: string

- `error_message` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `available_values` (optional)
  Type: unknown
  
  anyOf:
    Type: array
    
    Items:
      Type: string
  
    Type: null

## SurveyService_QuestionBankCategoryCreate

Type: object

Schema: [SurveyService_QuestionBankCategoryCreate](/api-reference/schemas/surveyservice-questionbankcategorycreate-66976dcde6.md)

- `name` (required)
  Type: string
  
  minLength: 1
  
  maxLength: 255

- `description` (optional)
  Type: unknown
  
  anyOf:
    Type: string
    
    maxLength: 2000
  
    Type: null

- `color` (optional)
  Type: unknown
  
  anyOf:
    Type: string
    
    maxLength: 50
  
    Type: null

## SurveyService_QuestionBankCategoryListResponse

Type: object

Schema: [SurveyService_QuestionBankCategoryListResponse](/api-reference/schemas/surveyservice-questionbankcategorylistresponse-d9de2693ac.md)

- `items` (required)
  Type: array
  
  Items:
    Reference: [SurveyService_QuestionBankCategoryResponse](/api-reference/schemas/surveyservice-questionbankcategoryresponse-a375c670a2.md); Type: object

- `total` (required)
  Type: integer

- `limit` (required)
  Type: integer

- `skip` (required)
  Type: integer

- `has_next` (required)
  Type: boolean

- `has_previous` (required)
  Type: boolean

## SurveyService_QuestionBankCategoryResponse

Type: object

Schema: [SurveyService_QuestionBankCategoryResponse](/api-reference/schemas/surveyservice-questionbankcategoryresponse-a375c670a2.md)

- `id` (required)
  Type: string

- `tenant_id` (required)
  Type: string

- `name` (required)
  Type: string

- `description` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `color` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `question_count` (optional)
  Type: integer
  
  default: 0

- `created_at` (required)
  Type: string, date-time

- `updated_at` (required)
  Type: string, date-time

## SurveyService_QuestionBankCategoryUpdate

Type: object

Schema: [SurveyService_QuestionBankCategoryUpdate](/api-reference/schemas/surveyservice-questionbankcategoryupdate-bdc6997037.md)

- `name` (optional)
  Type: unknown
  
  anyOf:
    Type: string
    
    minLength: 1
    
    maxLength: 255
  
    Type: null

- `description` (optional)
  Type: unknown
  
  anyOf:
    Type: string
    
    maxLength: 2000
  
    Type: null

- `color` (optional)
  Type: unknown
  
  anyOf:
    Type: string
    
    maxLength: 50
  
    Type: null

## SurveyService_QuestionBulkImportResponse

Type: object

Schema: [SurveyService_QuestionBulkImportResponse](/api-reference/schemas/surveyservice-questionbulkimportresponse-ccd59c5458.md)

- `total` (required)
  Type: integer

- `created` (required)
  Type: integer

- `failed` (required)
  Type: integer

- `errors` (optional)
  Type: array
  
  Items:
    Reference: [SurveyService_QuestionImportRowError](/api-reference/schemas/surveyservice-questionimportrowerror-f05a21fb87.md); Type: object

## SurveyService_QuestionCreate

Type: object

Schema: [SurveyService_QuestionCreate](/api-reference/schemas/surveyservice-questioncreate-32d6fe24cf.md)

- `category_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `question_type` (required)
  Type: string
  
  minLength: 1
  
  maxLength: 50

- `name` (required)
  Type: string
  
  minLength: 1
  
  maxLength: 100

- `label` (optional)
  Type: string
  
  default: ""
  
  maxLength: 5000

- `label_translations` (optional)
  Type: object
  
  Additional properties: 
    Type: string

- `hint` (optional)
  Type: unknown
  
  anyOf:
    Type: string
    
    maxLength: 5000
  
    Type: null

- `hint_translations` (optional)
  Type: object
  
  Additional properties: 
    Type: string

- `required` (optional)
  Type: boolean
  
  default: false

- `question_config` (optional)
  Type: object
  
  Additional properties: true

- `tags` (optional)
  Type: array
  
  Items:
    Type: string

- `is_public` (optional)
  Type: boolean
  
  default: false

## SurveyService_QuestionImportRowError

Type: object

Schema: [SurveyService_QuestionImportRowError](/api-reference/schemas/surveyservice-questionimportrowerror-f05a21fb87.md)

- `row` (required)
  Type: integer

- `field` (optional)
  Type: string
  
  default: ""

- `code` (required)
  Type: string

- `message` (required)
  Type: string

## SurveyService_QuestionListResponse

Type: object

Schema: [SurveyService_QuestionListResponse](/api-reference/schemas/surveyservice-questionlistresponse-76d583c41c.md)

- `items` (required)
  Type: array
  
  Items:
    Reference: [SurveyService_QuestionResponse](/api-reference/schemas/surveyservice-questionresponse-4b0eed1568.md); Type: object

- `total` (required)
  Type: integer

- `limit` (required)
  Type: integer

- `skip` (required)
  Type: integer

- `has_next` (required)
  Type: boolean

- `has_previous` (required)
  Type: boolean

## SurveyService_QuestionResponse

Type: object

Schema: [SurveyService_QuestionResponse](/api-reference/schemas/surveyservice-questionresponse-4b0eed1568.md)

- `id` (required)
  Type: string

- `tenant_id` (required)
  Type: string

- `category_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `question_type` (required)
  Type: string

- `name` (required)
  Type: string

- `label` (required)
  Type: string

- `label_translations` (required)
  Type: object
  
  Additional properties: 
    Type: string

- `hint` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `hint_translations` (required)
  Type: object
  
  Additional properties: 
    Type: string

- `required` (required)
  Type: boolean

- `question_config` (required)
  Type: object
  
  Additional properties: true

- `tags` (required)
  Type: array
  
  Items:
    Type: string

- `usage_count` (required)
  Type: integer

- `is_public` (required)
  Type: boolean

- `created_by` (required)
  Type: string

- `updated_by` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `created_at` (required)
  Type: string, date-time

- `updated_at` (required)
  Type: string, date-time

- `category` (optional)
  Type: unknown
  
  anyOf:
    Reference: [SurveyService_QuestionBankCategoryResponse](/api-reference/schemas/surveyservice-questionbankcategoryresponse-a375c670a2.md); Type: object
  
    Type: null

## SurveyService_QuestionUpdate

Type: object

Schema: [SurveyService_QuestionUpdate](/api-reference/schemas/surveyservice-questionupdate-77879266e2.md)

- `category_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `label` (optional)
  Type: unknown
  
  anyOf:
    Type: string
    
    maxLength: 5000
  
    Type: null

- `label_translations` (optional)
  Type: unknown
  
  anyOf:
    Type: object
    
    Additional properties: 
      Type: string
  
    Type: null

- `hint` (optional)
  Type: unknown
  
  anyOf:
    Type: string
    
    maxLength: 5000
  
    Type: null

- `hint_translations` (optional)
  Type: unknown
  
  anyOf:
    Type: object
    
    Additional properties: 
      Type: string
  
    Type: null

- `required` (optional)
  Type: unknown
  
  anyOf:
    Type: boolean
  
    Type: null

- `question_config` (optional)
  Type: unknown
  
  anyOf:
    Type: object
    
    Additional properties: true
  
    Type: null

- `tags` (optional)
  Type: unknown
  
  anyOf:
    Type: array
    
    Items:
      Type: string
  
    Type: null

- `is_public` (optional)
  Type: unknown
  
  anyOf:
    Type: boolean
  
    Type: null

## SurveyService_SettingsSchema

Type: object

Survey-level settings (XLSForm settings sheet)

Schema: [SurveyService_SettingsSchema](/api-reference/schemas/surveyservice-settingsschema-c095279fef.md)

- `form_title` (required)
  Type: string
  
  minLength: 1
  
  maxLength: 255

- `form_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string
    
    maxLength: 100
  
    Type: null

- `version` (optional)
  Type: unknown
  
  anyOf:
    Type: string
    
    maxLength: 50
  
    Type: null

- `defaultLanguage` (optional)
  Type: unknown
  
  default: "en"
  
  anyOf:
    Type: string
    
    maxLength: 10
  
    Type: null

- `languages` (optional)
  Type: unknown
  
  anyOf:
    Type: array
    
    Items:
      Type: string
  
    Type: null

- `availableLanguages` (optional)
  Type: unknown
  
  anyOf:
    Type: array
    
    Items:
      Type: string
  
    Type: null

- `instanceName` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `submissionUrl` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

## SurveyService_SurveyAccessListResponse

Type: object

Schema: [SurveyService_SurveyAccessListResponse](/api-reference/schemas/surveyservice-surveyaccesslistresponse-2da76e8ef7.md)

- `items` (required)
  Type: array
  
  Items:
    Reference: [SurveyService_SurveyWithAccessResponse](/api-reference/schemas/surveyservice-surveywithaccessresponse-13910afbb0.md); Type: object

- `total` (required)
  Type: integer

- `skip` (required)
  Type: integer

- `limit` (required)
  Type: integer

- `has_next` (required)
  Type: boolean

- `has_previous` (required)
  Type: boolean

## SurveyService_SurveyCreate

Type: object

Schema: [SurveyService_SurveyCreate](/api-reference/schemas/surveyservice-surveycreate-f6b9b7b4ee.md)

- `name` (required)
  Type: string
  
  minLength: 1
  
  maxLength: 255

- `description` (optional)
  Type: unknown
  
  anyOf:
    Type: string
    
    maxLength: 5000
  
    Type: null

- `workspace_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string, uuid
  
    Type: null

- `project_id` (required)
  Type: string, uuid

- `is_anonymous` (optional)
  Type: boolean
  
  default: false

- `allow_multiple_responses` (optional)
  Type: boolean
  
  default: false

- `schema` (optional)
  Type: unknown
  
  anyOf:
    Reference: [SurveyService_SurveySchema](/api-reference/schemas/surveyservice-surveyschema-bf82311926.md); Type: object
    
    Complete XLSForm-compatible survey schema.
    Stored in JSONB column in survey_versions table.
    Includes support for custom lookups worksheet for cascading selects.
    
    Note: 'title', 'version', 'description' and 'id' fields are accepted for
    backwards compatibility with frontend schema transformations but are not
    required for storage (they're derived from the survey/version metadata).
  
    Type: null

- `open_at` (optional)
  Type: unknown
  
  anyOf:
    Type: string, date-time
  
    Type: null

- `close_at` (optional)
  Type: unknown
  
  anyOf:
    Type: string, date-time
  
    Type: null

- `scheduling_enabled` (optional)
  Type: boolean
  
  default: false

## SurveyService_SurveyListResponse

Type: object

Schema: [SurveyService_SurveyListResponse](/api-reference/schemas/surveyservice-surveylistresponse-6f76aa4818.md)

- `items` (required)
  Type: array
  
  Items:
    Reference: [SurveyService_SurveyResponse](/api-reference/schemas/surveyservice-surveyresponse-acaa084535.md); Type: object

- `total` (required)
  Type: integer

- `limit` (required)
  Type: integer

- `skip` (required)
  Type: integer

- `has_next` (required)
  Type: boolean

- `has_previous` (required)
  Type: boolean

## SurveyService_SurveyQuestionResponse

Type: object

Response model for question (mirrors SurveyQuestionSchema)

Schema: [SurveyService_SurveyQuestionResponse](/api-reference/schemas/surveyservice-surveyquestionresponse-2ea80a2a2b.md)

- `type` (required)
  Type: string

- `name` (required)
  Type: string

- `label` (required)
  Type: string

- `label_translations` (optional)
  Type: unknown
  
  anyOf:
    Type: object
    
    Additional properties: 
      Type: string
  
    Type: null

- `required` (optional)
  Type: boolean
  
  default: false

- `hint` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `hint_translations` (optional)
  Type: unknown
  
  anyOf:
    Type: object
    
    Additional properties: 
      Type: string
  
    Type: null

- `default` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `order_index` (optional)
  Type: integer
  
  default: 0

- `additional_values` (optional)
  Type: unknown
  
  anyOf:
    Type: array
    
    Items:
      Type: string
  
    Type: null

- `read_only` (optional)
  Type: boolean
  
  default: false

- `appearance` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `relevant` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `constraint` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `constraint_message` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `constraint_message_translations` (optional)
  Type: unknown
  
  anyOf:
    Type: object
    
    Additional properties: 
      Type: string
  
    Type: null

- `calculation` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `choices` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: array
    
    Items:
      Type: object
      
      Additional properties: true
  
    Type: null

- `choice_filter` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `choice_relation` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `repeat_count` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `questions` (optional)
  Type: unknown
  
  anyOf:
    Type: array
    
    Items:
      Reference: [SurveyService_SurveyQuestionResponse](/api-reference/schemas/surveyservice-surveyquestionresponse-2ea80a2a2b.md); Type: SurveyService_SurveyQuestionResponse
  
    Type: null

- `limit` (optional)
  Type: unknown
  
  anyOf:
    Type: object
    
    Additional properties: true
  
    Type: null

- `paradata` (optional)
  Type: unknown
  
  anyOf:
    Type: array
    
    Items:
      Type: string
  
    Type: null

- `media_file` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `deidentify` (optional)
  Type: boolean
  
  default: false

- `unique_id` (optional)
  Type: boolean
  
  default: false

- `lookups` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `calendar_config` (optional)
  Type: unknown
  
  anyOf:
    Type: object
    
    Additional properties: true
  
    Type: null

- `calendar_rules` (optional)
  Type: unknown
  
  anyOf:
    Type: array
    
    Items:
      Type: object
      
      Additional properties: true
  
    Type: null

- `columns` (optional)
  Type: unknown
  
  anyOf:
    Type: array
    
    Items:
      Type: object
      
      Additional properties: true
  
    Type: null

## SurveyService_SurveyQuestionSchema

Type: object

XLSForm-compatible question schema.
Supports all 22 question types with recursive nesting for groups/repeats.

Schema: [SurveyService_SurveyQuestionSchema](/api-reference/schemas/surveyservice-surveyquestionschema-900b06e530.md)

- `type` (required)
  Reference: [SurveyService_SurveyQuestionType](/api-reference/schemas/surveyservice-surveyquestiontype-0845fbebf4.md); Type: string
  
  Complete XLSForm-compatible question types (KoboToolbox standard).
  Reference: https://xlsform.org/en/#question-types
  
  enum: ["text","integer","decimal","range","select_one","select_multiple","rank","date","time","datetime","geopoint","geotrace","geoshape","image","audio","video","file","barcode","signature","calculate","note","hidden","acknowledge","trigger","url","phone","start","end","today","deviceid","phonenumber","username","email","simserial","subscriberid","audit","xml-external","csv-external","begin_group","end_group","begin_repeat","end_repeat","calendar_grid"]

- `name` (required)
  Type: string
  
  minLength: 0
  
  maxLength: 100

- `label` (optional)
  Type: string
  
  default: ""
  
  maxLength: 2000

- `required` (optional)
  Type: boolean
  
  default: false

- `hint` (optional)
  Type: unknown
  
  anyOf:
    Type: string
    
    maxLength: 1000
  
    Type: null

- `labelTranslations` (optional)
  Type: unknown
  
  anyOf:
    Type: object
    
    Additional properties: 
      Type: string
  
    Type: null

- `hintTranslations` (optional)
  Type: unknown
  
  anyOf:
    Type: object
    
    Additional properties: 
      Type: string
  
    Type: null

- `default` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `order_index` (optional)
  Type: integer
  
  default: 0

- `additional_values` (optional)
  Type: unknown
  
  anyOf:
    Type: array
    
    Items:
      Type: string
  
    Type: null

- `read_only` (optional)
  Type: boolean
  
  default: false

- `appearance` (optional)
  Type: unknown
  
  anyOf:
    Type: string
    
    maxLength: 100
  
    Type: null

- `relevant` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `constraint` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `constraint_message` (optional)
  Type: unknown
  
  anyOf:
    Type: string
    
    maxLength: 500
  
    Type: null

- `constraintMessageTranslations` (optional)
  Type: unknown
  
  anyOf:
    Type: object
    
    Additional properties: 
      Type: string
  
    Type: null

- `calculation` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `choices` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `choice_filter` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `choice_relation` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `repeat_count` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `questions` (optional)
  Type: unknown
  
  anyOf:
    Type: array
    
    Items:
      Reference: [SurveyService_SurveyQuestionSchema](/api-reference/schemas/surveyservice-surveyquestionschema-900b06e530.md); Type: SurveyService_SurveyQuestionSchema
  
    Type: null

- `calendar_config` (optional)
  Type: unknown
  
  anyOf:
    Reference: [SurveyService_CalendarConfigSchema](/api-reference/schemas/surveyservice-calendarconfigschema-547e3ac662.md); Type: object
    
    Configuration for calendar_grid question type
  
    Type: null

- `calendar_rules` (optional)
  Type: unknown
  
  Auto-prefill rules for calendar columns
  
  anyOf:
    Type: array
    
    Items:
      Reference: [SurveyService_CalendarRuleSchema](/api-reference/schemas/surveyservice-calendarruleschema-08f16a0fe4.md); Type: object
      
      Rule for auto-prefilling calendar column values
  
    Type: null

- `columns` (optional)
  Type: unknown
  
  anyOf:
    Type: array
    
    Items:
      Reference: [SurveyService_CalendarColumnSchema](/api-reference/schemas/surveyservice-calendarcolumnschema-1ed497aaca.md); Type: object
      
      Column definition for calendar_grid question type
  
    Type: null

- `limit` (optional)
  Type: unknown
  
  anyOf:
    Reference: [SurveyService_LimitSchema](/api-reference/schemas/surveyservice-limitschema-6ae9a445e8.md); Type: object
    
    Limit configuration for text/number fields.
    For text: min/max character count
    For integer/decimal: min/max value
  
    Type: null

- `paradata` (optional)
  Type: unknown
  
  anyOf:
    Type: array
    
    Items:
      Type: string
  
    Type: null

- `media_file` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `mediaAudio` (optional)
  Type: unknown
  
  anyOf:
    Type: string
    
    maxLength: 500
  
    Type: null

- `mediaAudioSchema` (optional)
  Type: unknown
  
  anyOf:
    Type: object
    
    Additional properties: 
      Type: string
  
    Type: null

- `mediaAudioUrl` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `mediaAudioAssetId` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `mediaAudioUrlSchema` (optional)
  Type: unknown
  
  anyOf:
    Type: object
    
    Additional properties: 
      Type: string
  
    Type: null

- `mediaAudioAssetIdSchema` (optional)
  Type: unknown
  
  anyOf:
    Type: object
    
    Additional properties: 
      Type: string
  
    Type: null

- `deidentify` (optional)
  Type: boolean
  
  default: false

- `unique_id` (optional)
  Type: boolean
  
  default: false

- `lookups` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

Additional properties: true

## SurveyService_SurveyQuestionType

Type: string

Complete XLSForm-compatible question types (KoboToolbox standard).
Reference: https://xlsform.org/en/#question-types

Schema: [SurveyService_SurveyQuestionType](/api-reference/schemas/surveyservice-surveyquestiontype-0845fbebf4.md)

enum: ["text","integer","decimal","range","select_one","select_multiple","rank","date","time","datetime","geopoint","geotrace","geoshape","image","audio","video","file","barcode","signature","calculate","note","hidden","acknowledge","trigger","url","phone","start","end","today","deviceid","phonenumber","username","email","simserial","subscriberid","audit","xml-external","csv-external","begin_group","end_group","begin_repeat","end_repeat","calendar_grid"]

## SurveyService_SurveyResponse

Type: object

Schema: [SurveyService_SurveyResponse](/api-reference/schemas/surveyservice-surveyresponse-acaa084535.md)

- `id` (required)
  Type: string, uuid

- `tenant_id` (required)
  Type: string, uuid

- `workspace_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string, uuid
  
    Type: null

- `project_id` (required)
  Type: string, uuid

- `name` (required)
  Type: string

- `description` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `status` (required)
  Type: string

- `is_anonymous` (required)
  Type: boolean

- `allow_multiple_responses` (required)
  Type: boolean

- `survey_code` (optional)
  Type: unknown
  
  anyOf:
    Type: integer
  
    Type: null

- `tags` (optional)
  Type: array
  
  Items:
    Reference: [SurveyService_TagResponse](/api-reference/schemas/surveyservice-tagresponse-1b11fe3a5a.md); Type: object

- `created_at` (required)
  Type: string, date-time

- `updated_at` (required)
  Type: string, date-time

- `created_by` (required)
  Type: string, uuid

- `closed_at` (optional)
  Type: unknown
  
  anyOf:
    Type: string, date-time
  
    Type: null

- `open_at` (optional)
  Type: unknown
  
  anyOf:
    Type: string, date-time
  
    Type: null

- `close_at` (optional)
  Type: unknown
  
  anyOf:
    Type: string, date-time
  
    Type: null

- `scheduling_enabled` (optional)
  Type: boolean
  
  default: false

- `is_open` (optional)
  Type: boolean
  
  default: false

- `schema` (optional)
  Type: unknown
  
  anyOf:
    Reference: [SurveyService_SurveySchemaResponse](/api-reference/schemas/surveyservice-surveyschemaresponse-5750fea8e8.md); Type: object
    
    Response model for survey schema
  
    Type: null

- `project_status` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `project_has_production_activity` (optional)
  Type: unknown
  
  anyOf:
    Type: boolean
  
    Type: null

- `project_production_activity_at` (optional)
  Type: unknown
  
  anyOf:
    Type: string, date-time
  
    Type: null

## SurveyService_SurveyScheduleRequest

Type: object

Schema: [SurveyService_SurveyScheduleRequest](/api-reference/schemas/surveyservice-surveyschedulerequest-a75c775265.md)

- `open_at` (optional)
  Type: unknown
  
  anyOf:
    Type: string, date-time
  
    Type: null

- `close_at` (optional)
  Type: unknown
  
  anyOf:
    Type: string, date-time
  
    Type: null

- `scheduling_enabled` (optional)
  Type: boolean
  
  default: true

## SurveyService_SurveySchema

Type: object

Complete XLSForm-compatible survey schema.
Stored in JSONB column in survey_versions table.
Includes support for custom lookups worksheet for cascading selects.

Note: 'title', 'version', 'description' and 'id' fields are accepted for
backwards compatibility with frontend schema transformations but are not
required for storage (they're derived from the survey/version metadata).

Schema: [SurveyService_SurveySchema](/api-reference/schemas/surveyservice-surveyschema-bf82311926.md)

- `settings` (required)
  Reference: [SurveyService_SettingsSchema](/api-reference/schemas/surveyservice-settingsschema-c095279fef.md); Type: object
  
  Survey-level settings (XLSForm settings sheet)

- `choices` (optional)
  Type: array
  
  Items:
    Reference: [SurveyService_ChoiceSchema](/api-reference/schemas/surveyservice-choiceschema-d6eb4de0b4.md); Type: object
    
    Choice list item (XLSForm choices sheet)

- `questions` (required)
  Type: array
  
  Items:
    Reference: [SurveyService_SurveyQuestionSchema](/api-reference/schemas/surveyservice-surveyquestionschema-900b06e530.md); Type: object
    
    XLSForm-compatible question schema.
    Supports all 22 question types with recursive nesting for groups/repeats.

- `lookups` (optional)
  Type: array
  
  Items:
    Reference: [SurveyService_LookupSchema](/api-reference/schemas/surveyservice-lookupschema-8dcae41908.md); Type: object
    
    Lookup data item (custom lookups worksheet).
    Used for cascading selects and external data lookups.
    
    Example:
    - lookup_name: "countries" or "states"
    - key: "us" or "ny"
    - value: "United States" or "New York"
    - parent_key: None for countries, "us" for states (cascading)
    - extra_data: {"code": "USA", "region": "north_america"}

- `lookup_data` (optional)
  Type: unknown
  
  anyOf:
    Type: array
    
    Items:
      Type: object
      
      Additional properties: true
  
    Type: null

Additional properties: true

## SurveyService_SurveySchemaResponse

Type: object

Response model for survey schema

Schema: [SurveyService_SurveySchemaResponse](/api-reference/schemas/surveyservice-surveyschemaresponse-5750fea8e8.md)

- `settings` (required)
  Type: object
  
  Additional properties: true

- `choices` (optional)
  Type: array
  
  Items:
    Type: object
    
    Additional properties: true

- `questions` (required)
  Type: array
  
  Items:
    Reference: [SurveyService_SurveyQuestionResponse](/api-reference/schemas/surveyservice-surveyquestionresponse-2ea80a2a2b.md); Type: object
    
    Response model for question (mirrors SurveyQuestionSchema)

- `lookups` (optional)
  Type: array
  
  Items:
    Reference: [SurveyService_LookupResponse](/api-reference/schemas/surveyservice-lookupresponse-39d07f7a0a.md); Type: object
    
    Response model for lookup data

- `lookup_data` (optional)
  Type: unknown
  
  anyOf:
    Type: array
    
    Items:
      Type: object
      
      Additional properties: true
  
    Type: null

Additional properties: true

## SurveyService_SurveyStatus

Type: string

Schema: [SurveyService_SurveyStatus](/api-reference/schemas/surveyservice-surveystatus-aecdb8324e.md)

enum: ["draft","published","archived"]

## SurveyService_SurveyStatusUpdate

Type: object

Schema: [SurveyService_SurveyStatusUpdate](/api-reference/schemas/surveyservice-surveystatusupdate-9af9f2648c.md)

- `status` (required)
  Reference: [SurveyService_SurveyStatus](/api-reference/schemas/surveyservice-surveystatus-aecdb8324e.md); Type: string
  
  enum: ["draft","published","archived"]

## SurveyService_SurveyTagAssignment

Type: object

Schema: [SurveyService_SurveyTagAssignment](/api-reference/schemas/surveyservice-surveytagassignment-054cc82606.md)

- `tag_ids` (required)
  Type: array
  
  Items:
    Type: string, uuid

## SurveyService_SurveyTemplateCreate

Type: object

Schema: [SurveyService_SurveyTemplateCreate](/api-reference/schemas/surveyservice-surveytemplatecreate-a66802de32.md)

- `name` (required)
  Type: string
  
  minLength: 1
  
  maxLength: 255

- `description` (optional)
  Type: unknown
  
  anyOf:
    Type: string
    
    maxLength: 2000
  
    Type: null

- `schema` (optional)
  Type: unknown
  
  anyOf:
    Type: object
    
    Additional properties: true
  
    Type: null

- `is_public` (optional)
  Type: boolean
  
  default: false

- `category_id` (required)
  Type: string
  
  ID of the template category
  
  minLength: 1

- `tenant_id` (optional)
  Type: unknown
  
  Tenant ID (null for global templates)
  
  anyOf:
    Type: string
  
    Type: null

## SurveyService_SurveyTemplateDetailResponse

Type: object

Schema: [SurveyService_SurveyTemplateDetailResponse](/api-reference/schemas/surveyservice-surveytemplatedetailresponse-127ad9735c.md)

- `id` (required)
  Type: string

- `tenant_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `category_id` (required)
  Type: string

- `name` (required)
  Type: string

- `description` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `schema` (optional)
  Type: unknown
  
  anyOf:
    Type: object
    
    Additional properties: true
  
    Type: null

- `is_public` (required)
  Type: boolean

- `created_by` (required)
  Type: string

- `created_at` (required)
  Type: string, date-time

- `updated_at` (required)
  Type: string, date-time

- `category` (required)
  Reference: [SurveyService_TemplateCategoryResponse](/api-reference/schemas/surveyservice-templatecategoryresponse-01bb03f726.md); Type: object

## SurveyService_SurveyTemplateListResponse

Type: object

Schema: [SurveyService_SurveyTemplateListResponse](/api-reference/schemas/surveyservice-surveytemplatelistresponse-c54ef85c4c.md)

- `items` (required)
  Type: array
  
  Items:
    Reference: [SurveyService_SurveyTemplateResponse](/api-reference/schemas/surveyservice-surveytemplateresponse-3c9b6f0e45.md); Type: object

- `total` (required)
  Type: integer

- `limit` (required)
  Type: integer

- `skip` (required)
  Type: integer

- `has_next` (required)
  Type: boolean

- `has_previous` (required)
  Type: boolean

## SurveyService_SurveyTemplateResponse

Type: object

Schema: [SurveyService_SurveyTemplateResponse](/api-reference/schemas/surveyservice-surveytemplateresponse-3c9b6f0e45.md)

- `id` (required)
  Type: string

- `tenant_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `category_id` (required)
  Type: string

- `name` (required)
  Type: string

- `description` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `schema` (optional)
  Type: unknown
  
  anyOf:
    Type: object
    
    Additional properties: true
  
    Type: null

- `is_public` (required)
  Type: boolean

- `created_by` (required)
  Type: string

- `created_at` (required)
  Type: string, date-time

- `updated_at` (required)
  Type: string, date-time

- `category` (optional)
  Type: unknown
  
  anyOf:
    Reference: [SurveyService_TemplateCategoryResponse](/api-reference/schemas/surveyservice-templatecategoryresponse-01bb03f726.md); Type: object
  
    Type: null

## SurveyService_SurveyTemplateUpdate

Type: object

Schema: [SurveyService_SurveyTemplateUpdate](/api-reference/schemas/surveyservice-surveytemplateupdate-afa2e05134.md)

- `name` (optional)
  Type: unknown
  
  anyOf:
    Type: string
    
    minLength: 1
    
    maxLength: 255
  
    Type: null

- `description` (optional)
  Type: unknown
  
  anyOf:
    Type: string
    
    maxLength: 2000
  
    Type: null

- `schema` (optional)
  Type: unknown
  
  anyOf:
    Type: object
    
    Additional properties: true
  
    Type: null

- `category_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `is_public` (optional)
  Type: unknown
  
  anyOf:
    Type: boolean
  
    Type: null

## SurveyService_SurveyUpdate

Type: object

Schema: [SurveyService_SurveyUpdate](/api-reference/schemas/surveyservice-surveyupdate-54c313a7cc.md)

- `name` (optional)
  Type: unknown
  
  anyOf:
    Type: string
    
    minLength: 1
    
    maxLength: 255
  
    Type: null

- `description` (optional)
  Type: unknown
  
  anyOf:
    Type: string
    
    maxLength: 5000
  
    Type: null

- `is_anonymous` (optional)
  Type: unknown
  
  anyOf:
    Type: boolean
  
    Type: null

- `allow_multiple_responses` (optional)
  Type: unknown
  
  anyOf:
    Type: boolean
  
    Type: null

- `open_at` (optional)
  Type: unknown
  
  anyOf:
    Type: string, date-time
  
    Type: null

- `close_at` (optional)
  Type: unknown
  
  anyOf:
    Type: string, date-time
  
    Type: null

- `scheduling_enabled` (optional)
  Type: unknown
  
  anyOf:
    Type: boolean
  
    Type: null

## SurveyService_SurveyVersionCreate

Type: object

DTO for creating a new survey version

Schema: [SurveyService_SurveyVersionCreate](/api-reference/schemas/surveyservice-surveyversioncreate-18628b3dc4.md)

- `survey_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string, uuid
  
    Type: null

- `schema` (optional)
  Type: unknown
  
  anyOf:
    Reference: [SurveyService_SurveySchema](/api-reference/schemas/surveyservice-surveyschema-bf82311926.md); Type: object
    
    Complete XLSForm-compatible survey schema.
    Stored in JSONB column in survey_versions table.
    Includes support for custom lookups worksheet for cascading selects.
    
    Note: 'title', 'version', 'description' and 'id' fields are accepted for
    backwards compatibility with frontend schema transformations but are not
    required for storage (they're derived from the survey/version metadata).
  
    Type: null

- `version` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `increment_type` (optional)
  Type: unknown
  
  default: "patch"
  
  anyOf:
    Type: string
  
    Type: null

## SurveyService_SurveyVersionUpdate

Type: object

DTO for updating a draft survey version (cannot update published).

Accepts schema in two formats:
1. Direct format: { settings, choices, questions, ... }
2. Wrapped format: { schema: { settings, choices, questions, ... } }

The 'schema' field (when present) may include additional metadata like
'title' and 'version' which are stripped during parsing.

Schema: [SurveyService_SurveyVersionUpdate](/api-reference/schemas/surveyservice-surveyversionupdate-730f183650.md)

- `schema` (optional)
  Type: unknown
  
  anyOf:
    Type: object
    
    Additional properties: true
  
    Type: null

- `settings` (optional)
  Type: unknown
  
  anyOf:
    Type: unknown
  
    Type: null

- `choices` (optional)
  Type: unknown
  
  anyOf:
    Type: unknown
  
    Type: null

- `questions` (optional)
  Type: unknown
  
  anyOf:
    Type: unknown
  
    Type: null

- `lookups` (optional)
  Type: unknown
  
  anyOf:
    Type: unknown
  
    Type: null

- `lookup_data` (optional)
  Type: unknown
  
  anyOf:
    Type: unknown
  
    Type: null

Additional properties: true

## SurveyService_SurveyWithAccessResponse

Type: object

Schema: [SurveyService_SurveyWithAccessResponse](/api-reference/schemas/surveyservice-surveywithaccessresponse-13910afbb0.md)

- `id` (required)
  Type: string, uuid

- `tenant_id` (required)
  Type: string, uuid

- `name` (required)
  Type: string

- `status` (required)
  Type: string

- `survey_code` (optional)
  Type: unknown
  
  anyOf:
    Type: integer
  
    Type: null

- `version` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `access_level` (required)
  Type: string

- `can_fill` (required)
  Type: boolean

- `can_view` (required)
  Type: boolean

- `can_approve` (optional)
  Type: boolean
  
  default: false

- `created_at` (required)
  Type: string, date-time

- `updated_at` (optional)
  Type: unknown
  
  anyOf:
    Type: string, date-time
  
    Type: null

## SurveyService_TagCreate

Type: object

Schema: [SurveyService_TagCreate](/api-reference/schemas/surveyservice-tagcreate-17544066f2.md)

- `name` (required)
  Type: string
  
  minLength: 1
  
  maxLength: 100

- `color` (optional)
  Type: unknown
  
  anyOf:
    Type: string
    
    pattern: "^#[0-9A-Fa-f]{6}$"
  
    Type: null

## SurveyService_TagListResponse

Type: object

Schema: [SurveyService_TagListResponse](/api-reference/schemas/surveyservice-taglistresponse-d30ebd816a.md)

- `items` (required)
  Type: array
  
  Items:
    Reference: [SurveyService_TagResponse](/api-reference/schemas/surveyservice-tagresponse-1b11fe3a5a.md); Type: object

- `total` (required)
  Type: integer

## SurveyService_TagResponse

Type: object

Schema: [SurveyService_TagResponse](/api-reference/schemas/surveyservice-tagresponse-1b11fe3a5a.md)

- `id` (required)
  Type: string, uuid

- `tenant_id` (required)
  Type: string, uuid

- `name` (required)
  Type: string

- `color` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `created_at` (required)
  Type: string, date-time

- `updated_at` (required)
  Type: string, date-time

- `created_by` (required)
  Type: string, uuid

## SurveyService_TagUpdate

Type: object

Schema: [SurveyService_TagUpdate](/api-reference/schemas/surveyservice-tagupdate-526f8f866a.md)

- `name` (optional)
  Type: unknown
  
  anyOf:
    Type: string
    
    minLength: 1
    
    maxLength: 100
  
    Type: null

- `color` (optional)
  Type: unknown
  
  anyOf:
    Type: string
    
    pattern: "^#[0-9A-Fa-f]{6}$"
  
    Type: null

## SurveyService_TemplateCategoryCreate

Type: object

Schema: [SurveyService_TemplateCategoryCreate](/api-reference/schemas/surveyservice-templatecategorycreate-9d2165817d.md)

- `name` (required)
  Type: string
  
  minLength: 1
  
  maxLength: 255

- `description` (optional)
  Type: unknown
  
  anyOf:
    Type: string
    
    maxLength: 2000
  
    Type: null

- `icon_name` (optional)
  Type: unknown
  
  anyOf:
    Type: string
    
    maxLength: 100
  
    Type: null

## SurveyService_TemplateCategoryListResponse

Type: object

Schema: [SurveyService_TemplateCategoryListResponse](/api-reference/schemas/surveyservice-templatecategorylistresponse-5b69288fd0.md)

- `items` (required)
  Type: array
  
  Items:
    Reference: [SurveyService_TemplateCategoryResponse](/api-reference/schemas/surveyservice-templatecategoryresponse-01bb03f726.md); Type: object

- `total` (required)
  Type: integer

- `limit` (required)
  Type: integer

- `skip` (required)
  Type: integer

- `has_next` (required)
  Type: boolean

- `has_previous` (required)
  Type: boolean

## SurveyService_TemplateCategoryResponse

Type: object

Schema: [SurveyService_TemplateCategoryResponse](/api-reference/schemas/surveyservice-templatecategoryresponse-01bb03f726.md)

- `id` (required)
  Type: string

- `tenant_id` (required)
  Type: string

- `name` (required)
  Type: string

- `description` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `icon_name` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `created_at` (required)
  Type: string, date-time

- `updated_at` (required)
  Type: string, date-time

## SurveyService_TemplateCategoryUpdate

Type: object

Schema: [SurveyService_TemplateCategoryUpdate](/api-reference/schemas/surveyservice-templatecategoryupdate-6f49019647.md)

- `name` (optional)
  Type: unknown
  
  anyOf:
    Type: string
    
    minLength: 1
    
    maxLength: 255
  
    Type: null

- `description` (optional)
  Type: unknown
  
  anyOf:
    Type: string
    
    maxLength: 2000
  
    Type: null

- `icon_name` (optional)
  Type: unknown
  
  anyOf:
    Type: string
    
    maxLength: 100
  
    Type: null

## SurveyService_TemplateImportResponse

Type: object

Schema: [SurveyService_TemplateImportResponse](/api-reference/schemas/surveyservice-templateimportresponse-dc4e6cc7de.md)

- `id` (required)
  Type: string

- `tenant_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `category_id` (required)
  Type: string

- `name` (required)
  Type: string

- `description` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `schema` (optional)
  Type: unknown
  
  anyOf:
    Type: object
    
    Additional properties: true
  
    Type: null

- `is_public` (required)
  Type: boolean

- `created_by` (required)
  Type: string

- `created_at` (required)
  Type: string, date-time

- `updated_at` (required)
  Type: string, date-time

- `category` (optional)
  Type: unknown
  
  anyOf:
    Reference: [SurveyService_TemplateCategoryResponse](/api-reference/schemas/surveyservice-templatecategoryresponse-01bb03f726.md); Type: object
  
    Type: null

- `import_warnings` (optional)
  Type: array
  
  Items:
    Type: object
    
    Additional properties: true

## SurveyService_TemplatesByCategoryResponse

Type: object

Schema: [SurveyService_TemplatesByCategoryResponse](/api-reference/schemas/surveyservice-templatesbycategoryresponse-211480a557.md)

- `category` (required)
  Reference: [SurveyService_TemplateCategoryResponse](/api-reference/schemas/surveyservice-templatecategoryresponse-01bb03f726.md); Type: object

- `templates` (required)
  Type: array
  
  Items:
    Reference: [SurveyService_SurveyTemplateResponse](/api-reference/schemas/surveyservice-surveytemplateresponse-3c9b6f0e45.md); Type: object

- `template_count` (required)
  Type: integer

## SurveyService_ValidateCollectionGrantResponse

Type: object

Schema: [SurveyService_ValidateCollectionGrantResponse](/api-reference/schemas/surveyservice-validatecollectiongrantresponse-85d32170bf.md)

- `valid` (required)
  Type: boolean

- `project_bound` (required)
  Type: boolean

- `grant_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `kind` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `survey_version_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `granted_at` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `project_status_at_issue` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `late_arrival_flagged` (optional)
  Type: boolean
  
  default: false

## SurveyService_ValidationError

Type: object

Schema: [SurveyService_ValidationError](/api-reference/schemas/surveyservice-validationerror-21d2a3258e.md)

- `loc` (required)
  Type: array
  
  Items:
    Type: unknown
    
    anyOf:
      Type: string
    
      Type: integer

- `msg` (required)
  Type: string

- `type` (required)
  Type: string

- `input` (optional)
  Type: unknown

- `ctx` (optional)
  Type: object

## DataService_AnalyticsSummaryDTO

Type: object

Schema: [DataService_AnalyticsSummaryDTO](/api-reference/schemas/dataservice-analyticssummarydto-f89f77fe05.md)

- `survey_id` (required)
  Type: string

- `total_responses` (required)
  Type: integer

- `unique_respondents` (required)
  Type: integer

- `response_rate` (required)
  Type: unknown
  
  anyOf:
    Type: number
  
    Type: null

- `average_completion_time_seconds` (required)
  Type: unknown
  
  anyOf:
    Type: number
  
    Type: null

- `questions_analyzed` (required)
  Type: integer

- `top_questions` (required)
  Type: array
  
  Items:
    Reference: [DataService_QuestionStatsDTO](/api-reference/schemas/dataservice-questionstatsdto-7c2abb2676.md); Type: object

## DataService_AnswerDistributionDTO

Type: object

Schema: [DataService_AnswerDistributionDTO](/api-reference/schemas/dataservice-answerdistributiondto-ec182b84a8.md)

- `question_id` (required)
  Type: string

- `value` (required)
  Type: string

- `count` (required)
  Type: integer

- `percentage` (required)
  Type: number

## DataService_ApprovalActionResponse

Type: object

Schema: [DataService_ApprovalActionResponse](/api-reference/schemas/dataservice-approvalactionresponse-fc3f5095f9.md)

- `success` (required)
  Type: boolean

- `message` (required)
  Type: string

- `response` (required)
  Reference: [DataService_ResponseDTO](/api-reference/schemas/dataservice-responsedto-4965ff7816.md); Type: object

## DataService_AttachmentDeleteResponse

Type: object

Schema: [DataService_AttachmentDeleteResponse](/api-reference/schemas/dataservice-attachmentdeleteresponse-70c557fcbf.md)

- `message` (required)
  Type: string

- `id` (required)
  Type: string

## DataService_AttachmentListDTO

Type: object

Schema: [DataService_AttachmentListDTO](/api-reference/schemas/dataservice-attachmentlistdto-1d811c8982.md)

- `attachments` (required)
  Type: array
  
  Items:
    Reference: [DataService_AttachmentResponseDTO](/api-reference/schemas/dataservice-attachmentresponsedto-d97d998c70.md); Type: object

- `total` (required)
  Type: integer

- `page` (required)
  Type: integer

- `limit` (required)
  Type: integer

## DataService_AttachmentRecordDTO

Type: object

Schema: [DataService_AttachmentRecordDTO](/api-reference/schemas/dataservice-attachmentrecorddto-a8c558619c.md)

- `entity_type` (required)
  Type: string
  
  Type of entity (e.g., 'interview', 'response')

- `entity_id` (required)
  Type: string, uuid
  
  ID of the associated entity

- `field_name` (optional)
  Type: unknown
  
  Question field name
  
  anyOf:
    Type: string
  
    Type: null

- `filename` (required)
  Type: string
  
  Stored filename

- `original_filename` (required)
  Type: string
  
  Original filename

- `file_type` (optional)
  Type: unknown
  
  File category (image, audio, video, document)
  
  anyOf:
    Type: string
  
    Type: null

- `mime_type` (optional)
  Type: unknown
  
  MIME type
  
  anyOf:
    Type: string
  
    Type: null

- `file_size` (optional)
  Type: integer
  
  File size in bytes
  
  default: 0

- `checksum` (optional)
  Type: unknown
  
  SHA-256 checksum
  
  anyOf:
    Type: string
  
    Type: null

- `storage_url` (optional)
  Type: unknown
  
  URL to the uploaded file
  
  anyOf:
    Type: string
  
    Type: null

- `captured_at` (optional)
  Type: unknown
  
  Device capture timestamp
  
  anyOf:
    Type: string
  
    Type: null

- `description` (optional)
  Type: unknown
  
  Notes/description
  
  anyOf:
    Type: string
  
    Type: null

## DataService_AttachmentResponseDTO

Type: object

Schema: [DataService_AttachmentResponseDTO](/api-reference/schemas/dataservice-attachmentresponsedto-d97d998c70.md)

- `id` (required)
  Type: string

- `entity_type` (required)
  Type: string

- `entity_id` (required)
  Type: string

- `filename` (required)
  Type: string

- `original_filename` (required)
  Type: string

- `file_type` (required)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `mime_type` (required)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `file_size` (required)
  Type: integer

- `description` (required)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `uploaded_by` (required)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `checksum` (required)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `is_public` (required)
  Type: boolean

- `field_name` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `captured_at` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `status` (required)
  Type: string

- `created_at` (required)
  Type: string

- `download_url` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

## DataService_Body_generate_random_sample_api_v1_data_sampling_generate_post

Type: object

Schema: [DataService_Body_generate_random_sample_api_v1_data_sampling_generate_post](/api-reference/schemas/dataservice-body-generate-random-sample-api-v1-data-sampling-generate-post-cfa6a9f524.md)

- `file` (required)
  Type: string

- `sample_size` (required)
  Type: integer

- `output_format` (optional)
  Type: string
  
  default: "csv"

## DataService_Body_generate_random_sample_api_v1_sampling_generate_post

Type: object

Schema: [DataService_Body_generate_random_sample_api_v1_sampling_generate_post](/api-reference/schemas/dataservice-body-generate-random-sample-api-v1-sampling-generate-post-3bd4a7c7c2.md)

- `file` (required)
  Type: string

- `sample_size` (required)
  Type: integer

- `output_format` (optional)
  Type: string
  
  default: "csv"

## DataService_Body_upload_attachment_api_v1_attachments__post

Type: object

Schema: [DataService_Body_upload_attachment_api_v1_attachments__post](/api-reference/schemas/dataservice-body-upload-attachment-api-v1-attachments-post-26b3416a69.md)

- `entity_type` (required)
  Type: string
  
  Entity type (response, survey, etc.)

- `entity_id` (required)
  Type: string, uuid
  
  Entity ID

- `description` (optional)
  Type: unknown
  
  Description
  
  anyOf:
    Type: string
  
    Type: null

- `file` (required)
  Type: string
  
  File to upload

## DataService_BulkApproveRequest

Type: object

Schema: [DataService_BulkApproveRequest](/api-reference/schemas/dataservice-bulkapproverequest-f8cbfdfa6b.md)

- `survey_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string, uuid
  
    Type: null

- `status` (optional)
  Type: unknown
  
  anyOf:
    Type: array
    
    Items:
      Reference: [DataService_ResponseStatus](/api-reference/schemas/dataservice-responsestatus-e5ef0d2145.md); Type: string
      
      enum: ["draft","submitted","completed","invalidated","pending_approval","approved","rejected","terminated"]
  
    Type: null

- `start_date` (optional)
  Type: unknown
  
  anyOf:
    Type: string, date-time
  
    Type: null

- `end_date` (optional)
  Type: unknown
  
  anyOf:
    Type: string, date-time
  
    Type: null

- `response_ids` (optional)
  Type: unknown
  
  anyOf:
    Type: array
    
    Items:
      Type: string, uuid
  
    Type: null

- `dry_run` (optional)
  Type: boolean
  
  default: false

- `notes` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

## DataService_BulkDeleteRequest

Type: object

Schema: [DataService_BulkDeleteRequest](/api-reference/schemas/dataservice-bulkdeleterequest-042aef6d19.md)

- `survey_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string, uuid
  
    Type: null

- `status` (optional)
  Type: unknown
  
  anyOf:
    Type: array
    
    Items:
      Reference: [DataService_ResponseStatus](/api-reference/schemas/dataservice-responsestatus-e5ef0d2145.md); Type: string
      
      enum: ["draft","submitted","completed","invalidated","pending_approval","approved","rejected","terminated"]
  
    Type: null

- `start_date` (optional)
  Type: unknown
  
  anyOf:
    Type: string, date-time
  
    Type: null

- `end_date` (optional)
  Type: unknown
  
  anyOf:
    Type: string, date-time
  
    Type: null

- `response_ids` (optional)
  Type: unknown
  
  anyOf:
    Type: array
    
    Items:
      Type: string, uuid
  
    Type: null

- `dry_run` (optional)
  Type: boolean
  
  default: false

## DataService_BulkInvalidateRequest

Type: object

Schema: [DataService_BulkInvalidateRequest](/api-reference/schemas/dataservice-bulkinvalidaterequest-645d71b8e2.md)

- `survey_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string, uuid
  
    Type: null

- `status` (optional)
  Type: unknown
  
  anyOf:
    Type: array
    
    Items:
      Reference: [DataService_ResponseStatus](/api-reference/schemas/dataservice-responsestatus-e5ef0d2145.md); Type: string
      
      enum: ["draft","submitted","completed","invalidated","pending_approval","approved","rejected","terminated"]
  
    Type: null

- `start_date` (optional)
  Type: unknown
  
  anyOf:
    Type: string, date-time
  
    Type: null

- `end_date` (optional)
  Type: unknown
  
  anyOf:
    Type: string, date-time
  
    Type: null

- `response_ids` (optional)
  Type: unknown
  
  anyOf:
    Type: array
    
    Items:
      Type: string, uuid
  
    Type: null

- `dry_run` (optional)
  Type: boolean
  
  default: false

- `reason` (required)
  Type: string

## DataService_BulkOperationResponseDTO

Type: object

Schema: [DataService_BulkOperationResponseDTO](/api-reference/schemas/dataservice-bulkoperationresponsedto-213250aa8e.md)

- `success_count` (optional)
  Type: integer
  
  default: 0

- `failure_count` (optional)
  Type: integer
  
  default: 0

- `skipped_count` (optional)
  Type: integer
  
  default: 0

- `errors` (optional)
  Type: array
  
  default: []
  
  Items:
    Type: object
    
    Additional properties: true

- `dry_run` (optional)
  Type: boolean
  
  default: false

## DataService_BulkResponseDTO

Type: object

Schema: [DataService_BulkResponseDTO](/api-reference/schemas/dataservice-bulkresponsedto-6186a6cba3.md)

- `responses` (required)
  Type: array
  
  maxItems: 100
  
  Items:
    Reference: [DataService_BulkResponseItemDTO](/api-reference/schemas/dataservice-bulkresponseitemdto-815f063e10.md); Type: object

## DataService_BulkResponseItemDTO

Type: object

Schema: [DataService_BulkResponseItemDTO](/api-reference/schemas/dataservice-bulkresponseitemdto-815f063e10.md)

- `idempotency_key` (required)
  Type: string
  
  Unique key for idempotency
  
  maxLength: 255

- `survey_id` (required)
  Type: string, uuid
  
  Survey ID

- `version_id` (optional)
  Type: unknown
  
  Survey version ID
  
  anyOf:
    Type: string, uuid
  
    Type: null

- `respondent_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string
    
    maxLength: 255
  
    Type: null

- `answers` (required)
  Type: object
  
  Question ID to answer mapping
  
  Additional properties: true

- `metadata` (optional)
  Type: unknown
  
  Additional metadata (clients send this under the 'metadata' key)
  
  anyOf:
    Type: object
    
    Additional properties: true
  
    Type: null

- `submitted_at` (optional)
  Type: unknown
  
  anyOf:
    Type: string, date-time
  
    Type: null

## DataService_BulkResponseResultDTO

Type: object

Schema: [DataService_BulkResponseResultDTO](/api-reference/schemas/dataservice-bulkresponseresultdto-7fef7c2d2a.md)

- `total` (required)
  Type: integer

- `successful` (required)
  Type: integer

- `failed` (required)
  Type: integer

- `results` (required)
  Type: array
  
  Items:
    Reference: [DataService_BulkResponseResultItemDTO](/api-reference/schemas/dataservice-bulkresponseresultitemdto-1444f4952d.md); Type: object

## DataService_BulkResponseResultItemDTO

Type: object

Schema: [DataService_BulkResponseResultItemDTO](/api-reference/schemas/dataservice-bulkresponseresultitemdto-1444f4952d.md)

- `idempotency_key` (required)
  Type: string

- `response_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `status` (required)
  Type: string

- `error` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `submitted_at` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

## DataService_BulkUpdateStatusRequest

Type: object

Schema: [DataService_BulkUpdateStatusRequest](/api-reference/schemas/dataservice-bulkupdatestatusrequest-81e86f7c47.md)

- `survey_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string, uuid
  
    Type: null

- `status` (optional)
  Type: unknown
  
  anyOf:
    Type: array
    
    Items:
      Reference: [DataService_ResponseStatus](/api-reference/schemas/dataservice-responsestatus-e5ef0d2145.md); Type: string
      
      enum: ["draft","submitted","completed","invalidated","pending_approval","approved","rejected","terminated"]
  
    Type: null

- `start_date` (optional)
  Type: unknown
  
  anyOf:
    Type: string, date-time
  
    Type: null

- `end_date` (optional)
  Type: unknown
  
  anyOf:
    Type: string, date-time
  
    Type: null

- `response_ids` (optional)
  Type: unknown
  
  anyOf:
    Type: array
    
    Items:
      Type: string, uuid
  
    Type: null

- `dry_run` (optional)
  Type: boolean
  
  default: false

- `new_status` (required)
  Type: string

## DataService_DashboardMetricsDTO

Type: object

Schema: [DataService_DashboardMetricsDTO](/api-reference/schemas/dataservice-dashboardmetricsdto-e8c4c9ad5b.md)

- `active_forms` (required)
  Type: integer

- `active_enumerators` (required)
  Type: integer

- `submissions_today` (required)
  Type: integer

- `failed_submissions` (required)
  Type: integer

- `latest_submission_times` (required)
  Type: array
  
  Items:
    Reference: [DataService_SurveyLatestSubmissionDTO](/api-reference/schemas/dataservice-surveylatestsubmissiondto-d34afcc8d1.md); Type: object

- `timezone_context` (required)
  Type: string

## DataService_DuplicateGroupDto

Type: object

Schema: [DataService_DuplicateGroupDto](/api-reference/schemas/dataservice-duplicategroupdto-569a80b84c.md)

- `id` (required)
  Type: string, uuid
  
  Duplicate group ID

- `primary_response_id` (required)
  Type: string, uuid
  
  Primary response ID

- `duplicate_response_id` (required)
  Type: string, uuid
  
  Duplicate response ID

- `survey_id` (required)
  Type: string, uuid
  
  Survey ID

- `confidence_score` (required)
  Type: number
  
  Confidence score

- `criteria_breakdown` (required)
  Type: object
  
  Breakdown of scores per criterion
  
  Additional properties: 
    Type: number

- `status` (required)
  Type: string
  
  Status of the duplicate group (flagged, merged, discarded, kept_both)

- `merged_by` (optional)
  Type: unknown
  
  User who performed the merge
  
  anyOf:
    Type: string, uuid
  
    Type: null

- `merged_at` (optional)
  Type: unknown
  
  When the merge was performed
  
  anyOf:
    Type: string, date-time
  
    Type: null

- `created_at` (required)
  Type: string, date-time
  
  When the duplicate was detected

## DataService_DuplicateGroupListDto

Type: object

Schema: [DataService_DuplicateGroupListDto](/api-reference/schemas/dataservice-duplicategrouplistdto-45925a02af.md)

- `items` (required)
  Type: array
  
  List of duplicate groups
  
  Items:
    Reference: [DataService_DuplicateGroupDto](/api-reference/schemas/dataservice-duplicategroupdto-569a80b84c.md); Type: object

- `total` (required)
  Type: integer
  
  Total number of duplicate groups

- `skip` (required)
  Type: integer
  
  Number of items skipped

- `limit` (required)
  Type: integer
  
  Number of items per page

- `has_next` (required)
  Type: boolean
  
  Whether there are more items

- `has_previous` (required)
  Type: boolean
  
  Whether there are previous items

## DataService_EnrichedAnswerDTO

Type: object

Schema: [DataService_EnrichedAnswerDTO](/api-reference/schemas/dataservice-enrichedanswerdto-26018a4e78.md)

- `question_id` (required)
  Type: string

- `question_type` (required)
  Type: string

- `value` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `value_json` (optional)
  Type: unknown
  
  anyOf:
    Type: unknown
  
    Type: null

- `presigned_url` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

## DataService_EnumeratorStatsDTO

Type: object

Schema: [DataService_EnumeratorStatsDTO](/api-reference/schemas/dataservice-enumeratorstatsdto-770c9262e3.md)

- `user_id` (required)
  Type: string

- `survey_id` (required)
  Type: string

- `total_submissions` (required)
  Type: integer

- `total_rejected` (required)
  Type: integer

- `rejection_rate` (required)
  Type: number

- `avg_duration_seconds` (optional)
  Type: unknown
  
  anyOf:
    Type: number
  
    Type: null

- `duration_count` (optional)
  Type: integer
  
  default: 0

- `avg_quality_score` (optional)
  Type: unknown
  
  anyOf:
    Type: number
  
    Type: null

- `last_submission_at` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `enumerator_name` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `enumerator_user_code` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `enumerator_email` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

## DataService_EnumeratorStatsListDTO

Type: object

Schema: [DataService_EnumeratorStatsListDTO](/api-reference/schemas/dataservice-enumeratorstatslistdto-6246a16b16.md)

- `items` (required)
  Type: array
  
  Items:
    Reference: [DataService_EnumeratorStatsDTO](/api-reference/schemas/dataservice-enumeratorstatsdto-770c9262e3.md); Type: object

- `total` (required)
  Type: integer

- `skip` (required)
  Type: integer

- `limit` (required)
  Type: integer

## DataService_ExportRequestDTO

Type: object

Schema: [DataService_ExportRequestDTO](/api-reference/schemas/dataservice-exportrequestdto-6e960894dd.md)

- `survey_id` (required)
  Type: string, uuid
  
  Survey ID to export

- `format` (optional)
  Type: string
  
  Export format: csv, xlsx, json, dta, sav
  
  default: "csv"

- `status` (optional)
  Type: unknown
  
  Filter by response status
  
  anyOf:
    Type: string
  
    Type: null

- `from_date` (optional)
  Type: unknown
  
  Filter from date
  
  anyOf:
    Type: string, date-time
  
    Type: null

- `to_date` (optional)
  Type: unknown
  
  Filter to date
  
  anyOf:
    Type: string, date-time
  
    Type: null

- `respondent_id` (optional)
  Type: unknown
  
  Filter by respondent
  
  anyOf:
    Type: string
  
    Type: null

- `include_metadata` (optional)
  Type: boolean
  
  Include response metadata
  
  default: true

- `include_answers` (optional)
  Type: boolean
  
  Include answer data
  
  default: true

- `version_id` (optional)
  Type: unknown
  
  Survey version ID for schema labels (uses latest if not set)
  
  anyOf:
    Type: string
  
    Type: null

- `language` (optional)
  Type: unknown
  
  Language code for translated labels (e.g., 'es', 'fr')
  
  anyOf:
    Type: string
  
    Type: null

## DataService_HTTPValidationError

Type: object

Schema: [DataService_HTTPValidationError](/api-reference/schemas/dataservice-httpvalidationerror-2b62d4c031.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [DataService_ValidationError](/api-reference/schemas/dataservice-validationerror-be7f37f547.md); Type: object

## DataService_MediaExportStatusDTO

Type: object

Schema: [DataService_MediaExportStatusDTO](/api-reference/schemas/dataservice-mediaexportstatusdto-010ab9ea35.md)

- `request_id` (required)
  Type: string

- `task_status` (required)
  Type: string

- `result` (optional)
  Type: unknown
  
  anyOf:
    Type: object
    
    Additional properties: true
  
    Type: null

- `error` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

## DataService_MergeRequestDto

Type: object

Schema: [DataService_MergeRequestDto](/api-reference/schemas/dataservice-mergerequestdto-552a15fd50.md)

- `target_response_id` (required)
  Type: string, uuid
  
  Response ID to merge into (primary)

- `merge_note` (optional)
  Type: unknown
  
  Note about the merge
  
  anyOf:
    Type: string
  
    Type: null

- `conflict_resolutions` (optional)
  Type: unknown
  
  Resolutions for conflicting fields (field name -> response ID to keep)
  
  anyOf:
    Type: object
    
    Additional properties: 
      Type: string
  
    Type: null

## DataService_MergeResponseDto

Type: object

Schema: [DataService_MergeResponseDto](/api-reference/schemas/dataservice-mergeresponsedto-9a85c20cf5.md)

- `success` (required)
  Type: boolean
  
  Whether the merge was successful

- `primary_response_id` (required)
  Type: string, uuid
  
  Primary response ID after merge

- `merged_response_id` (required)
  Type: string, uuid
  
  Response ID that was merged

- `message` (required)
  Type: string
  
  Status message

## DataService_PendingApprovalCountDTO

Type: object

Schema: [DataService_PendingApprovalCountDTO](/api-reference/schemas/dataservice-pendingapprovalcountdto-c52d4fc3f3.md)

- `survey_id` (required)
  Type: string, uuid

- `count` (required)
  Type: integer

## DataService_QuestionStatsDTO

Type: object

Schema: [DataService_QuestionStatsDTO](/api-reference/schemas/dataservice-questionstatsdto-7c2abb2676.md)

- `question_id` (required)
  Type: string

- `question_type` (required)
  Type: string

- `total_answers` (required)
  Type: integer

- `unique_respondents` (required)
  Type: integer

- `most_common_value` (required)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `most_common_count` (required)
  Type: integer

## DataService_ResponseApprovalRequest

Type: object

Schema: [DataService_ResponseApprovalRequest](/api-reference/schemas/dataservice-responseapprovalrequest-79fb6037db.md)

- `notes` (optional)
  Type: unknown
  
  Optional approval notes
  
  anyOf:
    Type: string
  
    Type: null

## DataService_ResponseChangeDTO

Type: object

A single response change. Deliberately carries no answer values.

Schema: [DataService_ResponseChangeDTO](/api-reference/schemas/dataservice-responsechangedto-8743e04bc7.md)

- `response_id` (required)
  Type: string

- `survey_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `change_type` (required)
  Type: string

- `changed_fields` (optional)
  Type: unknown
  
  anyOf:
    Type: array
    
    Items:
      Type: string
  
    Type: null

- `changed_at` (required)
  Type: string

## DataService_ResponseChangeFeedDTO

Type: object

Schema: [DataService_ResponseChangeFeedDTO](/api-reference/schemas/dataservice-responsechangefeeddto-027825417d.md)

- `items` (required)
  Type: array
  
  Items:
    Reference: [DataService_ResponseChangeDTO](/api-reference/schemas/dataservice-responsechangedto-8743e04bc7.md); Type: object
    
    A single response change. Deliberately carries no answer values.

- `next_watermark` (required)
  Type: string

- `has_more` (required)
  Type: boolean

## DataService_ResponseCorrectionRequest

Type: object

Enumerator correction of a rejected response.

``answers`` must contain only questions the supervisor flagged as checked.
Supplying answers for unflagged questions is rejected with 422. Questions
omitted here are left unchanged.

Schema: [DataService_ResponseCorrectionRequest](/api-reference/schemas/dataservice-responsecorrectionrequest-cf62c1af2f.md)

- `answers` (required)
  Type: object
  
  Corrected answers for flagged questions only
  
  Additional properties: true

- `reason` (optional)
  Type: unknown
  
  Reason for correction
  
  anyOf:
    Type: string
    
    maxLength: 500
  
    Type: null

## DataService_ResponseCorrectionResponse

Type: object

Schema: [DataService_ResponseCorrectionResponse](/api-reference/schemas/dataservice-responsecorrectionresponse-c28bcbc076.md)

- `success` (optional)
  Type: boolean
  
  default: true

- `replayed` (optional)
  Type: boolean
  
  default: false

- `response_id` (required)
  Type: string, uuid

- `status` (required)
  Type: string

- `edit_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string, uuid
  
    Type: null

- `edit_count` (required)
  Type: integer

- `changed_questions` (required)
  Type: array
  
  Items:
    Type: string

- `updated_at` (optional)
  Type: unknown
  
  anyOf:
    Type: string, date-time
  
    Type: null

## DataService_ResponseDTO

Type: object

Schema: [DataService_ResponseDTO](/api-reference/schemas/dataservice-responsedto-4965ff7816.md)

- `id` (required)
  Type: string

- `survey_id` (required)
  Type: string

- `tenant_id` (required)
  Type: string

- `version_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `idempotency_key` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `interview_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `respondent_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `rid` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `uid` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `status` (required)
  Type: string

- `answers` (required)
  Type: integer

- `completed_answers` (required)
  Type: integer

- `progress_percentage` (required)
  Type: integer

- `started_at` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `submitted_at` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `completed_at` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `duration_seconds` (optional)
  Type: unknown
  
  anyOf:
    Type: integer
  
    Type: null

- `ip_address` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `user_agent` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `metadata` (optional)
  Type: unknown
  
  anyOf:
    Type: object
    
    Additional properties: true
  
    Type: null

- `is_valid` (required)
  Type: boolean

- `submitted_by` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `enumerator_user_code` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `enumerator_email` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `enumerator_name` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `respondent_name` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `respondent_user_code` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `device_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `sync_batch_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `synced_at` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `approved_by` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `approved_at` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `approval_notes` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `rejected_by` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `rejected_at` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `rejection_reason` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `review_flags` (optional)
  Type: unknown
  
  anyOf:
    Type: object
    
    Additional properties: true
  
    Type: null

- `response_language` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `is_reconciled` (optional)
  Type: boolean
  
  default: false

- `reconciled_at` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `reconciliation_grant_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `created_at` (required)
  Type: string

- `updated_at` (required)
  Type: string

## DataService_ResponseDetailDTO

Type: object

Schema: [DataService_ResponseDetailDTO](/api-reference/schemas/dataservice-responsedetaildto-a1480d5392.md)

- `id` (required)
  Type: string

- `survey_id` (required)
  Type: string

- `tenant_id` (required)
  Type: string

- `version_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `idempotency_key` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `interview_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `respondent_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `rid` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `uid` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `status` (required)
  Type: string

- `answers` (required)
  Type: integer

- `completed_answers` (required)
  Type: integer

- `progress_percentage` (required)
  Type: integer

- `started_at` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `submitted_at` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `completed_at` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `duration_seconds` (optional)
  Type: unknown
  
  anyOf:
    Type: integer
  
    Type: null

- `ip_address` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `user_agent` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `metadata` (optional)
  Type: unknown
  
  anyOf:
    Type: object
    
    Additional properties: true
  
    Type: null

- `is_valid` (required)
  Type: boolean

- `submitted_by` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `enumerator_user_code` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `enumerator_email` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `enumerator_name` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `respondent_name` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `respondent_user_code` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `device_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `sync_batch_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `synced_at` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `approved_by` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `approved_at` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `approval_notes` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `rejected_by` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `rejected_at` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `rejection_reason` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `review_flags` (optional)
  Type: unknown
  
  anyOf:
    Type: object
    
    Additional properties: true
  
    Type: null

- `response_language` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `is_reconciled` (optional)
  Type: boolean
  
  default: false

- `reconciled_at` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `reconciliation_grant_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `created_at` (required)
  Type: string

- `updated_at` (required)
  Type: string

- `answers_list` (optional)
  Type: array
  
  default: []
  
  Items:
    Reference: [DataService_EnrichedAnswerDTO](/api-reference/schemas/dataservice-enrichedanswerdto-26018a4e78.md); Type: object

## DataService_ResponseEditHistoryDTO

Type: object

Schema: [DataService_ResponseEditHistoryDTO](/api-reference/schemas/dataservice-responseedithistorydto-bc9831bff8.md)

- `id` (required)
  Type: string, uuid

- `edited_at` (required)
  Type: string, date-time

- `edited_by` (required)
  Type: string, uuid

- `reason` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `changes_count` (required)
  Type: integer

## DataService_ResponseEditHistoryListDTO

Type: object

Schema: [DataService_ResponseEditHistoryListDTO](/api-reference/schemas/dataservice-responseedithistorylistdto-aea661769a.md)

- `items` (required)
  Type: array
  
  Items:
    Reference: [DataService_ResponseEditHistoryDTO](/api-reference/schemas/dataservice-responseedithistorydto-bc9831bff8.md); Type: object

- `total` (required)
  Type: integer

## DataService_ResponseEditRequest

Type: object

Schema: [DataService_ResponseEditRequest](/api-reference/schemas/dataservice-responseeditrequest-37984377ec.md)

- `answers` (required)
  Type: object
  
  Question ID to answer mapping
  
  Additional properties: true

- `reason` (optional)
  Type: unknown
  
  Reason for edit
  
  anyOf:
    Type: string
    
    maxLength: 500
  
    Type: null

## DataService_ResponseEditResponse

Type: object

Schema: [DataService_ResponseEditResponse](/api-reference/schemas/dataservice-responseeditresponse-d2dbe15ff5.md)

- `success` (required)
  Type: boolean

- `edit_id` (required)
  Type: string, uuid

- `response` (required)
  Reference: [DataService_ResponseDetailDTO](/api-reference/schemas/dataservice-responsedetaildto-a1480d5392.md); Type: object

- `changes_count` (required)
  Type: integer

## DataService_ResponseListDTO

Type: object

Schema: [DataService_ResponseListDTO](/api-reference/schemas/dataservice-responselistdto-2944fe7056.md)

- `items` (required)
  Type: array
  
  Items:
    Reference: [DataService_ResponseDTO](/api-reference/schemas/dataservice-responsedto-4965ff7816.md); Type: object

- `total` (required)
  Type: integer

- `skip` (required)
  Type: integer

- `limit` (required)
  Type: integer

- `has_next` (required)
  Type: boolean

- `has_previous` (required)
  Type: boolean

## DataService_ResponseRejectionRequest

Type: object

Schema: [DataService_ResponseRejectionRequest](/api-reference/schemas/dataservice-responserejectionrequest-10039c1db0.md)

- `reason` (required)
  Type: string
  
  Required rejection reason
  
  minLength: 1

- `flags` (required)
  Type: object
  
  Required review flags to persist atomically with the rejection. At least one flag must have checked=true. There is no fallback to previously stored flags.
  
  Additional properties: 
    Reference: [DataService_ReviewFlag](/api-reference/schemas/dataservice-reviewflag-00bddaec6b.md); Type: object

## DataService_ResponseStatsDTO

Type: object

Schema: [DataService_ResponseStatsDTO](/api-reference/schemas/dataservice-responsestatsdto-984232426a.md)

- `survey_id` (required)
  Type: string

- `total_responses` (required)
  Type: integer

- `draft_count` (required)
  Type: integer

- `submitted_count` (required)
  Type: integer

- `completed_count` (required)
  Type: integer

- `invalidated_count` (required)
  Type: integer

- `completion_rate` (required)
  Type: number

- `average_duration_seconds` (required)
  Type: unknown
  
  anyOf:
    Type: number
  
    Type: null

- `date_from` (required)
  Type: string

- `date_to` (required)
  Type: string

## DataService_ResponseStatus

Type: string

Schema: [DataService_ResponseStatus](/api-reference/schemas/dataservice-responsestatus-e5ef0d2145.md)

enum: ["draft","submitted","completed","invalidated","pending_approval","approved","rejected","terminated"]

## DataService_ResponseValidationErrorDTO

Type: object

Schema: [DataService_ResponseValidationErrorDTO](/api-reference/schemas/dataservice-responsevalidationerrordto-bf8fbf8f8b.md)

- `error` (required)
  Type: string

- `validation_errors` (required)
  Type: array
  
  Items:
    Type: object
    
    Additional properties: true

## DataService_ReviewFlag

Type: object

Schema: [DataService_ReviewFlag](/api-reference/schemas/dataservice-reviewflag-00bddaec6b.md)

- `checked` (optional)
  Type: boolean
  
  default: false

- `note` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

## DataService_SimilarityMatch

Type: object

Schema: [DataService_SimilarityMatch](/api-reference/schemas/dataservice-similaritymatch-1257ee54f6.md)

- `response_id` (required)
  Type: string, uuid
  
  ID of the potentially duplicate response

- `confidence` (required)
  Type: number
  
  Confidence score (0-1)

- `criteria_breakdown` (required)
  Type: object
  
  Breakdown of scores per criterion
  
  Additional properties: 
    Type: number

- `response_details` (optional)
  Type: unknown
  
  Additional details about the matched response
  
  anyOf:
    Type: object
    
    Additional properties: true
  
    Type: null

## DataService_SimilaritySearchRequest

Type: object

Schema: [DataService_SimilaritySearchRequest](/api-reference/schemas/dataservice-similaritysearchrequest-6164e6359c.md)

- `survey_id` (required)
  Type: string
  
  Survey ID to search for duplicates in

- `respondent_id` (optional)
  Type: unknown
  
  Respondent ID to match
  
  anyOf:
    Type: string
  
    Type: null

- `respondent_fields` (optional)
  Type: unknown
  
  Other respondent fields for matching
  
  anyOf:
    Type: object
    
    Additional properties: true
  
    Type: null

- `gps_coordinates` (optional)
  Type: unknown
  
  GPS coordinates for proximity match
  
  anyOf:
    Type: object
    
    Additional properties: 
      Type: number
  
    Type: null

## DataService_SimilaritySearchResponse

Type: object

Schema: [DataService_SimilaritySearchResponse](/api-reference/schemas/dataservice-similaritysearchresponse-f509f4699d.md)

- `matches` (required)
  Type: array
  
  List of potential duplicates
  
  Items:
    Reference: [DataService_SimilarityMatch](/api-reference/schemas/dataservice-similaritymatch-1257ee54f6.md); Type: object

- `total` (required)
  Type: integer
  
  Total number of matches found

## DataService_SubmitResponseDTO

Type: object

Schema: [DataService_SubmitResponseDTO](/api-reference/schemas/dataservice-submitresponsedto-c283e9d365.md)

- `survey_id` (required)
  Type: string, uuid
  
  Survey ID

- `version_id` (optional)
  Type: unknown
  
  Survey version ID
  
  anyOf:
    Type: string, uuid
  
    Type: null

- `idempotency_key` (optional)
  Type: unknown
  
  Unique key for submission idempotency
  
  anyOf:
    Type: string
    
    maxLength: 255
  
    Type: null

- `respondent_id` (optional)
  Type: unknown
  
  Respondent identifier
  
  anyOf:
    Type: string
    
    maxLength: 255
  
    Type: null

- `answers` (required)
  Type: object
  
  Question ID to answer mapping
  
  Additional properties: true

- `metadata` (optional)
  Type: unknown
  
  Additional metadata (clients send this under the 'metadata' key)
  
  anyOf:
    Type: object
    
    Additional properties: true
  
    Type: null

- `ip_address` (optional)
  Type: unknown
  
  Client IP address
  
  anyOf:
    Type: string
    
    maxLength: 45
  
    Type: null

- `user_agent` (optional)
  Type: unknown
  
  Client user agent
  
  anyOf:
    Type: string
  
    Type: null

- `device_id` (optional)
  Type: unknown
  
  Device identifier (ODK Collect deviceID, CSPro device ID)
  
  anyOf:
    Type: string
    
    maxLength: 255
  
    Type: null

- `sync_batch_id` (optional)
  Type: unknown
  
  Batch ID for grouping offline sync submissions
  
  anyOf:
    Type: string, uuid
  
    Type: null

- `submission_mode` (optional)
  Type: unknown
  
  Domain-level intent: 'complete' or 'terminated_partial'
  
  default: "complete"
  
  anyOf:
    Type: string
  
    Type: null

- `duration_seconds` (optional)
  Type: unknown
  
  Active form filling duration in seconds, excluding paused time
  
  anyOf:
    Type: integer
    
    minimum: 0
    
    maximum: 2592000
  
    Type: null

- `interview_id` (optional)
  Type: unknown
  
  Interview execution ID — links this response to its interview lifecycle
  
  anyOf:
    Type: string, uuid
  
    Type: null

- `interview_rid` (optional)
  Type: unknown
  
  Response RID from interview (generated at interview creation, not at submission)
  
  anyOf:
    Type: string
    
    maxLength: 100
  
    Type: null

- `collected_at` (optional)
  Type: unknown
  
  Device-reported capture time (ISO-8601). Source of truth for the schedule window on offline submissions — a response collected on-device before close_at syncs even after the survey is auto-archived server-side.
  
  anyOf:
    Type: string, date-time
  
    Type: null

- `response_language` (optional)
  Type: unknown
  
  Language code used for this submission (e.g., 'en', 'es', 'fr')
  
  anyOf:
    Type: string
    
    maxLength: 10
  
    Type: null

- `is_reconciliation` (optional)
  Type: boolean
  
  Flag indicating this submission is a server-authorized reconciliation of work predating revocation (R22)
  
  default: false

- `reconciliation_grant_id` (optional)
  Type: unknown
  
  Historical form access grant ID authorizing this reconciliation
  
  anyOf:
    Type: string, uuid
  
    Type: null

## DataService_SurveyLatestSubmissionDTO

Type: object

Schema: [DataService_SurveyLatestSubmissionDTO](/api-reference/schemas/dataservice-surveylatestsubmissiondto-d34afcc8d1.md)

- `survey_id` (required)
  Type: string

- `latest_submitted_at` (required)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `latest_completed_at` (required)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

## DataService_TimeSeriesDTO

Type: object

Schema: [DataService_TimeSeriesDTO](/api-reference/schemas/dataservice-timeseriesdto-6c2dc9344e.md)

- `survey_id` (required)
  Type: string

- `granularity` (required)
  Type: string

- `data` (required)
  Type: array
  
  Items:
    Reference: [DataService_TimeSeriesPointDTO](/api-reference/schemas/dataservice-timeseriespointdto-ffb25995cd.md); Type: object

## DataService_TimeSeriesPointDTO

Type: object

Schema: [DataService_TimeSeriesPointDTO](/api-reference/schemas/dataservice-timeseriespointdto-ffb25995cd.md)

- `date` (required)
  Type: string

- `count` (required)
  Type: integer

## DataService_UpdateAttachmentDTO

Type: object

Schema: [DataService_UpdateAttachmentDTO](/api-reference/schemas/dataservice-updateattachmentdto-507e7c264d.md)

- `description` (optional)
  Type: unknown
  
  Updated notes/description
  
  anyOf:
    Type: string
  
    Type: null

- `field_name` (optional)
  Type: unknown
  
  Updated question field name
  
  anyOf:
    Type: string
  
    Type: null

## DataService_UpdateResponseDTO

Type: object

Schema: [DataService_UpdateResponseDTO](/api-reference/schemas/dataservice-updateresponsedto-e633777d14.md)

- `respondent_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string
    
    maxLength: 255
  
    Type: null

- `metadata` (optional)
  Type: unknown
  
  Additional metadata (clients send this under the 'metadata' key)
  
  anyOf:
    Type: object
    
    Additional properties: true
  
    Type: null

- `status` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

## DataService_UpdateReviewFlagsRequest

Type: object

Schema: [DataService_UpdateReviewFlagsRequest](/api-reference/schemas/dataservice-updatereviewflagsrequest-58d53f9cf3.md)

- `flags` (optional)
  Type: object
  
  Question ID to review flag mapping
  
  Additional properties: 
    Reference: [DataService_ReviewFlag](/api-reference/schemas/dataservice-reviewflag-00bddaec6b.md); Type: object

## DataService_ValidateIdsRequest

Type: object

Schema: [DataService_ValidateIdsRequest](/api-reference/schemas/dataservice-validateidsrequest-e80f9a9107.md)

- `response_ids` (required)
  Type: array
  
  maxItems: 1000
  
  Items:
    Type: string, uuid

## DataService_ValidateIdsResponse

Type: object

Schema: [DataService_ValidateIdsResponse](/api-reference/schemas/dataservice-validateidsresponse-6025aa50ee.md)

- `valid_ids` (required)
  Type: array
  
  Items:
    Type: string, uuid

## DataService_ValidationError

Type: object

Schema: [DataService_ValidationError](/api-reference/schemas/dataservice-validationerror-be7f37f547.md)

- `loc` (required)
  Type: array
  
  Items:
    Type: unknown
    
    anyOf:
      Type: string
    
      Type: integer

- `msg` (required)
  Type: string

- `type` (required)
  Type: string

- `input` (optional)
  Type: unknown

- `ctx` (optional)
  Type: object

## SyncService_BulkSyncPushRequestDTO

Type: object

Bulk push sync request.

Schema: [SyncService_BulkSyncPushRequestDTO](/api-reference/schemas/syncservice-bulksyncpushrequestdto-2e2a495459.md)

- `responses` (required)
  Type: array
  
  Max 50 responses per batch
  
  maxItems: 50
  
  Items:
    Reference: [SyncService_SyncPushRequestDTO](/api-reference/schemas/syncservice-syncpushrequestdto-7adf1d0ea0.md); Type: object
    
    Push sync request for single response.

## SyncService_BulkSyncPushResponseDTO

Type: object

Bulk push sync response.

Schema: [SyncService_BulkSyncPushResponseDTO](/api-reference/schemas/syncservice-bulksyncpushresponsedto-256c360ea3.md)

- `total` (required)
  Type: integer

- `accepted` (required)
  Type: integer

- `rejected` (required)
  Type: integer

- `results` (required)
  Type: array
  
  Items:
    Reference: [SyncService_SyncPushResponseDTO](/api-reference/schemas/syncservice-syncpushresponsedto-4f0c60b804.md); Type: object
    
    Push sync response.

## SyncService_ConflictDTO

Type: object

Sync conflict information.

Schema: [SyncService_ConflictDTO](/api-reference/schemas/syncservice-conflictdto-f94912064e.md)

- `id` (required)
  Type: string, uuid

- `tenant_id` (required)
  Type: string, uuid

- `device_id` (required)
  Type: string

- `response_id` (required)
  Type: string

- `conflict_type` (required)
  Type: string

- `server_version` (optional)
  Type: unknown
  
  anyOf:
    Type: object
    
    Additional properties: true
  
    Type: null

- `client_version` (optional)
  Type: unknown
  
  anyOf:
    Type: object
    
    Additional properties: true
  
    Type: null

- `resolution` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `resolved_at` (optional)
  Type: unknown
  
  anyOf:
    Type: string, date-time
  
    Type: null

- `resolved_by` (optional)
  Type: unknown
  
  anyOf:
    Type: string, uuid
  
    Type: null

- `created_at` (required)
  Type: string, date-time

## SyncService_ConflictListDTO

Type: object

List of sync conflicts.

Schema: [SyncService_ConflictListDTO](/api-reference/schemas/syncservice-conflictlistdto-20ab3ce8f0.md)

- `items` (required)
  Type: array
  
  Items:
    Reference: [SyncService_ConflictDTO](/api-reference/schemas/syncservice-conflictdto-f94912064e.md); Type: object
    
    Sync conflict information.

- `total` (required)
  Type: integer

- `skip` (optional)
  Type: integer
  
  default: 0

- `limit` (optional)
  Type: integer
  
  default: 100

- `has_next` (optional)
  Type: boolean
  
  default: false

- `has_previous` (optional)
  Type: boolean
  
  default: false

## SyncService_ConflictResolutionRequestDTO

Type: object

Request to resolve a sync conflict.

Schema: [SyncService_ConflictResolutionRequestDTO](/api-reference/schemas/syncservice-conflictresolutionrequestdto-bad7c04c2f.md)

- `strategy` (required)
  Type: string
  
  Resolution strategy: server_wins, client_wins, or manual

- `merged_data` (optional)
  Type: unknown
  
  Merged data if manual strategy is used
  
  anyOf:
    Type: object
    
    Additional properties: true
  
    Type: null

## SyncService_DeviceListDTO

Type: object

List of devices response.

Schema: [SyncService_DeviceListDTO](/api-reference/schemas/syncservice-devicelistdto-ccfb481d80.md)

- `items` (required)
  Type: array
  
  Items:
    Reference: [SyncService_DeviceResponseDTO](/api-reference/schemas/syncservice-deviceresponsedto-e133ad3447.md); Type: object
    
    Device response.

- `total` (required)
  Type: integer

- `skip` (optional)
  Type: integer
  
  default: 0

- `limit` (optional)
  Type: integer
  
  default: 100

- `has_next` (optional)
  Type: boolean
  
  default: false

- `has_previous` (optional)
  Type: boolean
  
  default: false

## SyncService_DeviceRegistrationDTO

Type: object

Device registration request.

Schema: [SyncService_DeviceRegistrationDTO](/api-reference/schemas/syncservice-deviceregistrationdto-e971e161c2.md)

- `device_id` (required)
  Type: string
  
  Unique device identifier
  
  minLength: 1
  
  maxLength: 255

- `platform` (required)
  Type: string
  
  Device platform (ios, android, web, desktop)

- `device_name` (optional)
  Type: unknown
  
  anyOf:
    Type: string
    
    maxLength: 255
  
    Type: null

- `device_model` (optional)
  Type: unknown
  
  anyOf:
    Type: string
    
    maxLength: 255
  
    Type: null

- `os_version` (optional)
  Type: unknown
  
  anyOf:
    Type: string
    
    maxLength: 50
  
    Type: null

- `app_version` (optional)
  Type: unknown
  
  anyOf:
    Type: string
    
    maxLength: 50
  
    Type: null

- `push_token` (optional)
  Type: unknown
  
  anyOf:
    Type: string
    
    maxLength: 500
  
    Type: null

## SyncService_DeviceResponseDTO

Type: object

Device response.

Schema: [SyncService_DeviceResponseDTO](/api-reference/schemas/syncservice-deviceresponsedto-e133ad3447.md)

- `id` (required)
  Type: string

- `device_id` (required)
  Type: string

- `platform` (required)
  Type: string

- `device_name` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `device_model` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `os_version` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `app_version` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `status` (required)
  Type: string

- `is_primary` (required)
  Type: boolean

- `last_active_at` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `created_at` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

## SyncService_DeviceUpdateDTO

Type: object

Device update request.

Schema: [SyncService_DeviceUpdateDTO](/api-reference/schemas/syncservice-deviceupdatedto-632de1793c.md)

- `device_name` (optional)
  Type: unknown
  
  anyOf:
    Type: string
    
    maxLength: 255
  
    Type: null

- `device_model` (optional)
  Type: unknown
  
  anyOf:
    Type: string
    
    maxLength: 255
  
    Type: null

- `os_version` (optional)
  Type: unknown
  
  anyOf:
    Type: string
    
    maxLength: 50
  
    Type: null

- `app_version` (optional)
  Type: unknown
  
  anyOf:
    Type: string
    
    maxLength: 50
  
    Type: null

- `push_token` (optional)
  Type: unknown
  
  anyOf:
    Type: string
    
    maxLength: 500
  
    Type: null

## SyncService_FailedSubmissionsDTO

Type: object

Schema: [SyncService_FailedSubmissionsDTO](/api-reference/schemas/syncservice-failedsubmissionsdto-896a4a5dd6.md)

- `count` (required)
  Type: integer

## SyncService_FormDownloadAcknowledgementDTO

Type: object

Client acknowledgement emitted only after a schema is persisted locally.

Schema: [SyncService_FormDownloadAcknowledgementDTO](/api-reference/schemas/syncservice-formdownloadacknowledgementdto-ad9119ecce.md)

- `survey_id` (required)
  Type: string, uuid

- `survey_version_id` (required)
  Type: string, uuid

- `survey_version` (required)
  Type: string
  
  minLength: 1
  
  maxLength: 100

- `survey_title` (optional)
  Type: unknown
  
  anyOf:
    Type: string
    
    maxLength: 500
  
    Type: null

- `schema_hash` (optional)
  Type: unknown
  
  anyOf:
    Type: string
    
    maxLength: 128
  
    Type: null

- `device_id` (required)
  Type: string
  
  minLength: 1
  
  maxLength: 255

- `download_id` (required)
  Type: string, uuid

- `platform` (optional)
  Type: unknown
  
  anyOf:
    Type: string
    
    maxLength: 50
  
    Type: null

- `app_version` (optional)
  Type: unknown
  
  anyOf:
    Type: string
    
    maxLength: 50
  
    Type: null

- `app_build` (optional)
  Type: unknown
  
  anyOf:
    Type: string
    
    maxLength: 50
  
    Type: null

- `os_version` (optional)
  Type: unknown
  
  anyOf:
    Type: string
    
    maxLength: 255
  
    Type: null

- `persisted_at` (optional)
  Type: unknown
  
  anyOf:
    Type: string, date-time
  
    Type: null

## SyncService_HTTPValidationError

Type: object

Schema: [SyncService_HTTPValidationError](/api-reference/schemas/syncservice-httpvalidationerror-37f685d848.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [SyncService_ValidationError](/api-reference/schemas/syncservice-validationerror-74e4de623a.md); Type: object

## SyncService_HealthResponseDTO

Type: object

Schema: [SyncService_HealthResponseDTO](/api-reference/schemas/syncservice-healthresponsedto-697d0eceb2.md)

- `status` (required)
  Type: string

- `service` (required)
  Type: string

- `version` (required)
  Type: string

- `timestamp` (required)
  Type: string, date-time

- `database` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

## SyncService_InitialSyncRequestDTO

Type: object

Initial sync request.

Schema: [SyncService_InitialSyncRequestDTO](/api-reference/schemas/syncservice-initialsyncrequestdto-46a37d29a1.md)

- `device_id` (required)
  Type: string
  
  minLength: 1
  
  maxLength: 255

- `platform` (optional)
  Type: unknown
  
  Device platform
  
  default: "unknown"
  
  anyOf:
    Type: string
  
    Type: null

## SyncService_PushTokenUpdateDTO

Type: object

Push token update request.

Schema: [SyncService_PushTokenUpdateDTO](/api-reference/schemas/syncservice-pushtokenupdatedto-43ffdcb755.md)

- `push_token` (required)
  Type: string
  
  minLength: 1
  
  maxLength: 500

## SyncService_ResponseAnswerDTO

Type: object

Response answer data.

Schema: [SyncService_ResponseAnswerDTO](/api-reference/schemas/syncservice-responseanswerdto-61c896b1aa.md)

- `question_id` (required)
  Type: string
  
  minLength: 1
  
  maxLength: 100

- `value` (optional)
  Type: unknown

## SyncService_RoleSyncDTO

Type: object

Role and permissions descriptor for sync pull response.

Schema: [SyncService_RoleSyncDTO](/api-reference/schemas/syncservice-rolesyncdto-f46d7e73d8.md)

- `id` (required)
  Type: string

- `name` (required)
  Type: string

- `permissions` (optional)
  Type: array
  
  Items:
    Type: string

## SyncService_SurveySyncDTO

Type: object

Survey sync data — a descriptor, not a content channel (D-11).

`schema_hash` is the **server's persisted content address** for this
version's canonical schema artifact: a 64-character lowercase SHA-256 over
the canonical UTF-8 JSON bytes. It is forwarded verbatim from survey-service
and is the value a client verifies against. It is nullable only because a
legacy version published before the integrity backfill may have none; a
client must treat a missing value as "cannot be verified", never as
"trust me".

`questions` and `settings` remain as a **legacy schema fragment**. They are
not a verifiable artifact (no digest covers them) and mobile ignores them;
they exist so an older client does not hard-fail on a schema shape it knows.
Content is fetched from the version's artifact endpoint, not from here.

Schema: [SyncService_SurveySyncDTO](/api-reference/schemas/syncservice-surveysyncdto-2daae3b3af.md)

- `survey_id` (required)
  Type: string

- `version_id` (required)
  Type: string

- `version` (required)
  Type: string

- `title` (required)
  Type: string

- `description` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `status` (required)
  Type: string

- `schema_hash` (optional)
  Type: unknown
  
  anyOf:
    Type: string
    
    maxLength: 128
  
    Type: null

- `is_deleted` (optional)
  Type: boolean
  
  default: false

- `has_lookups` (optional)
  Type: boolean
  
  default: false

- `questions` (optional)
  Type: array
  
  Items:
    Type: object
    
    Additional properties: true

- `settings` (optional)
  Type: unknown
  
  anyOf:
    Type: object
    
    Additional properties: true
  
    Type: null

## SyncService_SyncMetadataDTO

Type: object

Sync metadata response.

Schema: [SyncService_SyncMetadataDTO](/api-reference/schemas/syncservice-syncmetadatadto-dec4bd83a0.md)

- `surveys_modified` (required)
  Type: integer

- `surveys_deleted` (required)
  Type: integer

- `responses_modified` (required)
  Type: integer

- `responses_new` (required)
  Type: integer

- `server_timestamp` (required)
  Type: string

- `next_sync_token` (required)
  Type: string

## SyncService_SyncPullRequestDTO

Type: object

Pull sync request.

Schema: [SyncService_SyncPullRequestDTO](/api-reference/schemas/syncservice-syncpullrequestdto-a513103abd.md)

- `device_id` (required)
  Type: string
  
  Device identifier
  
  minLength: 1
  
  maxLength: 255

- `last_sync_token` (optional)
  Type: unknown
  
  Token from previous sync
  
  anyOf:
    Type: string
  
    Type: null

- `survey_version` (optional)
  Type: unknown
  
  Last known survey version (semver string)
  
  anyOf:
    Type: string
  
    Type: null

- `include_surveys` (optional)
  Type: boolean
  
  Include survey data
  
  default: true

- `include_metadata` (optional)
  Type: boolean
  
  Include sync metadata
  
  default: true

## SyncService_SyncPullResponseDTO

Type: object

Pull sync response.

Schema: [SyncService_SyncPullResponseDTO](/api-reference/schemas/syncservice-syncpullresponsedto-9180ff81cc.md)

- `sync_token` (required)
  Type: string

- `surveys` (required)
  Type: array
  
  Items:
    Reference: [SyncService_SurveySyncDTO](/api-reference/schemas/syncservice-surveysyncdto-2daae3b3af.md); Type: object
    
    Survey sync data — a descriptor, not a content channel (D-11).
    
    `schema_hash` is the **server's persisted content address** for this
    version's canonical schema artifact: a 64-character lowercase SHA-256 over
    the canonical UTF-8 JSON bytes. It is forwarded verbatim from survey-service
    and is the value a client verifies against. It is nullable only because a
    legacy version published before the integrity backfill may have none; a
    client must treat a missing value as "cannot be verified", never as
    "trust me".
    
    `questions` and `settings` remain as a **legacy schema fragment**. They are
    not a verifiable artifact (no digest covers them) and mobile ignores them;
    they exist so an older client does not hard-fail on a schema shape it knows.
    Content is fetched from the version's artifact endpoint, not from here.

- `metadata` (required)
  Reference: [SyncService_SyncMetadataDTO](/api-reference/schemas/syncservice-syncmetadatadto-dec4bd83a0.md); Type: object
  
  Sync metadata response.

- `server_timestamp` (required)
  Type: string

- `role` (optional)
  Type: unknown
  
  anyOf:
    Reference: [SyncService_RoleSyncDTO](/api-reference/schemas/syncservice-rolesyncdto-f46d7e73d8.md); Type: object
    
    Role and permissions descriptor for sync pull response.
  
    Type: null

## SyncService_SyncPushRequestDTO

Type: object

Push sync request for single response.

Schema: [SyncService_SyncPushRequestDTO](/api-reference/schemas/syncservice-syncpushrequestdto-7adf1d0ea0.md)

- `idempotency_key` (required)
  Type: string
  
  Unique key for idempotency
  
  minLength: 1
  
  maxLength: 255

- `survey_id` (required)
  Type: string, uuid
  
  Survey ID

- `survey_version_id` (optional)
  Type: unknown
  
  Survey version ID for version-pinned response
  
  anyOf:
    Type: string, uuid
  
    Type: null

- `interview_id` (optional)
  Type: unknown
  
  Interview execution ID — links this response to its interview lifecycle (Track A)
  
  anyOf:
    Type: string, uuid
  
    Type: null

- `interview_rid` (optional)
  Type: unknown
  
  Response RID allocated for interview
  
  anyOf:
    Type: string
    
    maxLength: 255
  
    Type: null

- `respondent_id` (optional)
  Type: unknown
  
  Respondent identifier
  
  anyOf:
    Type: string
    
    maxLength: 255
  
    Type: null

- `answers` (required)
  Type: array
  
  Survey answers
  
  Items:
    Reference: [SyncService_ResponseAnswerDTO](/api-reference/schemas/syncservice-responseanswerdto-61c896b1aa.md); Type: object
    
    Response answer data.

- `metadata` (optional)
  Type: unknown
  
  Additional metadata
  
  anyOf:
    Type: object
    
    Additional properties: true
  
    Type: null

- `device_id` (required)
  Type: string
  
  Device that collected the response
  
  minLength: 1
  
  maxLength: 255

- `collected_at` (optional)
  Type: unknown
  
  When response was collected on device
  
  anyOf:
    Type: string, date-time
  
    Type: null

- `response_language` (optional)
  Type: unknown
  
  Language code used for submission (e.g., 'en', 'es')
  
  anyOf:
    Type: string
    
    maxLength: 10
  
    Type: null

- `submission_mode` (optional)
  Type: unknown
  
  Submission mode: 'complete', 'terminated_partial', or 'draft'
  
  anyOf:
    Type: string
  
    Type: null

## SyncService_SyncPushResponseDTO

Type: object

Push sync response.

Schema: [SyncService_SyncPushResponseDTO](/api-reference/schemas/syncservice-syncpushresponsedto-4f0c60b804.md)

- `id` (required)
  Type: string

- `idempotency_key` (required)
  Type: string

- `status` (required)
  Type: string

- `response_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `created_at` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `lifecycle_code` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

## SyncService_SyncReconciliationRequestDTO

Type: object

Server-authorized reconciliation request for responses predating access revocation (R17 & R22).

Schema: [SyncService_SyncReconciliationRequestDTO](/api-reference/schemas/syncservice-syncreconciliationrequestdto-1c0ada8e5e.md)

- `intent` (required)
  Type: string
  
  Explicit intent: must be 'reconcile_revoked_work'

- `idempotency_key` (required)
  Type: string
  
  Unique key for idempotency
  
  minLength: 1
  
  maxLength: 255

- `survey_id` (required)
  Type: string, uuid
  
  Survey ID

- `survey_version_id` (optional)
  Type: unknown
  
  Survey version ID for version pinning
  
  anyOf:
    Type: string, uuid
  
    Type: null

- `device_id` (required)
  Type: string
  
  Device that collected the response
  
  minLength: 1
  
  maxLength: 255

- `collected_at` (required)
  Type: string, date-time
  
  Device-reported capture timestamp (mandatory for reconciliation)

- `answers` (required)
  Type: array
  
  Survey answers
  
  Items:
    Reference: [SyncService_ResponseAnswerDTO](/api-reference/schemas/syncservice-responseanswerdto-61c896b1aa.md); Type: object
    
    Response answer data.

- `respondent_id` (optional)
  Type: unknown
  
  Respondent identifier
  
  anyOf:
    Type: string
    
    maxLength: 255
  
    Type: null

- `interview_id` (optional)
  Type: unknown
  
  Interview execution ID
  
  anyOf:
    Type: string, uuid
  
    Type: null

- `interview_rid` (optional)
  Type: unknown
  
  Allocated RID
  
  anyOf:
    Type: string
    
    maxLength: 255
  
    Type: null

- `metadata` (optional)
  Type: unknown
  
  Additional metadata
  
  anyOf:
    Type: object
    
    Additional properties: true
  
    Type: null

- `response_language` (optional)
  Type: unknown
  
  Language code
  
  anyOf:
    Type: string
    
    maxLength: 10
  
    Type: null

- `submission_mode` (optional)
  Type: unknown
  
  Submission mode: 'complete' or 'terminated_partial'
  
  default: "complete"
  
  anyOf:
    Type: string
  
    Type: null

- `duration_seconds` (optional)
  Type: unknown
  
  Duration in seconds
  
  anyOf:
    Type: integer
    
    minimum: 0
  
    Type: null

- `sync_batch_id` (optional)
  Type: unknown
  
  Batch ID
  
  anyOf:
    Type: string, uuid
  
    Type: null

## SyncService_SyncReconciliationResponseDTO

Type: object

Server-authorized reconciliation response.

Schema: [SyncService_SyncReconciliationResponseDTO](/api-reference/schemas/syncservice-syncreconciliationresponsedto-207ca37ffc.md)

- `status` (required)
  Type: string
  
  'reconciled', 'duplicate', or 'rejected'

- `response_id` (optional)
  Type: unknown
  
  Persisted SurveyResponse ID in data-service
  
  anyOf:
    Type: string
  
    Type: null

- `reconciliation_grant_id` (optional)
  Type: unknown
  
  Historical grant UUID that authorized this work
  
  anyOf:
    Type: string
  
    Type: null

- `reconciled_at` (optional)
  Type: unknown
  
  ISO timestamp when reconciliation completed
  
  anyOf:
    Type: string
  
    Type: null

- `reason` (optional)
  Type: unknown
  
  Reason code if rejected (e.g. 'work_postdates_revocation', 'user_never_assigned')
  
  anyOf:
    Type: string
  
    Type: null

- `message` (required)
  Type: string
  
  Human-readable status summary

## SyncService_SyncStatusDTO

Type: object

Sync status response.

Schema: [SyncService_SyncStatusDTO](/api-reference/schemas/syncservice-syncstatusdto-ca2dadecbc.md)

- `device_id` (required)
  Type: string

- `last_sync_at` (optional)
  Type: unknown
  
  anyOf:
    Type: string, date-time
  
    Type: null

- `sync_status` (required)
  Type: string

- `last_survey_sync_at` (optional)
  Type: unknown
  
  anyOf:
    Type: string, date-time
  
    Type: null

- `last_response_sync_at` (optional)
  Type: unknown
  
  anyOf:
    Type: string, date-time
  
    Type: null

- `sync_token` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `surveys_synced` (optional)
  Type: integer
  
  default: 0

- `responses_synced` (optional)
  Type: integer
  
  default: 0

- `server_time` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `server_time_offset` (optional)
  Type: unknown
  
  default: 0
  
  anyOf:
    Type: integer
  
    Type: null

- `rid_blocks` (optional)
  Type: array
  
  Items:
    Type: object
    
    Additional properties: true

## SyncService_ValidationError

Type: object

Schema: [SyncService_ValidationError](/api-reference/schemas/syncservice-validationerror-74e4de623a.md)

- `loc` (required)
  Type: array
  
  Items:
    Type: unknown
    
    anyOf:
      Type: string
    
      Type: integer

- `msg` (required)
  Type: string

- `type` (required)
  Type: string

- `input` (optional)
  Type: unknown

- `ctx` (optional)
  Type: object

## AnalyticsService_AggregateDataPointDTO

Type: object

Single data point in aggregated results.

Schema: [AnalyticsService_AggregateDataPointDTO](/api-reference/schemas/analyticsservice-aggregatedatapointdto-30c0651c6d.md)

- `label` (required)
  Type: string

- `value` (required)
  Type: number

- `count` (optional)
  Type: unknown
  
  anyOf:
    Type: integer
  
    Type: null

- `extra` (optional)
  Type: unknown
  
  anyOf:
    Type: object
    
    Additional properties: true
  
    Type: null

## AnalyticsService_AggregateRequestDTO

Type: object

Request to aggregate survey response data for a chart panel.

Schema: [AnalyticsService_AggregateRequestDTO](/api-reference/schemas/analyticsservice-aggregaterequestdto-7d8b8a40a5.md)

- `survey_id` (required)
  Type: string

- `question_ids` (required)
  Type: array
  
  Items:
    Type: string

- `chart_type` (required)
  Type: string

- `aggregation` (required)
  Type: string

- `filters` (optional)
  Type: unknown
  
  anyOf:
    Type: object
    
    Additional properties: true
  
    Type: null

- `grouping` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `value_mode` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

## AnalyticsService_AggregateResponseDTO

Type: object

Aggregated chart data response.

Schema: [AnalyticsService_AggregateResponseDTO](/api-reference/schemas/analyticsservice-aggregateresponsedto-1f3e009075.md)

- `survey_id` (required)
  Type: string

- `question_ids` (required)
  Type: array
  
  Items:
    Type: string

- `chart_type` (required)
  Type: string

- `aggregation` (required)
  Type: string

- `data` (required)
  Type: array
  
  Items:
    Reference: [AnalyticsService_AggregateDataPointDTO](/api-reference/schemas/analyticsservice-aggregatedatapointdto-30c0651c6d.md); Type: object
    
    Single data point in aggregated results.

- `summary` (optional)
  Type: unknown
  
  anyOf:
    Type: object
    
    Additional properties: true
  
    Type: null

- `cached` (optional)
  Type: boolean
  
  default: false

- `generated_at` (required)
  Type: string, date-time

## AnalyticsService_AnalyticsResponseListDTO

Type: object

Paginated list of survey responses for analytics.

Schema: [AnalyticsService_AnalyticsResponseListDTO](/api-reference/schemas/analyticsservice-analyticsresponselistdto-ce7ca15f9c.md)

- `items` (required)
  Type: array
  
  Items:
    Type: object
    
    Additional properties: true

- `total` (required)
  Type: integer

- `skip` (required)
  Type: integer

- `limit` (required)
  Type: integer

- `has_next` (required)
  Type: boolean

- `has_previous` (required)
  Type: boolean

## AnalyticsService_AnalyticsSummaryDTO

Type: object

Analytics summary.

Schema: [AnalyticsService_AnalyticsSummaryDTO](/api-reference/schemas/analyticsservice-analyticssummarydto-ee32276bd2.md)

- `total_surveys` (required)
  Type: integer

- `total_responses` (required)
  Type: integer

- `active_surveys` (required)
  Type: integer

- `completion_rate_avg` (required)
  Type: number

- `period_start` (required)
  Type: string, date-time

- `period_end` (required)
  Type: string, date-time

## AnalyticsService_CreateDashboardDTO

Type: object

Create dashboard request.

Schema: [AnalyticsService_CreateDashboardDTO](/api-reference/schemas/analyticsservice-createdashboarddto-018b6dd91e.md)

- `title` (required)
  Type: string
  
  minLength: 1
  
  maxLength: 255

- `description` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `is_default` (optional)
  Type: boolean
  
  default: false

- `survey_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `dashboard_type` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `layout_config` (optional)
  Type: unknown
  
  anyOf:
    Type: object
    
    Additional properties: true
  
    Type: null

## AnalyticsService_CreateWidgetDTO

Type: object

Create widget request.

Schema: [AnalyticsService_CreateWidgetDTO](/api-reference/schemas/analyticsservice-createwidgetdto-a1a87edd85.md)

- `widget_type` (required)
  Type: string
  
  maxLength: 50

- `title` (required)
  Type: string
  
  minLength: 1
  
  maxLength: 255

- `chart_type` (required)
  Type: string
  
  maxLength: 50

- `data_source` (optional)
  Type: string
  
  default: "snapshot"
  
  maxLength: 50

- `query_config` (optional)
  Type: unknown
  
  anyOf:
    Type: object
    
    Additional properties: true
  
    Type: null

- `position_x` (optional)
  Type: integer
  
  default: 0

- `position_y` (optional)
  Type: integer
  
  default: 0

- `width` (optional)
  Type: integer
  
  default: 4

- `height` (optional)
  Type: integer
  
  default: 3

- `config` (optional)
  Type: unknown
  
  anyOf:
    Type: object
    
    Additional properties: true
  
    Type: null

- `filters` (optional)
  Type: unknown
  
  anyOf:
    Type: object
    
    Additional properties: true
  
    Type: null

- `refresh_interval` (optional)
  Type: integer
  
  default: 300

## AnalyticsService_DashboardListDTO

Type: object

Schema: [AnalyticsService_DashboardListDTO](/api-reference/schemas/analyticsservice-dashboardlistdto-55951fb19f.md)

- `items` (required)
  Type: array
  
  Items:
    Reference: [AnalyticsService_DashboardResponseDTO](/api-reference/schemas/analyticsservice-dashboardresponsedto-2b81aef221.md); Type: object
    
    Dashboard response.

- `total` (required)
  Type: integer

- `skip` (required)
  Type: integer

- `limit` (required)
  Type: integer

- `has_next` (required)
  Type: boolean

- `has_previous` (required)
  Type: boolean

## AnalyticsService_DashboardResponseDTO

Type: object

Dashboard response.

Schema: [AnalyticsService_DashboardResponseDTO](/api-reference/schemas/analyticsservice-dashboardresponsedto-2b81aef221.md)

- `id` (required)
  Type: string

- `title` (required)
  Type: string

- `description` (required)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `is_default` (required)
  Type: boolean

- `layout_config` (required)
  Type: unknown
  
  anyOf:
    Type: object
    
    Additional properties: true
  
    Type: null

- `created_by` (required)
  Type: string

- `created_at` (required)
  Type: string, date-time

- `updated_at` (required)
  Type: unknown
  
  anyOf:
    Type: string, date-time
  
    Type: null

- `widgets` (optional)
  Type: unknown
  
  anyOf:
    Type: array
    
    Items:
      Reference: [AnalyticsService_WidgetResponseDTO](/api-reference/schemas/analyticsservice-widgetresponsedto-2c5efd8617.md); Type: object
      
      Widget response.
  
    Type: null

- `survey_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `dashboard_type` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `is_user_modified` (optional)
  Type: unknown
  
  anyOf:
    Type: boolean
  
    Type: null

- `generated_by_system` (optional)
  Type: unknown
  
  anyOf:
    Type: boolean
  
    Type: null

- `source_survey_version` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `generator_version` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

## AnalyticsService_DashboardSummaryDTO

Type: object

Dashboard summary metrics.

Schema: [AnalyticsService_DashboardSummaryDTO](/api-reference/schemas/analyticsservice-dashboardsummarydto-50102923ed.md)

- `tenant_id` (required)
  Type: string

- `period_start` (required)
  Type: string, date-time

- `period_end` (required)
  Type: string, date-time

- `total_surveys` (required)
  Type: integer

- `active_surveys` (required)
  Type: integer

- `total_responses` (required)
  Type: integer

- `completion_rate_avg` (required)
  Type: number

- `average_response_time` (required)
  Type: unknown
  
  anyOf:
    Type: number
  
    Type: null

- `responses_trend` (required)
  Type: array
  
  Items:
    Type: object
    
    Additional properties: true

- `top_surveys` (required)
  Type: array
  
  Items:
    Type: object
    
    Additional properties: true

- `generated_at` (required)
  Type: string, date-time

## AnalyticsService_GenerateDashboardRequestDTO

Type: object

Request to generate a default dashboard for a survey.

Schema: [AnalyticsService_GenerateDashboardRequestDTO](/api-reference/schemas/analyticsservice-generatedashboardrequestdto-c331f9ce2f.md)

- `survey_id` (required)
  Type: string

## AnalyticsService_GenerateDashboardResponseDTO

Type: object

Response from dashboard generation.

Schema: [AnalyticsService_GenerateDashboardResponseDTO](/api-reference/schemas/analyticsservice-generatedashboardresponsedto-b154c93bb2.md)

- `dashboard_id` (required)
  Type: string

- `status` (required)
  Type: string

- `widget_count` (required)
  Type: integer

- `message` (required)
  Type: string

## AnalyticsService_HTTPValidationError

Type: object

Schema: [AnalyticsService_HTTPValidationError](/api-reference/schemas/analyticsservice-httpvalidationerror-f43c0b92b8.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [AnalyticsService_ValidationError](/api-reference/schemas/analyticsservice-validationerror-190b0412bc.md); Type: object

## AnalyticsService_ResponseMetricsDTO

Type: object

Response metrics for a date range.

Schema: [AnalyticsService_ResponseMetricsDTO](/api-reference/schemas/analyticsservice-responsemetricsdto-97442b3e66.md)

- `date` (required)
  Type: string

- `total_responses` (required)
  Type: integer

- `completed_responses` (required)
  Type: integer

- `completion_rate` (required)
  Type: number

- `average_duration_seconds` (required)
  Type: unknown
  
  anyOf:
    Type: number
  
    Type: null

## AnalyticsService_SurveyAnalyticsDTO

Type: object

Survey analytics.

Schema: [AnalyticsService_SurveyAnalyticsDTO](/api-reference/schemas/analyticsservice-surveyanalyticsdto-eaa15f0945.md)

- `survey_id` (required)
  Type: string

- `total_responses` (required)
  Type: integer

- `completion_rate` (required)
  Type: number

- `average_time` (required)
  Type: unknown
  
  anyOf:
    Type: number
  
    Type: null

- `questions_count` (required)
  Type: integer

- `responses_by_date` (required)
  Type: array
  
  Items:
    Type: object
    
    Additional properties: true

## AnalyticsService_SurveyPerformanceDTO

Type: object

Survey performance metrics.

Schema: [AnalyticsService_SurveyPerformanceDTO](/api-reference/schemas/analyticsservice-surveyperformancedto-8ee7c2d09d.md)

- `survey_id` (required)
  Type: string

- `survey_name` (required)
  Type: string

- `total_responses` (required)
  Type: integer

- `completion_rate` (required)
  Type: number

- `average_time_seconds` (required)
  Type: unknown
  
  anyOf:
    Type: number
  
    Type: null

- `trend` (required)
  Type: string

- `trend_percentage` (required)
  Type: number

## AnalyticsService_UpdateDashboardDTO

Type: object

Update dashboard request.

Schema: [AnalyticsService_UpdateDashboardDTO](/api-reference/schemas/analyticsservice-updatedashboarddto-c21889ac74.md)

- `title` (optional)
  Type: unknown
  
  anyOf:
    Type: string
    
    minLength: 1
    
    maxLength: 255
  
    Type: null

- `description` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `is_default` (optional)
  Type: unknown
  
  anyOf:
    Type: boolean
  
    Type: null

- `layout_config` (optional)
  Type: unknown
  
  anyOf:
    Type: object
    
    Additional properties: true
  
    Type: null

- `is_user_modified` (optional)
  Type: unknown
  
  anyOf:
    Type: boolean
  
    Type: null

## AnalyticsService_UpdateWidgetDTO

Type: object

Update widget request.

Schema: [AnalyticsService_UpdateWidgetDTO](/api-reference/schemas/analyticsservice-updatewidgetdto-cdf10a9b61.md)

- `title` (optional)
  Type: unknown
  
  anyOf:
    Type: string
    
    minLength: 1
    
    maxLength: 255
  
    Type: null

- `chart_type` (optional)
  Type: unknown
  
  anyOf:
    Type: string
    
    maxLength: 50
  
    Type: null

- `data_source` (optional)
  Type: unknown
  
  anyOf:
    Type: string
    
    maxLength: 50
  
    Type: null

- `query_config` (optional)
  Type: unknown
  
  anyOf:
    Type: object
    
    Additional properties: true
  
    Type: null

- `position_x` (optional)
  Type: unknown
  
  anyOf:
    Type: integer
  
    Type: null

- `position_y` (optional)
  Type: unknown
  
  anyOf:
    Type: integer
  
    Type: null

- `width` (optional)
  Type: unknown
  
  anyOf:
    Type: integer
  
    Type: null

- `height` (optional)
  Type: unknown
  
  anyOf:
    Type: integer
  
    Type: null

- `config` (optional)
  Type: unknown
  
  anyOf:
    Type: object
    
    Additional properties: true
  
    Type: null

- `filters` (optional)
  Type: unknown
  
  anyOf:
    Type: object
    
    Additional properties: true
  
    Type: null

- `refresh_interval` (optional)
  Type: unknown
  
  anyOf:
    Type: integer
  
    Type: null

## AnalyticsService_ValidationError

Type: object

Schema: [AnalyticsService_ValidationError](/api-reference/schemas/analyticsservice-validationerror-190b0412bc.md)

- `loc` (required)
  Type: array
  
  Items:
    Type: unknown
    
    anyOf:
      Type: string
    
      Type: integer

- `msg` (required)
  Type: string

- `type` (required)
  Type: string

- `input` (optional)
  Type: unknown

- `ctx` (optional)
  Type: object

## AnalyticsService_WidgetDataDTO

Type: object

Widget data response.

Schema: [AnalyticsService_WidgetDataDTO](/api-reference/schemas/analyticsservice-widgetdatadto-751ea0fa5f.md)

- `widget_id` (required)
  Type: string

- `data_source` (required)
  Type: string

- `data` (required)
  Type: unknown

- `cached` (optional)
  Type: boolean
  
  default: false

- `generated_at` (required)
  Type: string, date-time

## AnalyticsService_WidgetResponseDTO

Type: object

Widget response.

Schema: [AnalyticsService_WidgetResponseDTO](/api-reference/schemas/analyticsservice-widgetresponsedto-2c5efd8617.md)

- `id` (required)
  Type: string

- `dashboard_id` (required)
  Type: string

- `widget_type` (required)
  Type: string

- `title` (required)
  Type: string

- `title_key` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `chart_type` (required)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `data_source` (required)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `query_config` (required)
  Type: unknown
  
  anyOf:
    Type: object
    
    Additional properties: true
  
    Type: null

- `position_x` (required)
  Type: integer

- `position_y` (required)
  Type: integer

- `width` (required)
  Type: integer

- `height` (required)
  Type: integer

- `config` (required)
  Type: unknown
  
  anyOf:
    Type: object
    
    Additional properties: true
  
    Type: null

- `filters` (required)
  Type: unknown
  
  anyOf:
    Type: object
    
    Additional properties: true
  
    Type: null

- `refresh_interval` (required)
  Type: integer

- `created_at` (required)
  Type: string, date-time

- `updated_at` (required)
  Type: unknown
  
  anyOf:
    Type: string, date-time
  
    Type: null

## WorkspaceService_HTTPValidationError

Type: object

Schema: [WorkspaceService_HTTPValidationError](/api-reference/schemas/workspaceservice-httpvalidationerror-92a261e7a3.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [WorkspaceService_ValidationError](/api-reference/schemas/workspaceservice-validationerror-9662acef93.md); Type: object

## WorkspaceService_HealthResponseDTO

Type: object

Schema: [WorkspaceService_HealthResponseDTO](/api-reference/schemas/workspaceservice-healthresponsedto-c0e9b591bf.md)

- `status` (required)
  Type: string

- `service` (required)
  Type: string

- `version` (required)
  Type: string

- `timestamp` (required)
  Type: string, date-time

## WorkspaceService_MemberAddDTO

Type: object

Schema: [WorkspaceService_MemberAddDTO](/api-reference/schemas/workspaceservice-memberadddto-46f3ade998.md)

- `user_id` (required)
  Type: string

- `role` (optional)
  Reference: [WorkspaceService_WorkspaceMemberRole](/api-reference/schemas/workspaceservice-workspacememberrole-c3d06b523e.md); Type: string
  
  default: "viewer"
  
  enum: ["owner","admin","editor","viewer","responder"]

## WorkspaceService_MemberListDTO

Type: object

Schema: [WorkspaceService_MemberListDTO](/api-reference/schemas/workspaceservice-memberlistdto-fe1eb49881.md)

- `items` (required)
  Type: array
  
  Items:
    Reference: [WorkspaceService_MemberResponseDTO](/api-reference/schemas/workspaceservice-memberresponsedto-e53a9b7ac0.md); Type: object

- `total` (required)
  Type: integer

- `skip` (required)
  Type: integer

- `limit` (required)
  Type: integer

- `has_next` (required)
  Type: boolean

- `has_previous` (required)
  Type: boolean

## WorkspaceService_MemberResponseDTO

Type: object

Schema: [WorkspaceService_MemberResponseDTO](/api-reference/schemas/workspaceservice-memberresponsedto-e53a9b7ac0.md)

- `id` (required)
  Type: string, uuid

- `workspace_id` (required)
  Type: string, uuid

- `user_id` (required)
  Type: string, uuid

- `tenant_id` (required)
  Type: string, uuid

- `role` (required)
  Type: string

- `invited_by` (required)
  Type: unknown
  
  anyOf:
    Type: string, uuid
  
    Type: null

- `joined_at` (required)
  Type: string, date-time

- `created_at` (required)
  Type: string, date-time

- `updated_at` (required)
  Type: string, date-time

- `user_email` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `user_name` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

## WorkspaceService_MemberUpdateDTO

Type: object

Schema: [WorkspaceService_MemberUpdateDTO](/api-reference/schemas/workspaceservice-memberupdatedto-f0ab1bb005.md)

- `role` (required)
  Reference: [WorkspaceService_WorkspaceMemberRole](/api-reference/schemas/workspaceservice-workspacememberrole-c3d06b523e.md); Type: string
  
  enum: ["owner","admin","editor","viewer","responder"]

## WorkspaceService_ProjectCreateDTO

Type: object

Schema: [WorkspaceService_ProjectCreateDTO](/api-reference/schemas/workspaceservice-projectcreatedto-e7bed61243.md)

- `name` (required)
  Type: string
  
  minLength: 1
  
  maxLength: 255

- `description` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

## WorkspaceService_ProjectListDTO

Type: object

Schema: [WorkspaceService_ProjectListDTO](/api-reference/schemas/workspaceservice-projectlistdto-a0f0daa6c6.md)

- `items` (required)
  Type: array
  
  Items:
    Reference: [WorkspaceService_ProjectResponseDTO](/api-reference/schemas/workspaceservice-projectresponsedto-4a7146f3a1.md); Type: object

- `total` (required)
  Type: integer

- `skip` (required)
  Type: integer

- `limit` (required)
  Type: integer

- `has_next` (required)
  Type: boolean

- `has_previous` (required)
  Type: boolean

## WorkspaceService_ProjectResponseDTO

Type: object

Schema: [WorkspaceService_ProjectResponseDTO](/api-reference/schemas/workspaceservice-projectresponsedto-4a7146f3a1.md)

- `id` (required)
  Type: string, uuid

- `workspace_id` (required)
  Type: string, uuid

- `tenant_id` (required)
  Type: string, uuid

- `name` (required)
  Type: string

- `description` (required)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `status` (required)
  Type: string

- `has_production_activity` (optional)
  Type: boolean
  
  default: false

- `production_activity_at` (optional)
  Type: unknown
  
  anyOf:
    Type: string, date-time
  
    Type: null

- `created_at` (required)
  Type: string, date-time

- `updated_at` (required)
  Type: string, date-time

- `created_by` (required)
  Type: string, uuid

## WorkspaceService_ProjectStatus

Type: string

Schema: [WorkspaceService_ProjectStatus](/api-reference/schemas/workspaceservice-projectstatus-d27a31ff2e.md)

enum: ["draft","active","completed","archived","deleted"]

## WorkspaceService_ProjectUpdateDTO

Type: object

Schema: [WorkspaceService_ProjectUpdateDTO](/api-reference/schemas/workspaceservice-projectupdatedto-f68dedb1d5.md)

- `name` (optional)
  Type: unknown
  
  anyOf:
    Type: string
    
    minLength: 1
    
    maxLength: 255
  
    Type: null

- `description` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `status` (optional)
  Type: unknown
  
  anyOf:
    Reference: [WorkspaceService_ProjectStatus](/api-reference/schemas/workspaceservice-projectstatus-d27a31ff2e.md); Type: string
    
    enum: ["draft","active","completed","archived","deleted"]
  
    Type: null

## WorkspaceService_ValidationError

Type: object

Schema: [WorkspaceService_ValidationError](/api-reference/schemas/workspaceservice-validationerror-9662acef93.md)

- `loc` (required)
  Type: array
  
  Items:
    Type: unknown
    
    anyOf:
      Type: string
    
      Type: integer

- `msg` (required)
  Type: string

- `type` (required)
  Type: string

- `input` (optional)
  Type: unknown

- `ctx` (optional)
  Type: object

## WorkspaceService_WorkspaceCreateDTO

Type: object

Schema: [WorkspaceService_WorkspaceCreateDTO](/api-reference/schemas/workspaceservice-workspacecreatedto-a1f26cbaf5.md)

- `name` (required)
  Type: string
  
  minLength: 1
  
  maxLength: 255

- `description` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

## WorkspaceService_WorkspaceListDTO

Type: object

Schema: [WorkspaceService_WorkspaceListDTO](/api-reference/schemas/workspaceservice-workspacelistdto-f350822239.md)

- `items` (required)
  Type: array
  
  Items:
    Reference: [WorkspaceService_WorkspaceResponseDTO](/api-reference/schemas/workspaceservice-workspaceresponsedto-4de4578a77.md); Type: object

- `total` (required)
  Type: integer

- `skip` (required)
  Type: integer

- `limit` (required)
  Type: integer

- `has_next` (required)
  Type: boolean

- `has_previous` (required)
  Type: boolean

## WorkspaceService_WorkspaceMemberRole

Type: string

Schema: [WorkspaceService_WorkspaceMemberRole](/api-reference/schemas/workspaceservice-workspacememberrole-c3d06b523e.md)

enum: ["owner","admin","editor","viewer","responder"]

## WorkspaceService_WorkspaceResponseDTO

Type: object

Schema: [WorkspaceService_WorkspaceResponseDTO](/api-reference/schemas/workspaceservice-workspaceresponsedto-4de4578a77.md)

- `id` (required)
  Type: string, uuid

- `tenant_id` (required)
  Type: string, uuid

- `name` (required)
  Type: string

- `description` (required)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `status` (required)
  Type: string

- `created_at` (required)
  Type: string, date-time

- `updated_at` (required)
  Type: string, date-time

- `created_by` (required)
  Type: string, uuid

## WorkspaceService_WorkspaceStatus

Type: string

Schema: [WorkspaceService_WorkspaceStatus](/api-reference/schemas/workspaceservice-workspacestatus-652b9c3598.md)

enum: ["active","archived","suspended","deleted"]

## WorkspaceService_WorkspaceUpdateDTO

Type: object

Schema: [WorkspaceService_WorkspaceUpdateDTO](/api-reference/schemas/workspaceservice-workspaceupdatedto-67c3d9a327.md)

- `name` (optional)
  Type: unknown
  
  anyOf:
    Type: string
    
    minLength: 1
    
    maxLength: 255
  
    Type: null

- `description` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `status` (optional)
  Type: unknown
  
  anyOf:
    Reference: [WorkspaceService_WorkspaceStatus](/api-reference/schemas/workspaceservice-workspacestatus-652b9c3598.md); Type: string
    
    enum: ["active","archived","suspended","deleted"]
  
    Type: null

## WebhookService_CreateSubscriptionDTO

Type: object

DTO for creating a webhook subscription.

Schema: [WebhookService_CreateSubscriptionDTO](/api-reference/schemas/webhookservice-createsubscriptiondto-5be2bbdf3a.md)

- `name` (required)
  Type: string
  
  minLength: 1
  
  maxLength: 255

- `url` (required)
  Type: string
  
  maxLength: 2048

- `event_types` (required)
  Type: array
  
  minItems: 1
  
  Items:
    Type: string

- `survey_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `project_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `workspace_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `secret` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

## WebhookService_DeliveryListDTO

Type: object

DTO for list of webhook deliveries.

Schema: [WebhookService_DeliveryListDTO](/api-reference/schemas/webhookservice-deliverylistdto-0b5fb8ee1b.md)

- `items` (required)
  Type: array
  
  Items:
    Reference: [WebhookService_DeliveryResponseDTO](/api-reference/schemas/webhookservice-deliveryresponsedto-6b960b3b2e.md); Type: object
    
    DTO for webhook delivery response.

- `total` (required)
  Type: integer

- `skip` (required)
  Type: integer

- `limit` (required)
  Type: integer

- `has_next` (required)
  Type: boolean

- `has_previous` (required)
  Type: boolean

## WebhookService_DeliveryResponseDTO

Type: object

DTO for webhook delivery response.

Schema: [WebhookService_DeliveryResponseDTO](/api-reference/schemas/webhookservice-deliveryresponsedto-6b960b3b2e.md)

- `id` (required)
  Type: string

- `subscription_id` (required)
  Type: string

- `event_id` (required)
  Type: string

- `event_type` (required)
  Type: string

- `status` (required)
  Type: string

- `http_status` (required)
  Type: unknown
  
  anyOf:
    Type: integer
  
    Type: null

- `retry_count` (required)
  Type: integer

- `attempted_at` (required)
  Type: unknown
  
  anyOf:
    Type: string, date-time
  
    Type: null

- `delivered_at` (required)
  Type: unknown
  
  anyOf:
    Type: string, date-time
  
    Type: null

- `error_message` (required)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `created_at` (required)
  Type: string, date-time

## WebhookService_HTTPValidationError

Type: object

Schema: [WebhookService_HTTPValidationError](/api-reference/schemas/webhookservice-httpvalidationerror-119a4c7db4.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [WebhookService_ValidationError](/api-reference/schemas/webhookservice-validationerror-f46d3ea8f8.md); Type: object

## WebhookService_SubscriptionListDTO

Type: object

DTO for list of webhook subscriptions.

Schema: [WebhookService_SubscriptionListDTO](/api-reference/schemas/webhookservice-subscriptionlistdto-96134a4012.md)

- `items` (required)
  Type: array
  
  Items:
    Reference: [WebhookService_SubscriptionResponseDTO](/api-reference/schemas/webhookservice-subscriptionresponsedto-ad3230cd18.md); Type: object
    
    DTO for webhook subscription response.

- `total` (required)
  Type: integer

- `skip` (required)
  Type: integer

- `limit` (required)
  Type: integer

- `has_next` (required)
  Type: boolean

- `has_previous` (required)
  Type: boolean

## WebhookService_SubscriptionResponseDTO

Type: object

DTO for webhook subscription response.

Schema: [WebhookService_SubscriptionResponseDTO](/api-reference/schemas/webhookservice-subscriptionresponsedto-ad3230cd18.md)

- `id` (required)
  Type: string

- `name` (required)
  Type: string

- `url` (required)
  Type: string

- `event_types` (required)
  Type: array
  
  Items:
    Type: string

- `survey_id` (required)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `project_id` (required)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `workspace_id` (required)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `is_active` (required)
  Type: boolean

- `created_at` (required)
  Type: string, date-time

- `updated_at` (required)
  Type: string, date-time

## WebhookService_UpdateSubscriptionDTO

Type: object

DTO for updating a webhook subscription.

Schema: [WebhookService_UpdateSubscriptionDTO](/api-reference/schemas/webhookservice-updatesubscriptiondto-65db636053.md)

- `name` (optional)
  Type: unknown
  
  anyOf:
    Type: string
    
    maxLength: 255
  
    Type: null

- `url` (optional)
  Type: unknown
  
  anyOf:
    Type: string
    
    maxLength: 2048
  
    Type: null

- `event_types` (optional)
  Type: unknown
  
  anyOf:
    Type: array
    
    Items:
      Type: string
  
    Type: null

- `is_active` (optional)
  Type: unknown
  
  anyOf:
    Type: boolean
  
    Type: null

## WebhookService_ValidationError

Type: object

Schema: [WebhookService_ValidationError](/api-reference/schemas/webhookservice-validationerror-f46d3ea8f8.md)

- `loc` (required)
  Type: array
  
  Items:
    Type: unknown
    
    anyOf:
      Type: string
    
      Type: integer

- `msg` (required)
  Type: string

- `type` (required)
  Type: string

- `input` (optional)
  Type: unknown

- `ctx` (optional)
  Type: object

## OdkBridge_Body_submit_form_submission_post

Type: object

Schema: [OdkBridge_Body_submit_form_submission_post](/api-reference/schemas/odkbridge-body-submit-form-submission-post-dde00f2180.md)

- `xml_submission_file` (required)
  Type: string

- `attachments` (optional)
  Type: array
  
  default: []
  
  Items:
    Type: string

## OdkBridge_HTTPValidationError

Type: object

Schema: [OdkBridge_HTTPValidationError](/api-reference/schemas/odkbridge-httpvalidationerror-4a5630f462.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [OdkBridge_ValidationError](/api-reference/schemas/odkbridge-validationerror-b831ec1b45.md); Type: object

## OdkBridge_ValidationError

Type: object

Schema: [OdkBridge_ValidationError](/api-reference/schemas/odkbridge-validationerror-b831ec1b45.md)

- `loc` (required)
  Type: array
  
  Items:
    Type: unknown
    
    anyOf:
      Type: string
    
      Type: integer

- `msg` (required)
  Type: string

- `type` (required)
  Type: string

- `input` (optional)
  Type: unknown

- `ctx` (optional)
  Type: object

## FormService_BatchNoteCreateDto

Type: object

Schema: [FormService_BatchNoteCreateDto](/api-reference/schemas/formservice-batchnotecreatedto-4f9402d4a9.md)

- `notes` (required)
  Type: array
  
  Items:
    Reference: [FormService_NoteCreateDto](/api-reference/schemas/formservice-notecreatedto-1d46b029fa.md); Type: object

## FormService_CreateInterviewDto

Type: object

Schema: [FormService_CreateInterviewDto](/api-reference/schemas/formservice-createinterviewdto-1a4f776587.md)

- `survey_id` (required)
  Type: string, uuid

- `respondent_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string, uuid
  
    Type: null

- `session_token` (required)
  Type: string

- `total_questions` (optional)
  Type: integer
  
  default: 0

- `language` (optional)
  Type: unknown
  
  Active language code during interview (e.g., 'en', 'es', 'hi')
  
  anyOf:
    Type: string
    
    maxLength: 10
  
    Type: null

- `interview_metadata` (optional)
  Type: object
  
  default: {}
  
  Additional properties: true

- `survey_name` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `response_rid` (optional)
  Type: unknown
  
  DEPRECATED. The server allocates the permanent RID at interview creation. This field is ignored for NEW interviews and only used as a last-resort backfill for legacy interviews created before server-side allocation.
  
  anyOf:
    Type: string
  
    Type: null

## FormService_DraftConflictResponse

Type: object

Response returned upon an optimistic concurrency conflict (HTTP 409).

Schema: [FormService_DraftConflictResponse](/api-reference/schemas/formservice-draftconflictresponse-f49b85967c.md)

- `error` (optional)
  Type: string
  
  default: "DRAFT_CONFLICT"

- `message` (required)
  Type: string

- `draft_id` (required)
  Type: string, uuid

- `server_version_token` (required)
  Type: integer

- `client_version_token` (optional)
  Type: unknown
  
  anyOf:
    Type: integer
  
    Type: null

- `server_content_hash` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `client_content_hash` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `server_device_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `server_updated_at` (required)
  Type: string

- `server_draft_data` (required)
  Type: object
  
  Additional properties: true

## FormService_DraftCreateRequest

Type: object

Request to create a new draft.

Schema: [FormService_DraftCreateRequest](/api-reference/schemas/formservice-draftcreaterequest-2050464672.md)

- `id` (optional)
  Type: unknown
  
  anyOf:
    Type: string, uuid
  
    Type: null

- `survey_id` (required)
  Type: string, uuid

- `session_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string, uuid
  
    Type: null

- `name` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `draft_data` (optional)
  Type: object
  
  Additional properties: true

- `current_page` (optional)
  Type: integer
  
  default: 0

- `survey_version_id` (optional)
  Type: unknown
  
  Pinned immutable survey schema version ID
  
  anyOf:
    Type: string, uuid
  
    Type: null

- `device_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `content_hash` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `idempotency_key` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

## FormService_DraftDeltaResponse

Type: object

Response containing delta sync drafts since cursor.

Schema: [FormService_DraftDeltaResponse](/api-reference/schemas/formservice-draftdeltaresponse-f5752cb6b2.md)

- `items` (required)
  Type: array
  
  Items:
    Reference: [FormService_DraftResponse](/api-reference/schemas/formservice-draftresponse-11a8f6ea0f.md); Type: object
    
    Response containing draft information.

- `server_timestamp` (required)
  Type: string

- `total` (required)
  Type: integer

- `has_next` (required)
  Type: boolean

- `next_cursor` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

## FormService_DraftDrainRevokedRequest

Type: object

Request to drain an offline draft whose user's assignment was revoked.

Schema: [FormService_DraftDrainRevokedRequest](/api-reference/schemas/formservice-draftdrainrevokedrequest-57a2cef442.md)

- `id` (required)
  Type: string, uuid
  
  Unique draft identifier

- `survey_id` (required)
  Type: string, uuid
  
  Survey identifier

- `survey_version_id` (optional)
  Type: unknown
  
  Pinned survey schema version ID
  
  anyOf:
    Type: string, uuid
  
    Type: null

- `name` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `draft_data` (optional)
  Type: object
  
  Answers captured in draft
  
  Additional properties: true

- `current_page` (optional)
  Type: integer
  
  default: 0

- `device_id` (required)
  Type: string
  
  Attribution device ID (must not be placeholder)

- `version_token` (optional)
  Type: integer
  
  Client version token
  
  default: 1
  
  minimum: 1

- `content_hash` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `idempotency_key` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `reconciliation_grant_id` (optional)
  Type: unknown
  
  Reconciliation grant ID
  
  anyOf:
    Type: string, uuid
  
    Type: null

- `lastModifiedAt` (required)
  Type: string, date-time
  
  Timestamp of the last offline edit to the draft

- `reconciliation_reason` (optional)
  Type: unknown
  
  Optional domain note or reason
  
  anyOf:
    Type: string
  
    Type: null

## FormService_DraftListResponse

Type: object

Response containing list of drafts.

Schema: [FormService_DraftListResponse](/api-reference/schemas/formservice-draftlistresponse-4e547f5e89.md)

- `items` (required)
  Type: array
  
  Items:
    Reference: [FormService_DraftResponse](/api-reference/schemas/formservice-draftresponse-11a8f6ea0f.md); Type: object
    
    Response containing draft information.

- `total` (required)
  Type: integer

- `skip` (optional)
  Type: integer
  
  default: 0

- `limit` (optional)
  Type: integer
  
  default: 20

- `has_next` (required)
  Type: boolean

- `has_previous` (required)
  Type: boolean

## FormService_DraftResponse

Type: object

Response containing draft information.

Schema: [FormService_DraftResponse](/api-reference/schemas/formservice-draftresponse-11a8f6ea0f.md)

- `id` (required)
  Type: string, uuid

- `tenant_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string, uuid
  
    Type: null

- `user_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string, uuid
  
    Type: null

- `device_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `survey_id` (required)
  Type: string, uuid

- `session_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string, uuid
  
    Type: null

- `survey_version_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string, uuid
  
    Type: null

- `name` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `draft_data` (required)
  Type: object
  
  Additional properties: true

- `current_page` (required)
  Type: integer

- `completed_fields_count` (required)
  Type: integer

- `total_fields_count` (optional)
  Type: unknown
  
  anyOf:
    Type: integer
  
    Type: null

- `completion_percentage` (required)
  Type: integer

- `status` (required)
  Type: string

- `version_token` (optional)
  Type: integer
  
  default: 1

- `content_hash` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `idempotency_key` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `is_deleted` (optional)
  Type: boolean
  
  default: false

- `deleted_at` (optional)
  Type: unknown
  
  anyOf:
    Type: string, date-time
  
    Type: null

- `validation_errors` (optional)
  Type: array
  
  default: []
  
  Items:
    Type: object
    
    Additional properties: true

- `is_auto_saved` (optional)
  Type: boolean
  
  default: false

- `reconciliation_grant_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string, uuid
  
    Type: null

- `reconciled_at` (optional)
  Type: unknown
  
  anyOf:
    Type: string, date-time
  
    Type: null

- `created_at` (required)
  Type: string, date-time

- `updated_at` (required)
  Type: string, date-time

- `expires_at` (optional)
  Type: unknown
  
  anyOf:
    Type: string, date-time
  
    Type: null

## FormService_DraftUpdateRequest

Type: object

Request to update an existing draft.

Schema: [FormService_DraftUpdateRequest](/api-reference/schemas/formservice-draftupdaterequest-fea029a037.md)

- `draft_data` (optional)
  Type: unknown
  
  anyOf:
    Type: object
    
    Additional properties: true
  
    Type: null

- `name` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `current_page` (optional)
  Type: unknown
  
  anyOf:
    Type: integer
  
    Type: null

- `is_auto_save` (optional)
  Type: boolean
  
  default: false

- `version_token` (optional)
  Type: integer
  
  Expected current server version token
  
  default: 1
  
  minimum: 1

- `device_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `content_hash` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `idempotency_key` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

## FormService_EvaluateExpressionRequest

Type: object

Request to evaluate an XPath expression.

Schema: [FormService_EvaluateExpressionRequest](/api-reference/schemas/formservice-evaluateexpressionrequest-35ddfa78e2.md)

- `session_token` (required)
  Type: string
  
  Form session token

- `expression` (required)
  Type: string
  
  XPath expression to evaluate

- `form_data` (optional)
  Type: object
  
  Form data for variable resolution
  
  Additional properties: true

## FormService_EvaluateExpressionResponse

Type: object

Response for expression evaluation.

Schema: [FormService_EvaluateExpressionResponse](/api-reference/schemas/formservice-evaluateexpressionresponse-61ee13f101.md)

- `success` (required)
  Type: boolean

- `result` (optional)
  Type: unknown

- `error` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

## FormService_FormManifestResponse

Type: object

Response for offline form manifest.

Schema: [FormService_FormManifestResponse](/api-reference/schemas/formservice-formmanifestresponse-e9f3bc0837.md)

- `survey_id` (required)
  Type: string, uuid

- `version_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string, uuid
  
    Type: null

- `manifest_version` (required)
  Type: string

- `form_files` (required)
  Type: array
  
  Items:
    Type: object
    
    Additional properties: 
      Type: string

- `media_files` (required)
  Type: array
  
  Items:
    Type: object
    
    Additional properties: 
      Type: string

- `last_updated` (required)
  Type: string, date-time

## FormService_FormRenderResponse

Type: object

Response containing rendered form data.

Schema: [FormService_FormRenderResponse](/api-reference/schemas/formservice-formrenderresponse-6f753a5814.md)

- `session_id` (required)
  Type: string, uuid

- `session_token` (required)
  Type: string

- `survey_id` (required)
  Type: string, uuid

- `survey_version_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string, uuid
  
    Type: null

- `form_schema` (required)
  Type: object
  
  Additional properties: true

- `form_html` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `prefill_data` (optional)
  Type: unknown
  
  anyOf:
    Type: object
    
    Additional properties: true
  
    Type: null

- `total_pages` (required)
  Type: integer

- `current_page` (optional)
  Type: integer
  
  default: 0

- `expires_at` (required)
  Type: string, date-time

- `supports_offline` (optional)
  Type: boolean
  
  default: false

- `lookup_data` (optional)
  Type: unknown
  
  anyOf:
    Type: object
    
    Additional properties: 
      Type: object
      
      Additional properties: 
        Type: object
        
        Additional properties: true
  
    Type: null

- `trigger_questions` (optional)
  Type: array
  
  default: []
  
  Items:
    Type: string

- `referee_questions` (optional)
  Type: object
  
  default: {}
  
  Additional properties: 
    Type: array
    
    Items:
      Type: string

## FormService_FormSubmitRequest

Type: object

Request to submit a completed form.

Schema: [FormService_FormSubmitRequest](/api-reference/schemas/formservice-formsubmitrequest-2d8b5b44e8.md)

- `session_token` (required)
  Type: string

- `form_data` (required)
  Type: object
  
  Additional properties: true

- `is_complete` (optional)
  Type: boolean
  
  default: true

- `current_page` (optional)
  Type: unknown
  
  anyOf:
    Type: integer
  
    Type: null

- `client_timestamp` (optional)
  Type: unknown
  
  anyOf:
    Type: string, date-time
  
    Type: null

- `duration_seconds` (optional)
  Type: unknown
  
  Active form filling duration in seconds, excluding paused time
  
  anyOf:
    Type: integer
    
    minimum: 0
    
    maximum: 2592000
  
    Type: null

- `offline_submission` (optional)
  Type: boolean
  
  default: false

- `offline_queued_at` (optional)
  Type: unknown
  
  anyOf:
    Type: string, date-time
  
    Type: null

- `edit_response_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `version_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string, uuid
  
    Type: null

- `interview_id` (optional)
  Type: unknown
  
  Interview execution ID (cross-service correlation)
  
  anyOf:
    Type: string, uuid
  
    Type: null

- `language` (optional)
  Type: unknown
  
  Language code used for this submission (e.g., 'en', 'es', 'fr')
  
  anyOf:
    Type: string
    
    maxLength: 10
  
    Type: null

## FormService_FormSubmitResponse

Type: object

Response after form submission.

Schema: [FormService_FormSubmitResponse](/api-reference/schemas/formservice-formsubmitresponse-23adf0d549.md)

- `success` (required)
  Type: boolean

- `response_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string, uuid
  
    Type: null

- `session_id` (required)
  Type: string, uuid

- `version_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string, uuid
  
    Type: null

- `submitted_at` (required)
  Type: string, date-time

- `validation_errors` (optional)
  Type: array
  
  default: []
  
  Items:
    Type: object
    
    Additional properties: true

- `message` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `response_language` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

## FormService_FormValidateRequest

Type: object

Request to validate form data without submitting.

Schema: [FormService_FormValidateRequest](/api-reference/schemas/formservice-formvalidaterequest-a151812b3b.md)

- `session_token` (required)
  Type: string

- `form_data` (required)
  Type: object
  
  Additional properties: true

- `validate_all` (optional)
  Type: boolean
  
  default: false

- `fields_to_validate` (optional)
  Type: unknown
  
  anyOf:
    Type: array
    
    Items:
      Type: string
  
    Type: null

## FormService_FormValidateResponse

Type: object

Response with validation results.

Schema: [FormService_FormValidateResponse](/api-reference/schemas/formservice-formvalidateresponse-394c496878.md)

- `is_valid` (required)
  Type: boolean

- `errors` (optional)
  Type: array
  
  default: []
  
  Items:
    Type: object
    
    Additional properties: true

- `warnings` (optional)
  Type: array
  
  default: []
  
  Items:
    Type: object
    
    Additional properties: true

- `completion_percentage` (optional)
  Type: integer
  
  default: 0

## FormService_HTTPValidationError

Type: object

Schema: [FormService_HTTPValidationError](/api-reference/schemas/formservice-httpvalidationerror-8e8725ba52.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [FormService_ValidationError](/api-reference/schemas/formservice-validationerror-e235b81cf9.md); Type: object

## FormService_InterviewDto

Type: object

Schema: [FormService_InterviewDto](/api-reference/schemas/formservice-interviewdto-8f3906253b.md)

- `id` (required)
  Type: string, uuid

- `tenant_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string, uuid
  
    Type: null

- `survey_id` (required)
  Type: string, uuid

- `respondent_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string, uuid
  
    Type: null

- `interviewer_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string, uuid
  
    Type: null

- `session_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string, uuid
  
    Type: null

- `session_token` (required)
  Type: string

- `status` (required)
  Type: string

- `started_at` (optional)
  Type: unknown
  
  anyOf:
    Type: string, date-time
  
    Type: null

- `paused_at` (optional)
  Type: unknown
  
  anyOf:
    Type: string, date-time
  
    Type: null

- `completed_at` (optional)
  Type: unknown
  
  anyOf:
    Type: string, date-time
  
    Type: null

- `terminated_at` (optional)
  Type: unknown
  
  anyOf:
    Type: string, date-time
  
    Type: null

- `termination_reason` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `last_heartbeat_at` (optional)
  Type: unknown
  
  anyOf:
    Type: string, date-time
  
    Type: null

- `language` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `interview_metadata` (optional)
  Type: object
  
  default: {}
  
  Additional properties: true

- `current_page` (optional)
  Type: integer
  
  default: 0

- `answered_count` (optional)
  Type: integer
  
  default: 0

- `total_questions` (optional)
  Type: integer
  
  default: 0

- `survey_name` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `response_rid` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `response_uid` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `current_response_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string, uuid
  
    Type: null

- `created_at` (required)
  Type: string, date-time

- `updated_at` (required)
  Type: string, date-time

## FormService_InterviewEventDto

Type: object

Schema: [FormService_InterviewEventDto](/api-reference/schemas/formservice-intervieweventdto-9b738f45ed.md)

- `id` (required)
  Type: string, uuid

- `interview_id` (required)
  Type: string, uuid

- `tenant_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string, uuid
  
    Type: null

- `from_status` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `to_status` (required)
  Type: string

- `triggered_by` (optional)
  Type: unknown
  
  anyOf:
    Type: string, uuid
  
    Type: null

- `event_metadata` (optional)
  Type: object
  
  default: {}
  
  Additional properties: true

- `created_at` (required)
  Type: string, date-time

## FormService_InterviewListResponse

Type: object

Schema: [FormService_InterviewListResponse](/api-reference/schemas/formservice-interviewlistresponse-7153ae680b.md)

- `items` (required)
  Type: array
  
  Items:
    Reference: [FormService_InterviewDto](/api-reference/schemas/formservice-interviewdto-8f3906253b.md); Type: object

- `total` (required)
  Type: integer

- `skip` (optional)
  Type: integer
  
  default: 0

- `limit` (optional)
  Type: integer
  
  default: 20

- `has_next` (optional)
  Type: boolean
  
  default: false

- `has_previous` (optional)
  Type: boolean
  
  default: false

## FormService_NoteCreateDto

Type: object

Schema: [FormService_NoteCreateDto](/api-reference/schemas/formservice-notecreatedto-1d46b029fa.md)

- `field_name` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `text` (required)
  Type: string
  
  minLength: 1

- `category` (optional)
  Type: string
  
  default: "general"

- `client_created_at` (optional)
  Type: unknown
  
  anyOf:
    Type: string, date-time
  
    Type: null

## FormService_NoteListResponse

Type: object

Schema: [FormService_NoteListResponse](/api-reference/schemas/formservice-notelistresponse-ff5f1d209b.md)

- `items` (required)
  Type: array
  
  Items:
    Reference: [FormService_NoteResponseDto](/api-reference/schemas/formservice-noteresponsedto-705fa67267.md); Type: object

- `total` (required)
  Type: integer

## FormService_NoteResponseDto

Type: object

Schema: [FormService_NoteResponseDto](/api-reference/schemas/formservice-noteresponsedto-705fa67267.md)

- `id` (required)
  Type: string, uuid

- `interview_id` (required)
  Type: string, uuid

- `tenant_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string, uuid
  
    Type: null

- `field_name` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `text` (required)
  Type: string

- `category` (required)
  Type: string

- `author_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string, uuid
  
    Type: null

- `pinned` (optional)
  Type: boolean
  
  default: false

- `created_at` (required)
  Type: string, date-time

- `updated_at` (required)
  Type: string, date-time

- `client_created_at` (optional)
  Type: unknown
  
  anyOf:
    Type: string, date-time
  
    Type: null

## FormService_NoteUpdateDto

Type: object

Schema: [FormService_NoteUpdateDto](/api-reference/schemas/formservice-noteupdatedto-caba699aea.md)

- `text` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `category` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `pinned` (optional)
  Type: unknown
  
  anyOf:
    Type: boolean
  
    Type: null

- `field_name` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

## FormService_PrefillResponse

Type: object

Response containing pre-fill data from a previous response.

Schema: [FormService_PrefillResponse](/api-reference/schemas/formservice-prefillresponse-9b65bda96c.md)

- `prefill_data` (optional)
  Type: object
  
  Field name to value mapping for pre-fill
  
  Additional properties: true

- `source_response_id` (required)
  Type: string
  
  ID of the source response

- `source_submitted_at` (optional)
  Type: unknown
  
  When the source response was submitted
  
  anyOf:
    Type: string
  
    Type: null

- `prefill_fields` (optional)
  Type: array
  
  List of field names that were pre-filled
  
  Items:
    Type: string

## FormService_RidBlockAllocationRequest

Type: object

Request payload for server-allocated device-bound RID block (R25 / AD-3).

Schema: [FormService_RidBlockAllocationRequest](/api-reference/schemas/formservice-ridblockallocationrequest-0933e80022.md)

- `survey_id` (required)
  Type: string, uuid
  
  ID of the survey for which RID block is requested

- `device_id` (required)
  Type: string
  
  Unique client device ID (non-placeholder)
  
  minLength: 4
  
  maxLength: 255

- `block_size` (optional)
  Type: integer
  
  Number of sequential RIDs to allocate
  
  default: 50
  
  minimum: 1
  
  maximum: 200

- `idempotency_key` (optional)
  Type: unknown
  
  Client idempotency key for safe retries
  
  anyOf:
    Type: string
    
    maxLength: 255
  
    Type: null

## FormService_RidBlockListResponse

Type: object

List of RID block allocations.

Schema: [FormService_RidBlockListResponse](/api-reference/schemas/formservice-ridblocklistresponse-2b9b9da213.md)

- `items` (required)
  Type: array
  
  Items:
    Reference: [FormService_RidBlockResponse](/api-reference/schemas/formservice-ridblockresponse-4b8c100a7a.md); Type: object
    
    Server-allocated device-bound RID block response (matches mobile RidBlockDto).

- `total` (required)
  Type: integer

## FormService_RidBlockResponse

Type: object

Server-allocated device-bound RID block response (matches mobile RidBlockDto).

Schema: [FormService_RidBlockResponse](/api-reference/schemas/formservice-ridblockresponse-4b8c100a7a.md)

- `id` (required)
  Type: string, uuid

- `tenant_id` (required)
  Type: string, uuid

- `survey_id` (required)
  Type: string, uuid

- `user_id` (required)
  Type: string, uuid

- `user_code` (required)
  Type: string

- `device_id` (required)
  Type: string

- `start_seq` (required)
  Type: integer

- `end_seq` (required)
  Type: integer

- `current_seq` (required)
  Type: integer

- `is_exhausted` (optional)
  Type: boolean
  
  default: false

- `idempotency_key` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `created_at` (required)
  Type: string

## FormService_SessionListResponse

Type: object

Response containing list of sessions.

Schema: [FormService_SessionListResponse](/api-reference/schemas/formservice-sessionlistresponse-1fe9e0e8ce.md)

- `items` (required)
  Type: array
  
  Items:
    Reference: [FormService_SessionResponse](/api-reference/schemas/formservice-sessionresponse-11edd23d9f.md); Type: object
    
    Response containing session information.

- `total` (required)
  Type: integer

- `skip` (optional)
  Type: integer
  
  default: 0

- `limit` (optional)
  Type: integer
  
  default: 20

- `has_next` (required)
  Type: boolean

- `has_previous` (required)
  Type: boolean

## FormService_SessionResponse

Type: object

Response containing session information.

Schema: [FormService_SessionResponse](/api-reference/schemas/formservice-sessionresponse-11edd23d9f.md)

- `id` (required)
  Type: string, uuid

- `survey_id` (required)
  Type: string, uuid

- `survey_version_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string, uuid
  
    Type: null

- `session_token` (required)
  Type: string

- `status` (required)
  Type: string

- `current_page` (required)
  Type: integer

- `total_pages` (optional)
  Type: unknown
  
  anyOf:
    Type: integer
  
    Type: null

- `progress_percentage` (required)
  Type: integer

- `is_offline` (required)
  Type: boolean

- `started_at` (required)
  Type: string, date-time

- `last_activity_at` (required)
  Type: string, date-time

- `expires_at` (required)
  Type: string, date-time

- `completed_at` (optional)
  Type: unknown
  
  anyOf:
    Type: string, date-time
  
    Type: null

- `response_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string, uuid
  
    Type: null

- `metadata` (optional)
  Type: object
  
  default: {}
  
  Additional properties: true

## FormService_TerminationDto

Type: object

Schema: [FormService_TerminationDto](/api-reference/schemas/formservice-terminationdto-827fa97c4f.md)

- `id` (required)
  Type: string, uuid

- `interview_id` (required)
  Type: string, uuid

- `tenant_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string, uuid
  
    Type: null

- `termination_reason` (required)
  Type: string

- `explanatory_text` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `retain_partial_data` (required)
  Type: boolean

- `discard_data` (required)
  Type: boolean

- `notify_supervisor` (required)
  Type: boolean

- `supervisor_notified` (required)
  Type: boolean

- `supervisor_notified_at` (optional)
  Type: unknown
  
  anyOf:
    Type: string, date-time
  
    Type: null

- `data_action_taken` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `terminated_by` (required)
  Type: string, uuid

- `created_at` (required)
  Type: string, date-time

## FormService_TerminationPolicyDto

Type: object

Schema: [FormService_TerminationPolicyDto](/api-reference/schemas/formservice-terminationpolicydto-d1fa53cfd0.md)

- `retain_partial_data` (required)
  Type: boolean

- `discard_data` (required)
  Type: boolean

- `notify_supervisor` (required)
  Type: boolean

- `requires_explanatory_text` (required)
  Type: boolean

## FormService_TerminationReasonOptionDto

Type: object

Schema: [FormService_TerminationReasonOptionDto](/api-reference/schemas/formservice-terminationreasonoptiondto-880f57b551.md)

- `code` (required)
  Type: string

- `display_label` (required)
  Type: string

- `policy` (required)
  Reference: [FormService_TerminationPolicyDto](/api-reference/schemas/formservice-terminationpolicydto-d1fa53cfd0.md); Type: object

## FormService_TransitionInterviewDto

Type: object

Schema: [FormService_TransitionInterviewDto](/api-reference/schemas/formservice-transitioninterviewdto-c26435a1a1.md)

- `to_status` (required)
  Type: string

- `termination_reason` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `explanatory_text` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `form_data` (optional)
  Type: unknown
  
  anyOf:
    Type: object
    
    Additional properties: true
  
    Type: null

- `is_complete` (optional)
  Type: unknown
  
  anyOf:
    Type: boolean
  
    Type: null

- `current_page` (optional)
  Type: unknown
  
  anyOf:
    Type: integer
  
    Type: null

- `version_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `edit_response_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `duration_seconds` (optional)
  Type: unknown
  
  anyOf:
    Type: integer
  
    Type: null

- `question_paradata` (optional)
  Type: unknown
  
  Phase-1 question paradata (T). Additive — merged into InterviewExecution.interview_metadata.question_paradata before the transition, and forwarded to data-service response_metadata at completion/retained termination. Existing metadata keys are preserved.
  
  anyOf:
    Type: object
    
    Additional properties: true
  
    Type: null

## FormService_UpdateInterviewDto

Type: object

Schema: [FormService_UpdateInterviewDto](/api-reference/schemas/formservice-updateinterviewdto-c7d9ace9ae.md)

- `respondent_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string, uuid
  
    Type: null

- `current_page` (optional)
  Type: unknown
  
  anyOf:
    Type: integer
  
    Type: null

- `answered_count` (optional)
  Type: unknown
  
  anyOf:
    Type: integer
  
    Type: null

- `total_questions` (optional)
  Type: unknown
  
  anyOf:
    Type: integer
  
    Type: null

- `interview_metadata` (optional)
  Type: unknown
  
  anyOf:
    Type: object
    
    Additional properties: true
  
    Type: null

## FormService_ValidateFieldRequest

Type: object

Request to validate a single field.

Schema: [FormService_ValidateFieldRequest](/api-reference/schemas/formservice-validatefieldrequest-fee5567ddf.md)

- `session_token` (required)
  Type: string
  
  Form session token

- `field_name` (required)
  Type: string
  
  Name of the field to validate

- `field_value` (required)
  Type: unknown
  
  Current value of the field

- `form_data` (optional)
  Type: object
  
  Complete form data
  
  Additional properties: true

## FormService_ValidateFieldResponse

Type: object

Response for single field validation.

Schema: [FormService_ValidateFieldResponse](/api-reference/schemas/formservice-validatefieldresponse-6baa72e46e.md)

- `is_valid` (required)
  Type: boolean

- `field` (required)
  Type: string

- `errors` (optional)
  Type: array
  
  Items:
    Type: object
    
    Additional properties: true

## FormService_ValidateFormRequest

Type: object

Request to validate entire form.

Schema: [FormService_ValidateFormRequest](/api-reference/schemas/formservice-validateformrequest-844286fc55.md)

- `session_token` (required)
  Type: string
  
  Form session token

- `form_data` (required)
  Type: object
  
  Form data to validate
  
  Additional properties: true

- `fields_to_validate` (optional)
  Type: unknown
  
  Optional list of fields to validate (all if not specified)
  
  anyOf:
    Type: array
    
    Items:
      Type: string
  
    Type: null

## FormService_ValidateFormResponse

Type: object

Response for form validation.

Schema: [FormService_ValidateFormResponse](/api-reference/schemas/formservice-validateformresponse-957dec06ed.md)

- `is_valid` (required)
  Type: boolean

- `errors` (optional)
  Type: array
  
  Items:
    Type: object
    
    Additional properties: true

- `total_fields` (required)
  Type: integer

- `valid_fields` (required)
  Type: integer

- `invalid_fields` (required)
  Type: integer

## FormService_ValidationError

Type: object

Schema: [FormService_ValidationError](/api-reference/schemas/formservice-validationerror-e235b81cf9.md)

- `loc` (required)
  Type: array
  
  Items:
    Type: unknown
    
    anyOf:
      Type: string
    
      Type: integer

- `msg` (required)
  Type: string

- `type` (required)
  Type: string

- `input` (optional)
  Type: unknown

- `ctx` (optional)
  Type: object

## MediaService_AssetUpdateRequest

Type: object

Schema: [MediaService_AssetUpdateRequest](/api-reference/schemas/mediaservice-assetupdaterequest-5a8ce499c3.md)

- `original_filename` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `description` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `alt_text` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `tags` (optional)
  Type: unknown
  
  anyOf:
    Type: array
    
    Items:
      Type: string
  
    Type: null

- `is_public` (optional)
  Type: unknown
  
  anyOf:
    Type: boolean
  
    Type: null

## MediaService_Body_upload_batch_api_v1_media_upload_batch_post

Type: object

Schema: [MediaService_Body_upload_batch_api_v1_media_upload_batch_post](/api-reference/schemas/mediaservice-body-upload-batch-api-v1-media-upload-batch-post-5ea4e742e9.md)

- `files` (required)
  Type: array
  
  Items:
    Type: string

- `survey_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `response_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `entity_type` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `entity_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `user_name` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `device_id` (optional)
  Type: unknown
  
  Device that recorded this media (used for post-closure grant validation)
  
  anyOf:
    Type: string
  
    Type: null

## MediaService_Body_upload_chunk_api_v1_media_upload_chunk_post

Type: object

Schema: [MediaService_Body_upload_chunk_api_v1_media_upload_chunk_post](/api-reference/schemas/mediaservice-body-upload-chunk-api-v1-media-upload-chunk-post-3d429bec17.md)

- `file` (required)
  Type: string

- `upload_id` (required)
  Type: string
  
  Client-generated stable upload ID (media local ID)
  
  minLength: 8
  
  maxLength: 64

- `chunk_index` (required)
  Type: integer
  
  Zero-based chunk index
  
  minimum: 0

- `total_chunks` (required)
  Type: integer
  
  Total number of chunks
  
  minimum: 1
  
  maximum: 100000

- `file_name` (required)
  Type: string
  
  minLength: 1
  
  maxLength: 255

- `mime_type` (required)
  Type: string
  
  minLength: 1
  
  maxLength: 100

- `survey_id` (optional)
  Type: unknown
  
  Survey this media belongs to (REQUIRED for production-bound uploads)
  
  anyOf:
    Type: string
  
    Type: null

- `response_id` (optional)
  Type: unknown
  
  Client-local response reference (metadata only — never the enforcement key)
  
  anyOf:
    Type: string
  
    Type: null

- `checksum` (optional)
  Type: unknown
  
  Expected SHA-256 of the FULL assembled file
  
  anyOf:
    Type: string
  
    Type: null

- `device_id` (optional)
  Type: unknown
  
  Device that recorded this media (used for post-closure grant validation)
  
  anyOf:
    Type: string
  
    Type: null

## MediaService_Body_upload_file_api_v1_media_upload_post

Type: object

Schema: [MediaService_Body_upload_file_api_v1_media_upload_post](/api-reference/schemas/mediaservice-body-upload-file-api-v1-media-upload-post-e04daaccb8.md)

- `file` (required)
  Type: string

- `survey_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `response_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `entity_type` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `entity_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `is_public` (optional)
  Type: boolean
  
  default: false

- `description` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `survey_name` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `question_name` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `user_name` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `device_id` (optional)
  Type: unknown
  
  Device that recorded this media (used for post-closure grant validation)
  
  anyOf:
    Type: string
  
    Type: null

- `checksum` (optional)
  Type: unknown
  
  Expected SHA-256 checksum of file
  
  anyOf:
    Type: string
  
    Type: null

## MediaService_Body_upload_library_file_api_v1_media_library_upload_post

Type: object

Schema: [MediaService_Body_upload_library_file_api_v1_media_library_upload_post](/api-reference/schemas/mediaservice-body-upload-library-file-api-v1-media-library-upload-post-dbd2f63f47.md)

- `file` (required)
  Type: string
  
  Media file to add to the library

- `description` (optional)
  Type: unknown
  
  Optional description
  
  anyOf:
    Type: string
  
    Type: null

- `survey_name` (optional)
  Type: unknown
  
  Optional survey name for renaming
  
  anyOf:
    Type: string
  
    Type: null

- `question_name` (optional)
  Type: unknown
  
  Optional question name for renaming
  
  anyOf:
    Type: string
  
    Type: null

- `response_id` (optional)
  Type: unknown
  
  Optional response ID for renaming
  
  anyOf:
    Type: string
  
    Type: null

## MediaService_Body_upload_library_files_batch_api_v1_media_library_upload_batch_post

Type: object

Schema: [MediaService_Body_upload_library_files_batch_api_v1_media_library_upload_batch_post](/api-reference/schemas/mediaservice-body-upload-library-files-batch-api-v1-media-library-upload-batch-post-352912a6cf.md)

- `files` (required)
  Type: array
  
  Media files to add to the library
  
  Items:
    Type: string

## MediaService_HTTPValidationError

Type: object

Schema: [MediaService_HTTPValidationError](/api-reference/schemas/mediaservice-httpvalidationerror-f5812c7c1f.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [MediaService_ValidationError](/api-reference/schemas/mediaservice-validationerror-0fc30c3898.md); Type: object

## MediaService_ValidationError

Type: object

Schema: [MediaService_ValidationError](/api-reference/schemas/mediaservice-validationerror-0fc30c3898.md)

- `loc` (required)
  Type: array
  
  Items:
    Type: unknown
    
    anyOf:
      Type: string
    
      Type: integer

- `msg` (required)
  Type: string

- `type` (required)
  Type: string

- `input` (optional)
  Type: unknown

- `ctx` (optional)
  Type: object

## NotificationService_AWSConfig

Type: object

Schema: [NotificationService_AWSConfig](/api-reference/schemas/notificationservice-awsconfig-00d0034632.md)

- `aws_region` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `aws_access_key_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `aws_secret_access_key` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `aws_origination_number` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

## NotificationService_AWSConfigResponse

Type: object

Schema: [NotificationService_AWSConfigResponse](/api-reference/schemas/notificationservice-awsconfigresponse-e8c66a5507.md)

- `aws_region` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `aws_access_key_id` (optional)
  Type: unknown
  
  default: "••••••••"
  
  anyOf:
    Type: string
  
    Type: null

- `aws_secret_access_key` (optional)
  Type: unknown
  
  default: "••••••••"
  
  anyOf:
    Type: string
  
    Type: null

- `aws_origination_number` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

## NotificationService_AfricasTalkingConfig

Type: object

Schema: [NotificationService_AfricasTalkingConfig](/api-reference/schemas/notificationservice-africastalkingconfig-fb71dc718d.md)

- `africas_talking_username` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `africas_talking_api_key` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `africas_talking_shortcode` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

## NotificationService_AfricasTalkingConfigResponse

Type: object

Schema: [NotificationService_AfricasTalkingConfigResponse](/api-reference/schemas/notificationservice-africastalkingconfigresponse-171e3c21dd.md)

- `africas_talking_username` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `africas_talking_api_key` (optional)
  Type: unknown
  
  default: "••••••••"
  
  anyOf:
    Type: string
  
    Type: null

- `africas_talking_shortcode` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

## NotificationService_CancelNotificationsRequest

Type: object

Schema: [NotificationService_CancelNotificationsRequest](/api-reference/schemas/notificationservice-cancelnotificationsrequest-2d6a11dc16.md)

- `recipient` (required)
  Type: string, email

## NotificationService_GenericHttpConfig

Type: object

Schema: [NotificationService_GenericHttpConfig](/api-reference/schemas/notificationservice-generichttpconfig-61cc58e557.md)

- `generic_sms_endpoint` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `generic_sms_method` (optional)
  Type: string
  
  default: "POST"
  
  enum: ["POST","GET"]

- `generic_sms_auth_header_name` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `generic_sms_auth_header_value` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `generic_sms_body_template` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

## NotificationService_GenericHttpConfigResponse

Type: object

Schema: [NotificationService_GenericHttpConfigResponse](/api-reference/schemas/notificationservice-generichttpconfigresponse-c12cbab716.md)

- `generic_sms_endpoint` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `generic_sms_method` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `generic_sms_auth_header_name` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `generic_sms_auth_header_value` (optional)
  Type: unknown
  
  default: "••••••••"
  
  anyOf:
    Type: string
  
    Type: null

- `generic_sms_body_template` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

## NotificationService_HTTPValidationError

Type: object

Schema: [NotificationService_HTTPValidationError](/api-reference/schemas/notificationservice-httpvalidationerror-89b24df40a.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [NotificationService_ValidationError](/api-reference/schemas/notificationservice-validationerror-e6abc27f21.md); Type: object

## NotificationService_KaleyraConfig

Type: object

Schema: [NotificationService_KaleyraConfig](/api-reference/schemas/notificationservice-kaleyraconfig-a61cec99b1.md)

- `kaleyra_api_key` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `kaleyra_account_sid` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `kaleyra_sender_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

## NotificationService_KaleyraConfigResponse

Type: object

Schema: [NotificationService_KaleyraConfigResponse](/api-reference/schemas/notificationservice-kaleyraconfigresponse-d7f645b660.md)

- `kaleyra_api_key` (optional)
  Type: unknown
  
  default: "••••••••"
  
  anyOf:
    Type: string
  
    Type: null

- `kaleyra_account_sid` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `kaleyra_sender_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

## NotificationService_MSG91Config

Type: object

Schema: [NotificationService_MSG91Config](/api-reference/schemas/notificationservice-msg91config-e074ce88a5.md)

- `msg91_api_key` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `msg91_sender_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `msg91_flow_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `msg91_route` (optional)
  Type: string
  
  default: "4"
  
  enum: ["1","4"]

## NotificationService_MSG91ConfigResponse

Type: object

Schema: [NotificationService_MSG91ConfigResponse](/api-reference/schemas/notificationservice-msg91configresponse-f9524e204e.md)

- `msg91_api_key` (optional)
  Type: unknown
  
  default: "••••••••"
  
  anyOf:
    Type: string
  
    Type: null

- `msg91_sender_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `msg91_flow_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `msg91_route` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

## NotificationService_NotificationSettingsRequest

Type: object

Schema: [NotificationService_NotificationSettingsRequest](/api-reference/schemas/notificationservice-notificationsettingsrequest-0dbf9180a6.md)

- `smtp` (optional)
  Type: unknown
  
  anyOf:
    Reference: [NotificationService_SMTPConfig](/api-reference/schemas/notificationservice-smtpconfig-da6804e9b9.md); Type: object
  
    Type: null

- `sms_provider` (optional)
  Type: string
  
  default: "mock"
  
  enum: ["mock","aws_end_user_messaging","twilio","msg91","kaleyra","africas_talking","generic_http"]

- `aws` (optional)
  Type: unknown
  
  anyOf:
    Reference: [NotificationService_AWSConfig](/api-reference/schemas/notificationservice-awsconfig-00d0034632.md); Type: object
  
    Type: null

- `twilio` (optional)
  Type: unknown
  
  anyOf:
    Reference: [NotificationService_TwilioConfig](/api-reference/schemas/notificationservice-twilioconfig-b3f84254c5.md); Type: object
  
    Type: null

- `msg91` (optional)
  Type: unknown
  
  anyOf:
    Reference: [NotificationService_MSG91Config](/api-reference/schemas/notificationservice-msg91config-e074ce88a5.md); Type: object
  
    Type: null

- `kaleyra` (optional)
  Type: unknown
  
  anyOf:
    Reference: [NotificationService_KaleyraConfig](/api-reference/schemas/notificationservice-kaleyraconfig-a61cec99b1.md); Type: object
  
    Type: null

- `africas_talking` (optional)
  Type: unknown
  
  anyOf:
    Reference: [NotificationService_AfricasTalkingConfig](/api-reference/schemas/notificationservice-africastalkingconfig-fb71dc718d.md); Type: object
  
    Type: null

- `generic_http` (optional)
  Type: unknown
  
  anyOf:
    Reference: [NotificationService_GenericHttpConfig](/api-reference/schemas/notificationservice-generichttpconfig-61cc58e557.md); Type: object
  
    Type: null

- `slack` (optional)
  Type: unknown
  
  anyOf:
    Reference: [NotificationService_SlackConfig](/api-reference/schemas/notificationservice-slackconfig-3aeb3a316e.md); Type: object
  
    Type: null

## NotificationService_NotificationSettingsResponse

Type: object

Schema: [NotificationService_NotificationSettingsResponse](/api-reference/schemas/notificationservice-notificationsettingsresponse-6aa4babdfd.md)

- `sms_provider` (required)
  Type: string

- `smtp` (required)
  Reference: [NotificationService_SMTPConfigResponse](/api-reference/schemas/notificationservice-smtpconfigresponse-cf5f60ea60.md); Type: object

- `aws` (optional)
  Type: unknown
  
  anyOf:
    Reference: [NotificationService_AWSConfigResponse](/api-reference/schemas/notificationservice-awsconfigresponse-e8c66a5507.md); Type: object
  
    Type: null

- `twilio` (optional)
  Type: unknown
  
  anyOf:
    Reference: [NotificationService_TwilioConfigResponse](/api-reference/schemas/notificationservice-twilioconfigresponse-ca0345efeb.md); Type: object
  
    Type: null

- `msg91` (optional)
  Type: unknown
  
  anyOf:
    Reference: [NotificationService_MSG91ConfigResponse](/api-reference/schemas/notificationservice-msg91configresponse-f9524e204e.md); Type: object
  
    Type: null

- `kaleyra` (optional)
  Type: unknown
  
  anyOf:
    Reference: [NotificationService_KaleyraConfigResponse](/api-reference/schemas/notificationservice-kaleyraconfigresponse-d7f645b660.md); Type: object
  
    Type: null

- `africas_talking` (optional)
  Type: unknown
  
  anyOf:
    Reference: [NotificationService_AfricasTalkingConfigResponse](/api-reference/schemas/notificationservice-africastalkingconfigresponse-171e3c21dd.md); Type: object
  
    Type: null

- `generic_http` (optional)
  Type: unknown
  
  anyOf:
    Reference: [NotificationService_GenericHttpConfigResponse](/api-reference/schemas/notificationservice-generichttpconfigresponse-c12cbab716.md); Type: object
  
    Type: null

- `slack` (optional)
  Type: unknown
  
  anyOf:
    Reference: [NotificationService_SlackConfigResponse](/api-reference/schemas/notificationservice-slackconfigresponse-2b5dd208e8.md); Type: object
  
    Type: null

- `is_active` (required)
  Type: boolean

- `created_at` (required)
  Type: string

- `updated_at` (required)
  Type: string

## NotificationService_NotificationType

Type: string

Schema: [NotificationService_NotificationType](/api-reference/schemas/notificationservice-notificationtype-26f3121586.md)

enum: ["account_activation","password_reset_request","password_changed","email_change_confirmation","email_changed_notify","magic_link_login","audit_security_alert","dns_notification","welcome_email","tenant_active","download_ready","media_export_ready"]

## NotificationService_SMTPConfig

Type: object

Schema: [NotificationService_SMTPConfig](/api-reference/schemas/notificationservice-smtpconfig-da6804e9b9.md)

- `smtp_host` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `smtp_port` (optional)
  Type: unknown
  
  default: 587
  
  anyOf:
    Type: integer
    
    minimum: 1
    
    maximum: 65535
  
    Type: null

- `smtp_username` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `smtp_password` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `smtp_from_email` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `smtp_from_name` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `smtp_use_tls` (optional)
  Type: boolean
  
  default: true

## NotificationService_SMTPConfigResponse

Type: object

Schema: [NotificationService_SMTPConfigResponse](/api-reference/schemas/notificationservice-smtpconfigresponse-cf5f60ea60.md)

- `smtp_host` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `smtp_port` (optional)
  Type: unknown
  
  anyOf:
    Type: integer
  
    Type: null

- `smtp_username` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `smtp_password` (optional)
  Type: unknown
  
  default: "••••••••"
  
  anyOf:
    Type: string
  
    Type: null

- `smtp_from_email` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `smtp_from_name` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `smtp_use_tls` (optional)
  Type: unknown
  
  anyOf:
    Type: boolean
  
    Type: null

## NotificationService_SendBatchRequest

Type: object

Schema: [NotificationService_SendBatchRequest](/api-reference/schemas/notificationservice-sendbatchrequest-adadffcaa6.md)

- `notifications` (required)
  Type: array
  
  Items:
    Reference: [NotificationService_SendNotificationRequest](/api-reference/schemas/notificationservice-sendnotificationrequest-bce0cd0fcb.md); Type: object

## NotificationService_SendNotificationRequest

Type: object

Schema: [NotificationService_SendNotificationRequest](/api-reference/schemas/notificationservice-sendnotificationrequest-bce0cd0fcb.md)

- `channel` (required)
  Type: string
  
  enum: ["email","sms","slack"]

- `recipient` (required)
  Type: string

- `subject` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `body` (required)
  Type: string

- `template_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `template_vars` (optional)
  Type: unknown
  
  anyOf:
    Type: object
    
    Additional properties: true
  
    Type: null

- `user_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `notification_type` (optional)
  Type: unknown
  
  anyOf:
    Reference: [NotificationService_NotificationType](/api-reference/schemas/notificationservice-notificationtype-26f3121586.md); Type: string
    
    enum: ["account_activation","password_reset_request","password_changed","email_change_confirmation","email_changed_notify","magic_link_login","audit_security_alert","dns_notification","welcome_email","tenant_active","download_ready","media_export_ready"]
  
    Type: string
  
    Type: null

- `metadata` (optional)
  Type: unknown
  
  anyOf:
    Type: object
    
    Additional properties: true
  
    Type: null

## NotificationService_SlackConfig

Type: object

Schema: [NotificationService_SlackConfig](/api-reference/schemas/notificationservice-slackconfig-3aeb3a316e.md)

- `slack_webhook_url` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

## NotificationService_SlackConfigResponse

Type: object

Schema: [NotificationService_SlackConfigResponse](/api-reference/schemas/notificationservice-slackconfigresponse-2b5dd208e8.md)

- `slack_webhook_url` (optional)
  Type: unknown
  
  default: "••••••••"
  
  anyOf:
    Type: string
  
    Type: null

## NotificationService_TemplateCreateRequest

Type: object

Schema: [NotificationService_TemplateCreateRequest](/api-reference/schemas/notificationservice-templatecreaterequest-9d73ece643.md)

- `name` (required)
  Type: string

- `channel` (required)
  Type: string

- `subject_template` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `body_template` (required)
  Type: string

- `variables` (optional)
  Type: unknown
  
  anyOf:
    Type: array
    
    Items:
      Type: string
  
    Type: null

## NotificationService_TemplateLivePreviewRequest

Type: object

Schema: [NotificationService_TemplateLivePreviewRequest](/api-reference/schemas/notificationservice-templatelivepreviewrequest-62dac37c00.md)

- `subject_template` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `body_template` (required)
  Type: string

- `variables` (optional)
  Type: object
  
  default: {}
  
  Additional properties: 
    Type: string

## NotificationService_TemplatePreviewRequest

Type: object

Schema: [NotificationService_TemplatePreviewRequest](/api-reference/schemas/notificationservice-templatepreviewrequest-8be7d0806f.md)

- `variables` (optional)
  Type: object
  
  default: {}
  
  Additional properties: 
    Type: string

## NotificationService_TemplateUpdateRequest

Type: object

Schema: [NotificationService_TemplateUpdateRequest](/api-reference/schemas/notificationservice-templateupdaterequest-17499a4752.md)

- `name` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `subject_template` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `body_template` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `variables` (optional)
  Type: unknown
  
  anyOf:
    Type: array
    
    Items:
      Type: string
  
    Type: null

- `is_active` (optional)
  Type: unknown
  
  anyOf:
    Type: boolean
  
    Type: null

## NotificationService_TestNotificationRequest

Type: object

Schema: [NotificationService_TestNotificationRequest](/api-reference/schemas/notificationservice-testnotificationrequest-182b6121fa.md)

- `channel` (required)
  Type: string
  
  enum: ["email","sms","slack"]

- `recipient` (required)
  Type: string

- `subject` (optional)
  Type: unknown
  
  default: "Test Notification"
  
  anyOf:
    Type: string
  
    Type: null

- `body` (optional)
  Type: string
  
  default: "This is a test notification from MQUAD Notification Service."

## NotificationService_TwilioConfig

Type: object

Schema: [NotificationService_TwilioConfig](/api-reference/schemas/notificationservice-twilioconfig-b3f84254c5.md)

- `twilio_account_sid` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `twilio_auth_token` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `twilio_from_number` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

## NotificationService_TwilioConfigResponse

Type: object

Schema: [NotificationService_TwilioConfigResponse](/api-reference/schemas/notificationservice-twilioconfigresponse-ca0345efeb.md)

- `twilio_account_sid` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `twilio_auth_token` (optional)
  Type: unknown
  
  default: "••••••••"
  
  anyOf:
    Type: string
  
    Type: null

- `twilio_from_number` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

## NotificationService_UserPreferenceRequest

Type: object

Schema: [NotificationService_UserPreferenceRequest](/api-reference/schemas/notificationservice-userpreferencerequest-3b9c7441ee.md)

- `channel` (required)
  Type: string

- `is_enabled` (optional)
  Type: boolean
  
  default: true

- `quiet_hours_start` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `quiet_hours_end` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `frequency` (optional)
  Type: string
  
  default: "immediate"

## NotificationService_ValidationError

Type: object

Schema: [NotificationService_ValidationError](/api-reference/schemas/notificationservice-validationerror-e6abc27f21.md)

- `loc` (required)
  Type: array
  
  Items:
    Type: unknown
    
    anyOf:
      Type: string
    
      Type: integer

- `msg` (required)
  Type: string

- `type` (required)
  Type: string

- `input` (optional)
  Type: unknown

- `ctx` (optional)
  Type: object

## AuditService_AuditLogCreateRequest

Type: object

Schema: [AuditService_AuditLogCreateRequest](/api-reference/schemas/auditservice-auditlogcreaterequest-190eafb833.md)

Example:

```json
{
  "action": "create",
  "actor_email": "admin@acme.org",
  "actor_id": "550e8400-e29b-41d4-a716-446655440001",
  "actor_type": "admin",
  "data_classification": "internal",
  "duration_ms": 45,
  "event_id": "550e8400-e29b-41d4-a716-446655440000",
  "event_type": "user.created",
  "http_method": "POST",
  "http_path": "/api/v1/users",
  "http_status": 201,
  "ip_address": "192.168.1.1",
  "log_schema_version": "1.0",
  "metadata": {
    "role": "viewer"
  },
  "request_id": "req-12345678",
  "resource_id": "550e8400-e29b-41d4-a716-446655440003",
  "resource_type": "User",
  "service_name": "backend",
  "status": "success",
  "tenant_id": "550e8400-e29b-41d4-a716-446655440002",
  "trace_id": "trace-12345678"
}
```

- `event_id` (optional)
  Type: unknown
  
  Unique event ID for idempotency
  
  anyOf:
    Type: string
  
    Type: null

- `event_type` (optional)
  Type: unknown
  
  Type of event (e.g., user.created)
  
  anyOf:
    Type: string
  
    Type: null

- `log_schema_version` (optional)
  Type: unknown
  
  Schema version
  
  default: "1.0"
  
  anyOf:
    Type: string
  
    Type: null

- `service_name` (required)
  Type: string
  
  Name of the service producing the event

- `action` (required)
  Type: string
  
  Action performed (create, update, delete, read, login, etc.)

- `actor_type` (optional)
  Type: unknown
  
  Type of actor
  
  anyOf:
    Type: string
    
    enum: ["user","admin","system","interviewer","supervisor"]
  
    Type: null

- `actor_id` (optional)
  Type: unknown
  
  ID of the actor
  
  anyOf:
    Type: string
  
    Type: null

- `actor_email` (optional)
  Type: unknown
  
  Email of the actor
  
  anyOf:
    Type: string
  
    Type: null

- `actor_name` (optional)
  Type: unknown
  
  Display name of the actor
  
  anyOf:
    Type: string
  
    Type: null

- `tenant_id` (optional)
  Type: unknown
  
  Tenant ID
  
  anyOf:
    Type: string
  
    Type: null

- `tenant_name` (optional)
  Type: unknown
  
  Display name of the tenant
  
  anyOf:
    Type: string
  
    Type: null

- `resource_type` (optional)
  Type: unknown
  
  Type of resource
  
  anyOf:
    Type: string
  
    Type: null

- `resource_id` (optional)
  Type: unknown
  
  ID of the resource
  
  anyOf:
    Type: string
  
    Type: null

- `resource_name` (optional)
  Type: unknown
  
  Display name of the resource
  
  anyOf:
    Type: string
  
    Type: null

- `status` (optional)
  Type: unknown
  
  Event status
  
  default: "success"
  
  anyOf:
    Type: string
    
    enum: ["success","failure","error"]
  
    Type: null

- `category` (optional)
  Type: unknown
  
  Event category for filtering
  
  anyOf:
    Type: string
    
    enum: ["AUTHENTICATION","USER_MANAGEMENT","ROLE_ACCESS","SURVEY_LIFECYCLE","RESPONSE_DATA","INTERVIEW","CONSENT","EXPORT","INTEGRATION","SYNC","MEDIA","CONFIGURATION","SECURITY","SYSTEM","REVIEW","NOTIFICATION","COMPLIANCE"]
  
    Type: null

- `severity` (optional)
  Type: unknown
  
  Event severity level
  
  default: "INFO"
  
  anyOf:
    Type: string
    
    enum: ["INFO","WARNING","CRITICAL"]
  
    Type: null

- `description` (optional)
  Type: unknown
  
  Human-readable event description
  
  anyOf:
    Type: string
  
    Type: null

- `failure_reason` (optional)
  Type: unknown
  
  Reason for failure if status is failure/error
  
  anyOf:
    Type: string
  
    Type: null

- `correlation_id` (optional)
  Type: unknown
  
  Cross-service correlation ID
  
  anyOf:
    Type: string
  
    Type: null

- `ip_address` (optional)
  Type: unknown
  
  Client IP address
  
  anyOf:
    Type: string
  
    Type: null

- `user_agent` (optional)
  Type: unknown
  
  Client user agent
  
  anyOf:
    Type: string
  
    Type: null

- `request_id` (optional)
  Type: unknown
  
  Request ID for correlation
  
  anyOf:
    Type: string
  
    Type: null

- `trace_id` (optional)
  Type: unknown
  
  Trace ID for cross-service correlation
  
  anyOf:
    Type: string
  
    Type: null

- `parent_trace_id` (optional)
  Type: unknown
  
  Parent trace ID
  
  anyOf:
    Type: string
  
    Type: null

- `http_method` (optional)
  Type: unknown
  
  HTTP method
  
  anyOf:
    Type: string
  
    Type: null

- `http_path` (optional)
  Type: unknown
  
  HTTP path
  
  anyOf:
    Type: string
  
    Type: null

- `http_status` (optional)
  Type: unknown
  
  HTTP status code
  
  anyOf:
    Type: integer
  
    Type: null

- `duration_ms` (optional)
  Type: unknown
  
  Request duration in milliseconds
  
  anyOf:
    Type: integer
  
    Type: null

- `metadata` (optional)
  Type: unknown
  
  Additional event metadata
  
  anyOf:
    Type: object
    
    Additional properties: true
  
    Type: null

- `event_idempotency_key` (optional)
  Type: unknown
  
  Key for deduplication
  
  anyOf:
    Type: string
  
    Type: null

- `data_classification` (optional)
  Type: unknown
  
  Data classification level
  
  default: "internal"
  
  anyOf:
    Type: string
    
    enum: ["public","internal","sensitive","restricted"]
  
    Type: null

## AuditService_AuditLogListResponse

Type: object

Schema: [AuditService_AuditLogListResponse](/api-reference/schemas/auditservice-auditloglistresponse-2c9c70a444.md)

- `items` (required)
  Type: array
  
  Items:
    Reference: [AuditService_AuditLogResponse](/api-reference/schemas/auditservice-auditlogresponse-a136345fdc.md); Type: object

- `total` (required)
  Type: integer

- `skip` (required)
  Type: integer

- `limit` (required)
  Type: integer

- `has_next` (required)
  Type: boolean

- `has_previous` (required)
  Type: boolean

## AuditService_AuditLogResponse

Type: object

Schema: [AuditService_AuditLogResponse](/api-reference/schemas/auditservice-auditlogresponse-a136345fdc.md)

- `id` (required)
  Type: string

- `event_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `event_type` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `log_schema_version` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `service_name` (required)
  Type: string

- `action` (required)
  Type: string

- `actor_type` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `actor_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `actor_email` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `actor_name` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `tenant_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `tenant_name` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `resource_type` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `resource_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `resource_name` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `status` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `category` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `severity` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `description` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `failure_reason` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `correlation_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `ip_address` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `user_agent` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `request_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `trace_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `parent_trace_id` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `http_method` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `http_path` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `http_status` (optional)
  Type: unknown
  
  anyOf:
    Type: integer
  
    Type: null

- `duration_ms` (optional)
  Type: unknown
  
  anyOf:
    Type: integer
  
    Type: null

- `metadata` (optional)
  Type: unknown
  
  anyOf:
    Type: object
    
    Additional properties: true
  
    Type: null

- `data_classification` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `checksum` (required)
  Type: string

- `created_at` (required)
  Type: string

## AuditService_ConsentRecordRequest

Type: object

Schema: [AuditService_ConsentRecordRequest](/api-reference/schemas/auditservice-consentrecordrequest-5e6c8467ca.md)

- `user_id` (required)
  Type: string

- `consent_type` (required)
  Type: string

- `is_granted` (required)
  Type: boolean

- `ip_address` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `metadata` (optional)
  Type: unknown
  
  anyOf:
    Type: object
    
    Additional properties: true
  
    Type: null

## AuditService_ConsentRecordResponse

Type: object

Schema: [AuditService_ConsentRecordResponse](/api-reference/schemas/auditservice-consentrecordresponse-e946da96db.md)

- `id` (required)
  Type: string

- `user_id` (required)
  Type: string

- `consent_type` (required)
  Type: string

- `is_granted` (required)
  Type: boolean

- `granted_at` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `revoked_at` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `created_at` (required)
  Type: string

## AuditService_HTTPValidationError

Type: object

Schema: [AuditService_HTTPValidationError](/api-reference/schemas/auditservice-httpvalidationerror-3f968f5485.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [AuditService_ValidationError](/api-reference/schemas/auditservice-validationerror-e7f58675b6.md); Type: object

## AuditService_ValidationError

Type: object

Schema: [AuditService_ValidationError](/api-reference/schemas/auditservice-validationerror-e7f58675b6.md)

- `loc` (required)
  Type: array
  
  Items:
    Type: unknown
    
    anyOf:
      Type: string
    
      Type: integer

- `msg` (required)
  Type: string

- `type` (required)
  Type: string

- `input` (optional)
  Type: unknown

- `ctx` (optional)
  Type: object

## FeatureFlagsService_BatchEvaluateRequest

Type: object

Schema: [FeatureFlagsService_BatchEvaluateRequest](/api-reference/schemas/featureflagsservice-batchevaluaterequest-49691e6feb.md)

- `flags` (required)
  Type: array
  
  Items:
    Reference: [FeatureFlagsService_EvaluateRequest](/api-reference/schemas/featureflagsservice-evaluaterequest-7fe3d20a3e.md); Type: object

## FeatureFlagsService_BatchEvaluateResponse

Type: object

Schema: [FeatureFlagsService_BatchEvaluateResponse](/api-reference/schemas/featureflagsservice-batchevaluateresponse-947d9945a9.md)

- `results` (required)
  Type: array
  
  Items:
    Reference: [FeatureFlagsService_EvaluateResponse](/api-reference/schemas/featureflagsservice-evaluateresponse-67c5746a2d.md); Type: object

## FeatureFlagsService_EntitlementCatalogueItem

Type: object

Schema: [FeatureFlagsService_EntitlementCatalogueItem](/api-reference/schemas/featureflagsservice-entitlementcatalogueitem-00de5604a9.md)

- `key` (required)
  Type: string

- `source_key` (required)
  Type: string

- `name` (required)
  Type: string

- `type` (required)
  Type: string

- `unit` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `category` (required)
  Type: string

- `scope` (optional)
  Type: string
  
  default: "tenant"

- `reset_period` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `counting_rule` (required)
  Type: string

- `ui_label` (required)
  Type: string

- `upgrade_message` (required)
  Type: string

- `error_code` (required)
  Type: string

- `override_allowed` (optional)
  Type: boolean
  
  default: true

- `stale_acceptable` (optional)
  Type: boolean
  
  default: false

- `requires_role_permission` (optional)
  Type: boolean
  
  default: true

- `downgrade_policy` (required)
  Type: string

- `applicable_services` (required)
  Type: array
  
  Items:
    Type: string

## FeatureFlagsService_EntitlementCatalogueResponse

Type: object

Schema: [FeatureFlagsService_EntitlementCatalogueResponse](/api-reference/schemas/featureflagsservice-entitlementcatalogueresponse-db77f3cc05.md)

- `items` (required)
  Type: array
  
  Items:
    Reference: [FeatureFlagsService_EntitlementCatalogueItem](/api-reference/schemas/featureflagsservice-entitlementcatalogueitem-00de5604a9.md); Type: object

## FeatureFlagsService_EvaluateRequest

Type: object

Schema: [FeatureFlagsService_EvaluateRequest](/api-reference/schemas/featureflagsservice-evaluaterequest-7fe3d20a3e.md)

- `flag_key` (required)
  Type: string

- `context` (optional)
  Type: unknown
  
  anyOf:
    Type: object
    
    Additional properties: true
  
    Type: null

## FeatureFlagsService_EvaluateResponse

Type: object

Schema: [FeatureFlagsService_EvaluateResponse](/api-reference/schemas/featureflagsservice-evaluateresponse-67c5746a2d.md)

- `flag_key` (required)
  Type: string

- `value` (required)
  Type: unknown

- `is_enabled` (required)
  Type: boolean

- `matched_rule` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

## FeatureFlagsService_FlagCreateRequest

Type: object

Schema: [FeatureFlagsService_FlagCreateRequest](/api-reference/schemas/featureflagsservice-flagcreaterequest-7e586dac33.md)

- `key` (required)
  Type: string

- `name` (required)
  Type: string

- `description` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `flag_type` (optional)
  Type: string
  
  default: "boolean"

- `default_value` (optional)
  Type: unknown
  
  default: false

- `is_enabled` (optional)
  Type: boolean
  
  default: true

- `tags` (optional)
  Type: unknown
  
  anyOf:
    Type: array
    
    Items:
      Type: string
  
    Type: null

- `environment` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `plan_tier` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `feature_category` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

## FeatureFlagsService_FlagListResponse

Type: object

Schema: [FeatureFlagsService_FlagListResponse](/api-reference/schemas/featureflagsservice-flaglistresponse-3b98034a38.md)

- `items` (required)
  Type: array
  
  Items:
    Reference: [FeatureFlagsService_FlagResponse](/api-reference/schemas/featureflagsservice-flagresponse-0b1ca4f946.md); Type: object

- `total` (required)
  Type: integer

- `skip` (required)
  Type: integer

- `limit` (required)
  Type: integer

- `has_next` (required)
  Type: boolean

- `has_previous` (required)
  Type: boolean

## FeatureFlagsService_FlagResponse

Type: object

Schema: [FeatureFlagsService_FlagResponse](/api-reference/schemas/featureflagsservice-flagresponse-0b1ca4f946.md)

- `id` (required)
  Type: string

- `key` (required)
  Type: string

- `name` (required)
  Type: string

- `description` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `flag_type` (required)
  Type: string

- `default_value` (required)
  Type: unknown

- `is_enabled` (required)
  Type: boolean

- `is_archived` (required)
  Type: boolean

- `tags` (required)
  Type: array
  
  Items:
    Type: string

- `evaluation_count` (required)
  Type: integer

- `last_evaluated_at` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `created_at` (required)
  Type: string

- `updated_at` (required)
  Type: string

- `plan_tier` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `feature_category` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

## FeatureFlagsService_FlagUpdateRequest

Type: object

Schema: [FeatureFlagsService_FlagUpdateRequest](/api-reference/schemas/featureflagsservice-flagupdaterequest-57720e5cb6.md)

- `name` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `description` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `default_value` (optional)
  Type: unknown
  
  anyOf:
    Type: unknown
  
    Type: null

- `is_enabled` (optional)
  Type: unknown
  
  anyOf:
    Type: boolean
  
    Type: null

- `tags` (optional)
  Type: unknown
  
  anyOf:
    Type: array
    
    Items:
      Type: string
  
    Type: null

- `plan_tier` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `feature_category` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

## FeatureFlagsService_HTTPValidationError

Type: object

Schema: [FeatureFlagsService_HTTPValidationError](/api-reference/schemas/featureflagsservice-httpvalidationerror-323f73e647.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [FeatureFlagsService_ValidationError](/api-reference/schemas/featureflagsservice-validationerror-8a86fa3019.md); Type: object

## FeatureFlagsService_HealthResponseDTO

Type: object

Health check response model.

Schema: [FeatureFlagsService_HealthResponseDTO](/api-reference/schemas/featureflagsservice-healthresponsedto-bf7b7ed0b2.md)

- `status` (required)
  Type: string

- `service` (required)
  Type: string

- `version` (required)
  Type: string

- `timestamp` (required)
  Type: string, date-time

## FeatureFlagsService_InvalidateResponse

Type: object

Schema: [FeatureFlagsService_InvalidateResponse](/api-reference/schemas/featureflagsservice-invalidateresponse-0a5b67a609.md)

- `tenant_id` (required)
  Type: string

- `invalidated` (required)
  Type: boolean

- `message` (required)
  Type: string

## FeatureFlagsService_LimitItem

Type: object

Schema: [FeatureFlagsService_LimitItem](/api-reference/schemas/featureflagsservice-limititem-03bc0c04f8.md)

- `key` (required)
  Type: string

- `canonical_key` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `name` (required)
  Type: string

- `value` (required)
  Type: integer

- `category` (optional)
  Type: string
  
  default: "resource"

- `scope` (optional)
  Type: string
  
  default: "tenant"

- `reset_period` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `unlimited` (optional)
  Type: boolean
  
  default: false

- `custom_override` (optional)
  Type: boolean
  
  default: false

## FeatureFlagsService_PlanDto

Type: object

Schema: [FeatureFlagsService_PlanDto](/api-reference/schemas/featureflagsservice-plandto-c31934468f.md)

- `id` (required)
  Type: string

- `name` (required)
  Type: string

- `description` (required)
  Type: string

- `price_id` (required)
  Type: string

- `amount` (required)
  Type: number

- `currency` (required)
  Type: string

- `interval` (required)
  Type: string

- `features` (required)
  Type: array
  
  Items:
    Reference: [FeatureFlagsService_PlanFeatureDto](/api-reference/schemas/featureflagsservice-planfeaturedto-afc9543684.md); Type: object

- `limits` (optional)
  Type: array
  
  Items:
    Reference: [FeatureFlagsService_PlanLimitDto](/api-reference/schemas/featureflagsservice-planlimitdto-e61d1af0e6.md); Type: object

## FeatureFlagsService_PlanFeatureDto

Type: object

Schema: [FeatureFlagsService_PlanFeatureDto](/api-reference/schemas/featureflagsservice-planfeaturedto-afc9543684.md)

- `key` (required)
  Type: string

- `canonical_key` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `name` (required)
  Type: string

- `description` (required)
  Type: string

- `flag_type` (required)
  Type: string

- `value` (required)
  Type: unknown
  
  anyOf:
    Type: boolean
  
    Type: integer
  
    Type: string

- `category` (required)
  Type: string

- `unit` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `ui_label` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `upgrade_message` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `error_code` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `override_allowed` (optional)
  Type: boolean
  
  default: true

## FeatureFlagsService_PlanLimitDto

Type: object

Schema: [FeatureFlagsService_PlanLimitDto](/api-reference/schemas/featureflagsservice-planlimitdto-e61d1af0e6.md)

- `key` (required)
  Type: string

- `canonical_key` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `name` (required)
  Type: string

- `value` (required)
  Type: integer

- `category` (required)
  Type: string

- `scope` (required)
  Type: string

- `reset_period` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `unlimited` (optional)
  Type: boolean
  
  default: false

- `custom_override` (optional)
  Type: boolean
  
  default: false

- `unit` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `ui_label` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `counting_rule` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `upgrade_message` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `error_code` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `override_allowed` (optional)
  Type: boolean
  
  default: true

## FeatureFlagsService_PlanListResponse

Type: object

Schema: [FeatureFlagsService_PlanListResponse](/api-reference/schemas/featureflagsservice-planlistresponse-627f656d5c.md)

- `items` (required)
  Type: array
  
  Items:
    Reference: [FeatureFlagsService_PlanDto](/api-reference/schemas/featureflagsservice-plandto-c31934468f.md); Type: object

## FeatureFlagsService_TenantEntitlementsResponse

Type: object

Schema: [FeatureFlagsService_TenantEntitlementsResponse](/api-reference/schemas/featureflagsservice-tenantentitlementsresponse-e6fe4f0451.md)

- `tenant_id` (required)
  Type: string

- `tier` (required)
  Type: string

- `subscription_status` (required)
  Type: string

- `active` (required)
  Type: boolean

- `trial` (required)
  Type: boolean

- `trial_end_at` (optional)
  Type: unknown
  
  anyOf:
    Type: string
  
    Type: null

- `dormant` (required)
  Type: boolean

- `limits` (required)
  Type: array
  
  Items:
    Reference: [FeatureFlagsService_LimitItem](/api-reference/schemas/featureflagsservice-limititem-03bc0c04f8.md); Type: object

- `features` (required)
  Type: array
  
  Items:
    Type: object
    
    Additional properties: true

## FeatureFlagsService_TenantFeaturesResponse

Type: object

Schema: [FeatureFlagsService_TenantFeaturesResponse](/api-reference/schemas/featureflagsservice-tenantfeaturesresponse-5556aaa956.md)

- `items` (required)
  Type: array
  
  Items:
    Type: object
    
    Additional properties: true

- `tier` (required)
  Type: string

## FeatureFlagsService_TenantLimitsResponse

Type: object

Schema: [FeatureFlagsService_TenantLimitsResponse](/api-reference/schemas/featureflagsservice-tenantlimitsresponse-29dca159bc.md)

- `items` (required)
  Type: array
  
  Items:
    Type: object
    
    Additional properties: true

- `tier` (required)
  Type: string

- `tenant_id` (required)
  Type: string

## FeatureFlagsService_ValidationError

Type: object

Schema: [FeatureFlagsService_ValidationError](/api-reference/schemas/featureflagsservice-validationerror-8a86fa3019.md)

- `loc` (required)
  Type: array
  
  Items:
    Type: unknown
    
    anyOf:
      Type: string
    
      Type: integer

- `msg` (required)
  Type: string

- `type` (required)
  Type: string

- `input` (optional)
  Type: unknown

- `ctx` (optional)
  Type: object

## QuotaService_CheckLimitRequest

Type: object

Request to check quota availability.

Schema: [QuotaService_CheckLimitRequest](/api-reference/schemas/quotaservice-checklimitrequest-07b483f81a.md)

- `limit_type` (required)
  Type: string
  
  Type of limit (e.g., 'surveys')

- `amount` (optional)
  Type: integer
  
  Amount to check
  
  default: 1
  
  minimum: 1

## QuotaService_ConsumeQuotaRequest

Type: object

Request to consume quota.

Schema: [QuotaService_ConsumeQuotaRequest](/api-reference/schemas/quotaservice-consumequotarequest-18a33820bc.md)

- `limit_type` (required)
  Type: string
  
  Type of limit

- `amount` (optional)
  Type: integer
  
  Amount to consume
  
  default: 1
  
  minimum: 1

- `idempotency_key` (optional)
  Type: unknown
  
  Tenant-scoped usage idempotency key
  
  anyOf:
    Type: string
    
    maxLength: 255
  
    Type: null

## QuotaService_HTTPValidationError

Type: object

Schema: [QuotaService_HTTPValidationError](/api-reference/schemas/quotaservice-httpvalidationerror-ee21a36cae.md)

- `detail` (optional)
  Type: array
  
  Items:
    Reference: [QuotaService_ValidationError](/api-reference/schemas/quotaservice-validationerror-b3c616c755.md); Type: object

## QuotaService_QuotaResponse

Type: object

Response from quota operations.

Schema: [QuotaService_QuotaResponse](/api-reference/schemas/quotaservice-quotaresponse-8cc523fb43.md)

- `success` (required)
  Type: boolean

- `allowed` (required)
  Type: boolean

- `current` (required)
  Type: integer

- `limit` (required)
  Type: integer

- `remaining` (required)
  Type: integer

- `reset_at` (optional)
  Type: unknown
  
  anyOf:
    Type: string, date-time
  
    Type: null

- `unlimited` (optional)
  Type: boolean
  
  default: false

## QuotaService_RollbackRequest

Type: object

Request to rollback quota.

Schema: [QuotaService_RollbackRequest](/api-reference/schemas/quotaservice-rollbackrequest-c6f2bbc3ff.md)

- `limit_type` (required)
  Type: string
  
  Type of limit

- `amount` (optional)
  Type: integer
  
  Amount to rollback
  
  default: 1
  
  minimum: 1

## QuotaService_ValidationError

Type: object

Schema: [QuotaService_ValidationError](/api-reference/schemas/quotaservice-validationerror-b3c616c755.md)

- `loc` (required)
  Type: array
  
  Items:
    Type: unknown
    
    anyOf:
      Type: string
    
      Type: integer

- `msg` (required)
  Type: string

- `type` (required)
  Type: string

- `input` (optional)
  Type: unknown

- `ctx` (optional)
  Type: object
