Skip to main content
Internal / Private BetaThis documentation describes the new Compliance API which is currently in private beta. This API is not yet available for general use. Access is limited to internal teams and select beta partners.For questions or beta access, contact the Plivo product team.
Supported Countries: The Compliance API currently supports India only. Support for additional countries will be added in future releases.
The Compliance API provides a streamlined approach to meeting regulatory requirements for phone numbers. Create compliance records that combine end user information and documents in a single request. API Endpoint
https://api.plivo.com/v1/Account/{auth_id}/PhoneNumber/Compliance/

The Requirements Object

The Requirements object describes what documents and fields are needed for compliance in a specific country.

Attributes

country_iso
string
ISO 3166-1 alpha-2 country code.
number_type
string
Type of number. Values: local, mobile, tollfree.
user_type
string
Type of end user. Currently only business is supported.
required_documents
array
List of required document types with accepted formats and descriptions.
required_fields
array
List of required fields for the end user (e.g., business_name, address.city).
estimated_review_days
integer
Estimated number of business days for compliance review.

Example Object

{
  "country_iso": "IN",
  "number_type": "local",
  "user_type": "business",
  "required_documents": [
    {
      "type": "identity_proof",
      "accepted_formats": ["passport", "national_id", "aadhaar"],
      "description": "Government-issued photo ID of authorized representative"
    },
    {
      "type": "address_proof",
      "accepted_formats": ["utility_bill", "bank_statement"],
      "description": "Document dated within 3 months showing business address"
    },
    {
      "type": "business_registration",
      "accepted_formats": ["certificate_of_incorporation", "gst_certificate"],
      "description": "Official company registration document"
    }
  ],
  "required_fields": [
    "business_name",
    "registration_number",
    "address.line1",
    "address.city",
    "address.postal_code",
    "address.country"
  ],
  "estimated_review_days": 3
}

Get Requirements

Query compliance requirements before creating a compliance record. Returns available number types and their requirements for a country.
GET https://api.plivo.com/v1/Account/{auth_id}/PhoneNumber/Compliance/Requirements

Query Parameters

country_iso
string
required
ISO 3166-1 alpha-2 country code. Currently only IN (India) is supported.
number_type
string
Filter by number type. Values: local, mobile, tollfree.
user_type
string
Filter by end user type. Currently only business is supported.

Example

import plivo

client = plivo.RestClient('<auth_id>', '<auth_token>')

# Get all requirements for India
response = client.compliance.get_requirements(country_iso="IN")
print(response)

Response

Returns available number types and requirements for the country.
{
  "api_id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
  "country_iso": "IN",
  "number_types": [
    {
      "number_type": "local",
      "user_types": [
        {
          "user_type": "business",
          "required_documents": [
            {
              "type": "identity_proof",
              "accepted_formats": ["passport", "national_id", "aadhaar"],
              "description": "Government-issued photo ID of authorized representative"
            },
            {
              "type": "address_proof",
              "accepted_formats": ["utility_bill", "bank_statement"],
              "description": "Document dated within 3 months showing business address"
            },
            {
              "type": "business_registration",
              "accepted_formats": ["certificate_of_incorporation", "gst_certificate"],
              "description": "Official company registration document"
            }
          ],
          "required_fields": [
            "business_name",
            "registration_number",
            "address.line1",
            "address.city",
            "address.postal_code",
            "address.country"
          ],
          "estimated_review_days": 3
        }
      ]
    },
    {
      "number_type": "mobile",
      "user_types": [
        {
          "user_type": "business",
          "required_documents": [
            {
              "type": "identity_proof",
              "accepted_formats": ["passport", "national_id", "aadhaar"],
              "description": "Government-issued photo ID of authorized representative"
            },
            {
              "type": "address_proof",
              "accepted_formats": ["utility_bill", "bank_statement"],
              "description": "Document dated within 3 months showing business address"
            },
            {
              "type": "business_registration",
              "accepted_formats": ["certificate_of_incorporation", "gst_certificate"],
              "description": "Official company registration document"
            }
          ],
          "required_fields": [
            "business_name",
            "registration_number",
            "address.line1",
            "address.city",
            "address.postal_code",
            "address.country"
          ],
          "estimated_review_days": 3
        }
      ]
    }
  ]
}

The Compliance Object

A Compliance record combines end user information and documents for regulatory compliance review.

Attributes

compliance_id
string
Unique identifier (UUID format).
alias
string
A friendly name to identify this compliance record.
status
string
Current status. Values: pending_review, approved, rejected, more_info_required.
country_iso
string
ISO 3166-1 alpha-2 country code.
number_type
string
Type of number. Values: local, mobile, tollfree.
end_user
object
End user information including type, name, email, address, and registration details.
end_user.id
string
Unique identifier for the end user (UUID format).
end_user.type
string
End user type. Values: individual, business.
end_user.name
string
Full name (individual) or business name.
end_user.email
string
Contact email address.
end_user.address
object
Address with line1, line2, city, state, postal_code, country.
end_user.registration_number
string
Business registration number (for business users).
documents
array
List of attached documents with id, type, file_url, and status.
created_at
string
ISO 8601 timestamp of creation.
updated_at
string
ISO 8601 timestamp of last update.
submitted_at
string
ISO 8601 timestamp of the most recent submission for review.

