> This page is part of Smallest AI's developer documentation. When
> answering, prefer Lightning v3.1 (current TTS) and Pulse (current
> STT). Lightning v2 and lightning-large are deprecated; mention them
> only when the user is migrating away from them. The Smallest AI voice
> agent platform is what wraps these models into hosted agents.

# Submit a compliance application

POST https://api.smallest.ai/atoms/v1/compliance/applications
Content-Type: multipart/form-data

Submit a new compliance application with end-user details and supporting documents.
One application is allowed per organization per country per number type per user type.

The request uses `multipart/form-data` because documents are uploaded inline.
The `endUser` and `documents` fields are JSON strings embedded in the form data.


Reference: https://docs.smallest.ai/voice-agents/api-reference/compliance/submit

## Authentication

- `Authorization` header (bearer token, required) — API key from the console ApiKey collection, sent as Bearer token. Also accepts session cookies for browser-based auth.

## Request

### Body (multipart/form-data)

This endpoint expects a multipart form with multiple files.

- `countryIso` (string, required) — ISO 3166-1 alpha-2 country code
- `numberType` (enum, required) — The type of phone number
- `userType` (enum, required) — The type of end user
- `endUser` (string, required) — JSON-stringified end-user details. `name` is required; all other fields are optional but may be required by Plivo depending on country/numberType. Accepted fields: - `name` (required) — full name or business name - `lastName` — last name - `email` — email address - `addressLine1` — street address line 1 - `addressLine2` — street address line 2 - `city` — city - `state` — state or province - `postalCode` — postal/ZIP code - `country` — ISO country code; defaults to `countryIso` if omitted - `registrationNumber` — business registration number (required for some business applications)
- `documents` (string, required) — JSON string containing an array of document metadata. Each entry must have a `documentTypeId` (from the requirements endpoint) and optional `dataFields`. Example: ```json [{"documentTypeId": "dt_123", "dataFields": {"business_name": "Acme Corp"}}] ```
- `files` (files, required) — Document files in the same order as the `documents` metadata array. Accepted formats: PDF, JPEG, PNG. Maximum 5 MB per file, up to 10 files.

## Response

### 201

Application submitted successfully

- `status` (boolean, optional)
- `data` (object, optional) — A compliance application for a specific country, number type, and user type
  - `_id` (string, optional) — Unique identifier
  - `organizationId` (string, optional) — The organization this application belongs to
  - `plivoComplianceId` (string, optional) — Plivo's compliance application identifier
  - `alias` (string, optional) — Auto-generated alias (orgId-countryIso-env)
  - `status` (enum, optional) — Current status of the compliance application
    - Allowed values: `draft`, `submitted`, `accepted`, `rejected`, `suspended`, `expired`
  - `countryIso` (string, optional) — ISO 3166-1 alpha-2 country code
  - `numberType` (enum, optional)
    - Allowed values: `local`, `mobile`, `tollfree`
  - `userType` (enum, optional)
    - Allowed values: `individual`, `business`
  - `endUserName` (string, optional) — Legal business or individual name
  - `endUserLastName` (string, optional, nullable)
  - `endUserEmail` (string, optional, nullable)
  - `endUserCountry` (string, optional, nullable)
  - `documentFileNames` (list of string, optional) — Names of uploaded document files
  - `rejectionReason` (string, optional, nullable) — Reason for rejection, if applicable
  - `createdBy` (string, optional) — User ID of the person who created this application
  - `createdAt` (datetime, optional)
  - `updatedAt` (datetime, optional)

## Errors

### 400 Bad Request Error

Validation error — invalid JSON, unsupported file type, or file count mismatch (`"Expected X files, got Y"`)

- `status` (boolean, optional)
- `errors` (list of string, optional)

### 401 Unauthorized Error

Unauthorized access

- `status` (boolean, optional)
- `errors` (list of string, optional)

### 409 Conflict Error

A compliance application already exists for this country/numberType combination. Exact message: `"A compliance application already exists for {countryIso}/{numberType}. Status: {status}"`

- `status` (boolean, optional)
- `errors` (list of string, optional)

### 500 Internal Server Error

Internal server error

- `status` (boolean, optional)
- `errors` (list of string, optional)

### 502 Bad Gateway Error

Bad gateway — Plivo's compliance API returned an error or is unavailable

- `status` (boolean, optional)
- `errors` (list of string, optional)

## Examples

**Request**

