Skip to main content

Base URLs

  • Production: https://api.revrag.ai
  • Staging: https://staging-api.revrag.ai

Authentication

All API requests require an API key to be included in the request headers:
X-API-Key: YOUR_API_KEY

Single Trigger APIs

๐Ÿš€ Quick Start: Want to test these APIs immediately? Check out our Postman Collection with all endpoints pre-configured and ready to import!

1. Get All Agents

GET /v1/campaigns/agents Get All Agents

Header Parameters

ParameterTypeRequiredDescription
X-API-KeystringYesAPI Key for authentication

Response

Success (200 OK)
[
  {
    "id": "agent_123e4567-e89b-12d3-a456-426614174000",
    "name": "customer-support-agent",
    "variables": [
      {
        "name": "customer_name",
        "type": "string",
        "default_value": null
      }
    ]
  }
]

cURL Example

curl -X GET "https://staging-api.revrag.ai/v1/campaigns/agents" \
  -H "X-API-Key: YOUR_API_KEY"

2. Trigger Single Call

POST /v1/campaigns/trigger/single Trigger a single AI call for testing purposes.

Header Parameters

ParameterTypeRequiredDescription
X-API-KeystringYesAPI Key for authentication

Request Body

{
  "agent_id": "agent_123e4567-e89b-12d3-a456-426614174000",
  "to_phone_number": "+1234567890",
  "variable_fields": {
    "first_name": "John",
    "company": "Acme Inc."
  },
  "custom_metadata": {
    "campaign_type": "follow_up",
    "source": "web_form",
    "priority": "high"
  }
}

Request Parameters

ParameterTypeRequiredDescription
agent_idstring (uuid)YesThe ID of the agent
to_phone_numberstringYesRecipient phone number
variable_fieldsobject or nullNoVariable fields for the call
custom_metadataobject or nullNoCustom metadata fields for tracking and organization. This field is flexible and can accept any key-value pairs

Response

Success (200 OK)
{
  "success": true,
  "message": "Call triggered successfully",
  "to_phone_number": "+1234567890",
  "agent_id": "agent_123e4567-e89b-12d3-a456-426614174000",
  "call_id": "call_456e7890-f12c-34d5-b678-901234567890"
}

cURL Example

curl -X POST "https://staging-api.revrag.ai/v1/campaigns/trigger/single" \
  -H "X-API-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "agent_id": "agent_123e4567-e89b-12d3-a456-426614174000",
    "to_phone_number": "+1234567890",
    "variable_fields": {
      "first_name": "John",
      "company": "Acme Inc."
    },
    "custom_metadata": {
      "campaign_type": "follow_up",
      "source": "web_form",
      "priority": "high"
    }
  }'
Validation Error (422)
{
  "detail": [
    {
      "loc": ["body", "to_phone_number"],
      "msg": "Invalid phone number format",
      "type": "value_error"
    }
  ]
}

3. Get Call Status

GET /v1/campaigns/trigger/status/{call_id} Get the status of a specific call by its call_id.

Path Parameters

ParameterTypeRequiredDescription
call_idstring (uuid)YesThe ID of the call

Header Parameters

ParameterTypeRequiredDescription
X-API-KeystringYesAPI Key for authentication

Response

Success (200 OK)
{
  "call_status": "ENDED",
  "call_id": "call_123e4567-e89b-12d3-a456-426614174000",
  "agent_id": "agent_456e7890-f12c-34d5-b678-901234567890",
  "from_number": "+918045342561",
  "to_number": "+1234567890",
  "summary": "Customer inquired about pricing options for our services. Discussed various pricing tiers and provided information about premium features. Customer showed interest in upgrading their current plan.",
  "start_time": "2024-01-15T10:00:00.000000",
  "end_time": "2024-01-15T10:15:30.500000",
  "duration": 930.5,
  "recording_url": "https://cdn.revrag.ai/voice/recordings/room_abc123def456/room_abc123def456_audio.mp4",
  "transcription": {
    "messages": [
      {
        "role": "assistant",
        "content": "Hello, this is Sarah from Customer Support. Am I speaking with John?",
        "timestamp": "2024-01-15T10:00:15.000000+00:00"
      },
      {
        "role": "user",
        "content": "Yes, this is John speaking.",
        "timestamp": "2024-01-15T10:00:25.000000+00:00"
      },
      {
        "role": "assistant",
        "content": "Great! I'm calling to follow up on your recent inquiry about our services.",
        "timestamp": "2024-01-15T10:00:35.000000+00:00"
      },
      {
        "role": "user",
        "content": "Yes, I was interested in learning more about the pricing options.",
        "timestamp": "2024-01-15T10:00:50.000000+00:00"
      }
    ]
  },
  "custom_variables": [
    {
      "key": "customer_tier",
      "description": "Customer subscription tier level",
      "value": "premium",
      "type": "string"
    },
    {
      "key": "account_balance",
      "description": "Current account balance in USD",
      "value": 1250.75,
      "type": "number"
    },
    {
      "key": "is_first_time_caller",
      "description": "Whether this is the customer's first call",
      "value": false,
      "type": "boolean"
    }
  ],
  "disconnection_reason": "USER_HANGUP"
}