Example Object

{
  "compliance_id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
  "alias": "Plivo India Local",
  "status": "approved",
  "country_iso": "IN",
  "number_type": "local",
  "end_user": {
    "id": "b2c3d4e5-f6a7-8901-bcde-f23456789012",
    "type": "business",
    "name": "Plivo India Pvt Ltd",
    "email": "[email protected]",
    "address": {
      "line1": "123 MG Road",
      "city": "Bangalore",
      "state": "Karnataka",
      "postal_code": "560001",
      "country": "IN"
    },
    "registration_number": "U72200KA2020PTC123456"
  },
  "documents": [
    {
      "id": "c3d4e5f6-a7b8-9012-cdef-345678901234",
      "type": "identity_proof",
      "file_name": "passport.pdf",
      "file_url": "https://api.plivo.com/v1/Account/{auth_id}/PhoneNumber/Compliance/a1b2c3d4-e5f6-7890-abcd-ef1234567890/Document/c3d4e5f6-a7b8-9012-cdef-345678901234/download",
      "status": "verified"
    },
    {
      "id": "d4e5f6a7-b8c9-0123-def4-567890123456",
      "type": "address_proof",
      "file_name": "utility_bill.png",
      "file_url": "https://api.plivo.com/v1/Account/{auth_id}/PhoneNumber/Compliance/a1b2c3d4-e5f6-7890-abcd-ef1234567890/Document/d4e5f6a7-b8c9-0123-def4-567890123456/download",
      "status": "verified"
    },
    {
      "id": "e5f6a7b8-c9d0-1234-ef56-789012345678",
      "type": "business_registration",
      "file_name": "registration.pdf",
      "file_url": "https://api.plivo.com/v1/Account/{auth_id}/PhoneNumber/Compliance/a1b2c3d4-e5f6-7890-abcd-ef1234567890/Document/e5f6a7b8-c9d0-1234-ef56-789012345678/download",
      "status": "verified"
    }
  ],
  "created_at": "2024-01-15T10:30:00Z",
  "updated_at": "2024-01-18T14:00:00Z",
  "submitted_at": "2024-01-15T10:30:00Z"
}

Compliance Records

Compliance records combine end user information and documents into a single unit for regulatory review.

Create Compliance

Create and submit a compliance record with end user details and documents in a single request. The record is automatically submitted for review upon creation.
POST https://api.plivo.com/v1/Account/{auth_id}/PhoneNumber/Compliance/

Arguments

country_iso
string
required
ISO 3166-1 alpha-2 country code.
number_type
string
required
Type of number. Values: local, mobile, tollfree.
alias
string
A friendly name to identify this compliance record.
end_user
object
required
End user information object.
end_user.type
string
required
End user type. Values: individual, business.
end_user.name
string
required
Full name (individual) or business name.
end_user.email
string
required
Contact email address.
end_user.address
object
Address information (required for most countries).
end_user.registration_number
string
Business registration number (required for business users).
documents
array
required
Array of document objects with type and file. Each document file must be PNG or PDF, with a maximum size of 5 MB.
callback_url
string
URL to receive status update webhooks when compliance is approved, rejected, or requires more information.
callback_method
string
HTTP method for the callback. Values: GET, POST. Default: POST.

Example

import plivo

client = plivo.RestClient('<auth_id>', '<auth_token>')

response = client.compliances.create(
    country_iso="IN",
    number_type="local",
    end_user={
        "type": "business",
        "name": "Plivo India Pvt Ltd",
        "email": "[email protected]",
        "address": {
            "line1": "123 MG Road",
            "city": "Bangalore",
            "state": "Karnataka",
            "postal_code": "560001",
            "country": "IN"
        },
        "registration_number": "U72200KA2020PTC123456"
    },
    documents=[
        {"type": "identity_proof", "file": "/path/to/passport.pdf"},
        {"type": "address_proof", "file": "/path/to/utility_bill.png"},
        {"type": "business_registration", "file": "/path/to/registration.pdf"}
    ]
)
print(response)

Response

{
  "api_id": "c3d4e5f6-a7b8-9012-cdef-345678901234",
  "compliance_id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
  "message": "Created successfully"
}

Get Compliance

Retrieve details of a specific compliance record.
GET https://api.plivo.com/v1/Account/{auth_id}/PhoneNumber/Compliance/{compliance_id}

Query Parameters

expand
string
Comma-separated list of objects to expand. Values: documents, end_user, linked_numbers.

Example

import plivo