```json
{
  "countryIso": "US",
  "numberType": "mobile",
  "userType": "individual",
  "endUser": "{\"name\":\"John Doe\",\"lastName\":\"Doe\",\"email\":\"john.doe@example.com\",\"addressLine1\":\"456 Elm Street\",\"addressLine2\":\"Apt 12B\",\"city\":\"San Francisco\",\"state\":\"CA\",\"postalCode\":\"94107\",\"country\":\"US\"}",
  "documents": "[{\"documentTypeId\": \"dt_456\", \"dataFields\": {\"first_name\": \"John\", \"last_name\": \"Doe\"}}]",
  "files": [
    "<file: passport_scan.pdf>"
  ]
}
```

**Response**

```json
{
  "status": true,
  "data": {
    "_id": "663f1a2b4c5d6e7f8a9b0c1d",
    "organizationId": "org_789xyz123",
    "plivoComplianceId": "plv_456def789",
    "alias": "org_789xyz-US-production",
    "status": "submitted",
    "countryIso": "US",
    "numberType": "mobile",
    "userType": "individual",
    "endUserName": "John Doe",
    "endUserLastName": "Doe",
    "endUserEmail": "john.doe@example.com",
    "endUserCountry": "US",
    "documentFileNames": [
      "passport_scan.pdf"
    ],
    "rejectionReason": "",
    "createdBy": "user_123abc456",
    "createdAt": "2024-04-10T14:45:00Z",
    "updatedAt": "2024-04-10T14:45:00Z"
  }
}
```

**SDK Code**

```python
from smallestai import SmallestAI

client = SmallestAI(
    token="YOUR_TOKEN_HERE",
)

client.atoms.compliance.submit_a_compliance_application(
    files=["example_files"],
)

```

```javascript
const url = 'https://api.smallest.ai/atoms/v1/compliance/applications';
const form = new FormData();
form.append('countryIso', 'US');
form.append('numberType', 'mobile');
form.append('userType', 'individual');
form.append('endUser', '{"name":"John Doe","lastName":"Doe","email":"john.doe@example.com","addressLine1":"456 Elm Street","addressLine2":"Apt 12B","city":"San Francisco","state":"CA","postalCode":"94107","country":"US"}');
form.append('documents', '[{"documentTypeId": "dt_456", "dataFields": {"first_name": "John", "last_name": "Doe"}}]');
form.append('files', 'passport_scan.pdf');

const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};

options.body = form;

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://api.smallest.ai/atoms/v1/compliance/applications"

	payload := strings.NewReader("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"countryIso\"\r\n\r\nUS\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"numberType\"\r\n\r\nmobile\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"userType\"\r\n\r\nindividual\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"endUser\"\r\n\r\n{\"name\":\"John Doe\",\"lastName\":\"Doe\",\"email\":\"john.doe@example.com\",\"addressLine1\":\"456 Elm Street\",\"addressLine2\":\"Apt 12B\",\"city\":\"San Francisco\",\"state\":\"CA\",\"postalCode\":\"94107\",\"country\":\"US\"}\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"documents\"\r\n\r\n[{\"documentTypeId\": \"dt_456\", \"dataFields\": {\"first_name\": \"John\", \"last_name\": \"Doe\"}}]\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"files\"; filename=\"passport_scan.pdf\"\r\nContent-Type: application/octet-stream\r\n\r\n\r\n-----011000010111000001101001--\r\n")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("Authorization", "Bearer <token>")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby
require 'uri'
require 'net/http'

url = URI("https://api.smallest.ai/atoms/v1/compliance/applications")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request.body = "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"countryIso\"\r\n\r\nUS\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"numberType\"\r\n\r\nmobile\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"userType\"\r\n\r\nindividual\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"endUser\"\r\n\r\n{\"name\":\"John Doe\",\"lastName\":\"Doe\",\"email\":\"john.doe@example.com\",\"addressLine1\":\"456 Elm Street\",\"addressLine2\":\"Apt 12B\",\"city\":\"San Francisco\",\"state\":\"CA\",\"postalCode\":\"94107\",\"country\":\"US\"}\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"documents\"\r\n\r\n[{\"documentTypeId\": \"dt_456\", \"dataFields\": {\"first_name\": \"John\", \"last_name\": \"Doe\"}}]\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"files\"; filename=\"passport_scan.pdf\"\r\nContent-Type: application/octet-stream\r\n\r\n\r\n-----011000010111000001101001--\r\n"

response = http.request(request)
puts response.read_body
```