cURL Example

curl -X GET "https://staging-api.revrag.ai/v1/campaigns/trigger/status/call_123e4567-e89b-12d3-a456-426614174000" \
  -H "X-API-Key: YOUR_API_KEY"

4. Webhook Notifications (Optional)

Instead of polling the call status endpoint, you can configure a webhook URL to receive real-time call completion notifications. When a call ends, weโ€™ll automatically send the same response body structure as the โ€œGet Call Statusโ€ API to your webhook endpoint.

Webhook Configuration

Contact our support team at contact@revrag.ai to configure your webhook URL.

Webhook Payload

The webhook will receive a POST request with the same JSON structure as the call status response:
{
  "call_status": "ENDED",
  "call_id": "call_123e4567-e89b-12d3-a456-426614174000",
  "agent_id": "agent_456e7890-f12c-34d5-b678-901234567890",
  "from_number": "+918045342561",
  "to_number": "+1234567890",
  "summary": "Customer inquired about pricing options for our services. Discussed various pricing tiers and provided information about premium features. Customer showed interest in upgrading their current plan.",
  "start_time": "2024-01-15T10:00:00.000000",
  "end_time": "2024-01-15T10:15:30.500000",
  "duration": 930.5,
  "recording_url": "https://cdn.revrag.ai/voice/recordings/room_abc123def456/room_abc123def456_audio.mp4",
  "transcription": {
    "messages": [
      {
        "role": "assistant",
        "content": "Hello, this is Sarah from Customer Support. Am I speaking with John?",
        "timestamp": "2024-01-15T10:00:15.000000+00:00"
      },
      {
        "role": "user",
        "content": "Yes, this is John speaking.",
        "timestamp": "2024-01-15T10:00:25.000000+00:00"
      }
    ]
  },
  "custom_variables": [
    {
      "key": "customer_tier",
      "description": "Customer subscription tier level",
      "value": "premium",
      "type": "string"
    },
    {
      "key": "account_balance",
      "description": "Current account balance in USD",
      "value": 1250.75,
      "type": "number"
    },
    {
      "key": "is_first_time_caller",
      "description": "Whether this is the customer's first call",
      "value": false,
      "type": "boolean"
    }
  ],
  "disconnection_reason": "USER_HANGUP"
}

Bulk Campaign Management APIs

5. Create Campaign

POST /v1/campaigns Creates a campaign linked to an AI agent.

Header Parameters

ParameterTypeRequiredDescription
X-API-KeystringYesAPI key issued to the client
Content-TypestringYesMust be application/json

Request Body

{
  "agent_id": "agent_abc123def456",
  "campaign_name": "Q4_Onboarding_Dropouts",
  "description": "Re-engage users who dropped during onboarding.",
  "metadata": {
    "campaign_type": "winback",
    "target_audience": "onboarding_dropouts",
    "created_by": "ops@example.com"
  }
}

Request Parameters

ParameterTypeRequiredDescription
agent_idstringYesID of the AI agent to associate with this campaign
campaign_namestringYesUnique name for the campaign (unique per tenant)
descriptionstringNoDescription of the campaign purpose
metadataobjectNoFree-form key/value metadata for the campaign

Response

Success (201 Created)
{
  "success": true,
  "campaign_id": "cmp_abc123def456",
  "campaign_name": "Q4_Onboarding_Dropouts",
  "agent_id": "agent_abc123def456",
  "status": "active",
  "created_at": "2024-01-15T10:30:00Z"
}

6. Get Campaign

GET /v1/campaigns/{campaign_id} Fetch metadata and current counters for a campaign.

Path Parameters

ParameterTypeRequiredDescription
campaign_idstringYesThe campaign ID to retrieve

Header Parameters

ParameterTypeRequiredDescription
X-API-KeystringYesAPI key issued to the client

Response