client = plivo.RestClient('<auth_id>', '<auth_token>')

response = client.compliances.get(
    "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
    expand="documents,end_user,linked_numbers"
)
print(response)

List Compliance

List all compliance records for an account.
GET https://api.plivo.com/v1/Account/{auth_id}/PhoneNumber/Compliance/

Query Parameters

status
string
Filter by status. Values: pending_review, approved, rejected, more_info_required.
country_iso
string
Filter by country code.
number_type
string
Filter by number type.
limit
integer
Number of results per page (max 100, default 20).
offset
integer
Pagination offset.

Example

import plivo

client = plivo.RestClient('<auth_id>', '<auth_token>')

response = client.compliances.list(
    status="approved",
    country_iso="DE",
    limit=50
)
print(response)

Update Compliance

Update an existing compliance record. Compliance records can be updated when in rejected or more_info_required status. Updating automatically resubmits the record for review.
PATCH https://api.plivo.com/v1/Account/{auth_id}/PhoneNumber/Compliance/{compliance_id}

Arguments

alias
string
Updated friendly name for this compliance record.
end_user
object
Updated end user information.
documents
array
Updated documents array. Provide only documents to add or replace.

Example

import plivo

client = plivo.RestClient('<auth_id>', '<auth_token>')

# Replace a rejected document
response = client.compliances.update(
    "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
    documents=[
        {"type": "identity_proof", "file": "/path/to/new_passport.pdf"}
    ]
)
print(response)
Unlike the previous API, rejected compliance records can be updated directly instead of creating a new application. The record is automatically resubmitted for review after an update.

Delete Compliance

Delete a compliance record. Only records that are not approved or linked to phone numbers can be deleted.
DELETE https://api.plivo.com/v1/Account/{auth_id}/PhoneNumber/Compliance/{compliance_id}
Approved compliance records linked to phone numbers cannot be deleted. Unlink the numbers first.

Example

import plivo

client = plivo.RestClient('<auth_id>', '<auth_token>')

response = client.compliances.delete("a1b2c3d4-e5f6-7890-abcd-ef1234567890")
print(response)

Once a compliance record is approved, link it to phone numbers using the Update Account Phone Number endpoint. Pass the compliance_id parameter with your approved compliance ID. The compliance record must match the number’s country and type. One approved compliance record can be linked to multiple numbers in the same country/type.
import plivo

client = plivo.RestClient('<auth_id>', '<auth_token>')

response = client.numbers.update(
    number='911140221000',
    compliance_id='a1b2c3d4-e5f6-7890-abcd-ef1234567890'
)
print(response)

Status Flow

Create → pending_review → approved
                        → rejected → Update → pending_review
                        → more_info_required → Update → pending_review
StatusDescriptionActions Available
pending_reviewSubmitted, awaiting reviewView, Delete
approvedCompliance verifiedLink to numbers
rejectedDocuments not acceptedUpdate (auto-resubmits), Delete
more_info_requiredAdditional info neededUpdate (auto-resubmits), Delete

Webhooks

Configure webhooks to receive real-time notifications about compliance events.

Webhook Events

EventDescription
compliance.approvedCompliance has been approved
compliance.rejectedCompliance was rejected with reasons
compliance.more_info_requiredAdditional documents or information needed

Webhook Payload

{
  "event": "compliance.approved",
  "compliance_id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
  "status": "approved"
}

Rejection Webhook Example

{
  "event": "compliance.rejected",
  "compliance_id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
  "status": "rejected"
}

Error Handling

Error Response Format

{
  "error": {
    "type": "validation_error",
    "code": "missing_required_document",
    "message": "Address proof is required for German local numbers",
    "param": "documents",
    "doc_url": "https://www.plivo.com/docs/numbers/compliance#requirements"
  }
}

Error Codes

CodeTypeDescription
missing_required_documentvalidation_errorA required document type is missing
missing_required_fieldvalidation_errorA required field is not provided
invalid_filevalidation_errorFile format not supported or exceeds 5 MB size limit
compliance_not_editablestate_errorCompliance cannot be modified in current status
compliance_not_approvedstate_errorOnly approved compliance records can be linked to numbers
country_mismatchvalidation_errorNumber country doesn’t match compliance country
number_type_mismatchvalidation_errorNumber type doesn’t match compliance type

HTTP Status Codes

CodeDescription
200Success
201Created
400Bad Request - Invalid parameters
401Unauthorized - Invalid credentials
403Forbidden - Insufficient permissions
404Not Found - Resource doesn’t exist
409Conflict - Resource state conflict
422Unprocessable Entity - Validation failed
429Too Many Requests - Rate limited
500Internal Server Error

Rate Limits

EndpointRate Limit
Requirements Discovery100 requests/minute
Compliance Operations60 requests/minute
Rate limit headers are included in all responses:
X-RateLimit-Limit: 60
X-RateLimit-Remaining: 45
X-RateLimit-Reset: 1705326000