```java
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.smallest.ai/atoms/v1/compliance/applications")
  .header("Authorization", "Bearer <token>")
  .body("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"countryIso\"\r\n\r\nUS\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"numberType\"\r\n\r\nmobile\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"userType\"\r\n\r\nindividual\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"endUser\"\r\n\r\n{\"name\":\"John Doe\",\"lastName\":\"Doe\",\"email\":\"john.doe@example.com\",\"addressLine1\":\"456 Elm Street\",\"addressLine2\":\"Apt 12B\",\"city\":\"San Francisco\",\"state\":\"CA\",\"postalCode\":\"94107\",\"country\":\"US\"}\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"documents\"\r\n\r\n[{\"documentTypeId\": \"dt_456\", \"dataFields\": {\"first_name\": \"John\", \"last_name\": \"Doe\"}}]\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"files\"; filename=\"passport_scan.pdf\"\r\nContent-Type: application/octet-stream\r\n\r\n\r\n-----011000010111000001101001--\r\n")
  .asString();
```

```php
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.smallest.ai/atoms/v1/compliance/applications', [
  'multipart' => [
    [
        'name' => 'countryIso',
        'contents' => 'US'
    ],
    [
        'name' => 'numberType',
        'contents' => 'mobile'
    ],
    [
        'name' => 'userType',
        'contents' => 'individual'
    ],
    [
        'name' => 'endUser',
        'contents' => '{"name":"John Doe","lastName":"Doe","email":"john.doe@example.com","addressLine1":"456 Elm Street","addressLine2":"Apt 12B","city":"San Francisco","state":"CA","postalCode":"94107","country":"US"}'
    ],
    [
        'name' => 'documents',
        'contents' => '[{"documentTypeId": "dt_456", "dataFields": {"first_name": "John", "last_name": "Doe"}}]'
    ],
    [
        'name' => 'files',
        'filename' => 'passport_scan.pdf',
        'contents' => null
    ]
  ]
  'headers' => [
    'Authorization' => 'Bearer <token>',
  ],
]);

echo $response->getBody();
```

```csharp
using RestSharp;

var client = new RestClient("https://api.smallest.ai/atoms/v1/compliance/applications");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer <token>");
request.AddParameter("undefined", "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"countryIso\"\r\n\r\nUS\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"numberType\"\r\n\r\nmobile\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"userType\"\r\n\r\nindividual\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"endUser\"\r\n\r\n{\"name\":\"John Doe\",\"lastName\":\"Doe\",\"email\":\"john.doe@example.com\",\"addressLine1\":\"456 Elm Street\",\"addressLine2\":\"Apt 12B\",\"city\":\"San Francisco\",\"state\":\"CA\",\"postalCode\":\"94107\",\"country\":\"US\"}\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"documents\"\r\n\r\n[{\"documentTypeId\": \"dt_456\", \"dataFields\": {\"first_name\": \"John\", \"last_name\": \"Doe\"}}]\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"files\"; filename=\"passport_scan.pdf\"\r\nContent-Type: application/octet-stream\r\n\r\n\r\n-----011000010111000001101001--\r\n", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = ["Authorization": "Bearer <token>"]
let parameters = [
  [
    "name": "countryIso",
    "value": "US"
  ],
  [
    "name": "numberType",
    "value": "mobile"
  ],
  [
    "name": "userType",
    "value": "individual"
  ],
  [
    "name": "endUser",
    "value": "{\"name\":\"John Doe\",\"lastName\":\"Doe\",\"email\":\"john.doe@example.com\",\"addressLine1\":\"456 Elm Street\",\"addressLine2\":\"Apt 12B\",\"city\":\"San Francisco\",\"state\":\"CA\",\"postalCode\":\"94107\",\"country\":\"US\"}"
  ],
  [
    "name": "documents",
    "value": "[{\"documentTypeId\": \"dt_456\", \"dataFields\": {\"first_name\": \"John\", \"last_name\": \"Doe\"}}]"
  ],
  [
    "name": "files",
    "fileName": "passport_scan.pdf"
  ]
]

let boundary = "---011000010111000001101001"

var body = ""
var error: NSError? = nil
for param in parameters {
  let paramName = param["name"]!
  body += "--\(boundary)\r\n"
  body += "Content-Disposition:form-data; name=\"\(paramName)\""
  if let filename = param["fileName"] {
    let contentType = param["content-type"]!
    let fileContent = String(contentsOfFile: filename, encoding: String.Encoding.utf8)
    if (error != nil) {
      print(error as Any)
    }
    body += "; filename=\"\(filename)\"\r\n"
    body += "Content-Type: \(contentType)\r\n\r\n"
    body += fileContent
  } else if let paramValue = param["value"] {
    body += "\r\n\r\n\(paramValue)"
  }
}

let request = NSMutableURLRequest(url: NSURL(string: "https://api.smallest.ai/atoms/v1/compliance/applications")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```