Success (200 OK)
{
  "campaign_id": "cmp_abc123def456",
  "campaign_name": "Q4_Onboarding_Dropouts",
  "agent_id": "agent_abc123def456",
  "status": "active",
  "created_at": "2024-01-15T10:30:00Z",
  "metadata": {
    "campaign_type": "winback",
    "target_audience": "onboarding_dropouts",
    "created_by": "ops@example.com"
  },
  "stats": {
    "total_records": 500,
    "accepted_records": 480,
    "rejected_records": 20
  }
}

7. Ingest Records (Data Intake)

POST /v1/campaigns/{campaign_id}/ingress Ingest flat, uniform-schema records for AI calling. Records can be JSON array items or CSV rows. All records in a batch must share the same flat set of keys.

Path Parameters

ParameterTypeRequiredDescription
campaign_idstringYesThe campaign ID to ingest data into

Header Parameters

ParameterTypeRequiredDescription
X-API-KeystringYesAPI key issued to the client
Content-TypestringYesEither application/json or text/csv

Request Body (JSON Format)

An array of flat objects; keys must match across all objects. Values must be primitives (string, number, boolean, null).
[
  {
    "phone_number": "<Encrypted Phone Number>",
    "orgId": 12345,
    "encryptedAESKey": "<Encrypted AES Key>",
    "customer_name": "John Doe",
    "priority": 5
  },
  {
    "phone_number": "<Encrypted Phone Number>",
    "orgId": 12345,
    "encryptedAESKey": "<Encrypted AES Key>",
    "customer_name": "Jane Smith",
    "priority": 1
  }
]

Request Body (CSV Format)

First row defines the columns; each row must have the same number of columns.
phone_number,orgId,encryptedAESKey,customer_name,priority
<encrypted>,12345,<encrypted>,John Doe,5
<encrypted>,12345,<encrypted>,Jane Smith,1

Validation Rules

  1. Flat only - Values must be primitives (string, number, boolean, null). Arrays/objects are rejected
  2. Uniform keys - First object (or CSV header) defines the schema; all rows must match exactly
  3. Consistent types - Each fieldโ€™s type must be consistent across the batch
  4. Limits (defaults; per-tenant configurable):
    • Max rows per request: 10,000
    • Max JSON payload: 20 MB
    • Max CSV payload: 50 MB
  5. Timestamps - If present, must be ISO-8601 (e.g., 2024-01-04T10:00:00Z)
  6. Optional uniqueness - If enabled per tenant, fields like phone_number must be unique per day or campaign

Response

Success (201 Created) - All records accepted
{
  "status": "success",
  "message": "Records accepted.",
  "accepted_count": 2,
  "rejected_count": 0,
  "total_count": 502,
  "ingestion_id": "ing_5da3...",
  "request_id": "req_..."
}
Partial Success (207 Multi-Status)
{
  "status": "partial_success",
  "message": "Some records were rejected.",
  "accepted_count": 40,
  "rejected_count": 10,
  "errors": [
    {
      "row": 7,
      "code": "schema.mismatch_type",
      "field": "priority",
      "expected": "number",
      "actual": "string",
      "message": "Expected number for 'priority'"
    },
    {
      "row": 12,
      "code": "schema.unexpected_field",
      "field": "extra_col",
      "message": "Field not present in first object/header"
    },
    {
      "row": 21,
      "code": "uniqueness.violation",
      "field": "phone_number",
      "message": "Phone number must be unique in today's dataset"
    }
  ],
  "ingestion_id": "ing_...",
  "request_id": "req_..."
}
Error Response (400 Bad Request)
{
  "error": {
    "code": "schema.invalid",
    "message": "Records must share an identical, flat schema.",
    "details": [
      {
        "row": 1,
        "field": "customer_phone",
        "issue": "missing_field"
      },
      {
        "row": 3,
        "field": "address",
        "issue": "nested_object_not_allowed"
      }
    ]
  },
  "request_id": "req_..."
}

Call Status Values

StatusDescription
QUEUEDCall is queued for execution
RUNNINGCall is currently in progress
ENDEDCall has ended

Disconnection Reason Values

When a call ends, the disconnection_reason field indicates why the call was terminated:
ReasonDescription
USER_UNAVAILABLECallee did not respond in time
USER_REJECTEDCallee rejected the call (busy)
MAX_DURATIONThe set maximum call duration was reached
USER_HANGUPThe callee hung up the call
VOICEMAIL_REACHEDVoicemail was reached
AGENT_HANGUPThe agent ended the call as per prompt or upon detecting conversation completion
SILENCE_TIMEOUTCallee was silent for longer than the configured silence timeout period
ERROR_OCCURREDAn error occurred during the call

Support

If you encounter any issues or need assistance with the API, please contact our support team: Email: contact@revrag.ai Our team will respond to your inquiries and help resolve any technical issues you may experience while using the API.