Skip to main content
Api

Lead Assignments

List lead assignments

GET
/lead-assignments
AuthorizationBearer <token>

API key issued to a Sonzai project. Format: Bearer sk_....

In: header

Query Parameters

rep_user_id?string

Only assignments offered to this rep

state?string

Only assignments in this state

Value in"" | "offered" | "claimed" | "expired" | "reassigned" | "released" | "completed"
limit?integer

Max rows (default 50, max 200)

Formatint64

Response Body

application/json

application/problem+json

curl -X GET "https://loading/api/v1/lead-assignments"
{
  "$schema": "/api/v1/schemas/ListLeadAssignmentsResponse.json",
  "assignments": [
    {
      "$schema": "/api/v1/schemas/LeadAssignmentBody.json",
      "assignment_id": "string",
      "claimed_at": "2019-08-24T14:15:22Z",
      "completed_at": "2019-08-24T14:15:22Z",
      "features": null,
      "lead_ref": "string",
      "offered_at": "2019-08-24T14:15:22Z",
      "policy": "string",
      "prior_assignment_id": "string",
      "propensity": 0.1,
      "rep_user_id": "string",
      "sla_expires_at": "2019-08-24T14:15:22Z",
      "state": "string"
    }
  ]
}
{
  "$schema": "/api/v1/schemas/ErrorModel.json",
  "detail": "Property foo is required but is missing.",
  "errors": [
    {
      "location": "string",
      "message": "string",
      "value": null
    }
  ],
  "instance": "https://example.com/error-log/abc123",
  "status": 400,
  "title": "Bad Request",
  "type": "https://example.com/errors/example"
}

Offer a unit of work to a rep

POST
/lead-assignments/offer
AuthorizationBearer <token>

API key issued to a Sonzai project. Format: Bearer sk_....

In: header

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

application/problem+json

curl -X POST "https://loading/api/v1/lead-assignments/offer" \  -H "Content-Type: application/json" \  -d '{    "candidates": [      "string"    ],    "lead_ref": "string"  }'
{
  "$schema": "/api/v1/schemas/OfferLeadAssignmentResponse.json",
  "assignment": {
    "$schema": "/api/v1/schemas/LeadAssignmentBody.json",
    "assignment_id": "string",
    "claimed_at": "2019-08-24T14:15:22Z",
    "completed_at": "2019-08-24T14:15:22Z",
    "features": null,
    "lead_ref": "string",
    "offered_at": "2019-08-24T14:15:22Z",
    "policy": "string",
    "prior_assignment_id": "string",
    "propensity": 0.1,
    "rep_user_id": "string",
    "sla_expires_at": "2019-08-24T14:15:22Z",
    "state": "string"
  },
  "deduplicated": true
}
{
  "$schema": "/api/v1/schemas/ErrorModel.json",
  "detail": "Property foo is required but is missing.",
  "errors": [
    {
      "location": "string",
      "message": "string",
      "value": null
    }
  ],
  "instance": "https://example.com/error-log/abc123",
  "status": 400,
  "title": "Bad Request",
  "type": "https://example.com/errors/example"
}

Read one lead assignment

GET
/lead-assignments/{assignmentId}
AuthorizationBearer <token>

API key issued to a Sonzai project. Format: Bearer sk_....

In: header

Path Parameters

assignmentId*string

Assignment id

Response Body

application/json

application/problem+json

curl -X GET "https://loading/api/v1/lead-assignments/string"
{
  "$schema": "/api/v1/schemas/LeadAssignmentBody.json",
  "assignment_id": "string",
  "claimed_at": "2019-08-24T14:15:22Z",
  "completed_at": "2019-08-24T14:15:22Z",
  "features": null,
  "lead_ref": "string",
  "offered_at": "2019-08-24T14:15:22Z",
  "policy": "string",
  "prior_assignment_id": "string",
  "propensity": 0.1,
  "rep_user_id": "string",
  "sla_expires_at": "2019-08-24T14:15:22Z",
  "state": "string"
}
{
  "$schema": "/api/v1/schemas/ErrorModel.json",
  "detail": "Property foo is required but is missing.",
  "errors": [
    {
      "location": "string",
      "message": "string",
      "value": null
    }
  ],
  "instance": "https://example.com/error-log/abc123",
  "status": 400,
  "title": "Bad Request",
  "type": "https://example.com/errors/example"
}

Claim an offered lead

POST
/lead-assignments/{assignmentId}/claim
AuthorizationBearer <token>

API key issued to a Sonzai project. Format: Bearer sk_....

In: header

Path Parameters

assignmentId*string

Assignment id

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

application/problem+json

curl -X POST "https://loading/api/v1/lead-assignments/string/claim" \  -H "Content-Type: application/json" \  -d '{    "rep_user_id": "string"  }'
{
  "$schema": "/api/v1/schemas/LeadAssignmentBody.json",
  "assignment_id": "string",
  "claimed_at": "2019-08-24T14:15:22Z",
  "completed_at": "2019-08-24T14:15:22Z",
  "features": null,
  "lead_ref": "string",
  "offered_at": "2019-08-24T14:15:22Z",
  "policy": "string",
  "prior_assignment_id": "string",
  "propensity": 0.1,
  "rep_user_id": "string",
  "sla_expires_at": "2019-08-24T14:15:22Z",
  "state": "string"
}
{
  "$schema": "/api/v1/schemas/ErrorModel.json",
  "detail": "Property foo is required but is missing.",
  "errors": [
    {
      "location": "string",
      "message": "string",
      "value": null
    }
  ],
  "instance": "https://example.com/error-log/abc123",
  "status": 400,
  "title": "Bad Request",
  "type": "https://example.com/errors/example"
}

Complete a claimed lead

POST
/lead-assignments/{assignmentId}/complete
AuthorizationBearer <token>

API key issued to a Sonzai project. Format: Bearer sk_....

In: header

Path Parameters

assignmentId*string

Assignment id

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

application/problem+json

curl -X POST "https://loading/api/v1/lead-assignments/string/complete" \  -H "Content-Type: application/json" \  -d '{    "rep_user_id": "string"  }'
{
  "$schema": "/api/v1/schemas/LeadAssignmentBody.json",
  "assignment_id": "string",
  "claimed_at": "2019-08-24T14:15:22Z",
  "completed_at": "2019-08-24T14:15:22Z",
  "features": null,
  "lead_ref": "string",
  "offered_at": "2019-08-24T14:15:22Z",
  "policy": "string",
  "prior_assignment_id": "string",
  "propensity": 0.1,
  "rep_user_id": "string",
  "sla_expires_at": "2019-08-24T14:15:22Z",
  "state": "string"
}
{
  "$schema": "/api/v1/schemas/ErrorModel.json",
  "detail": "Property foo is required but is missing.",
  "errors": [
    {
      "location": "string",
      "message": "string",
      "value": null
    }
  ],
  "instance": "https://example.com/error-log/abc123",
  "status": 400,
  "title": "Bad Request",
  "type": "https://example.com/errors/example"
}

Release an active lead back to the pool

POST
/lead-assignments/{assignmentId}/release
AuthorizationBearer <token>

API key issued to a Sonzai project. Format: Bearer sk_....

In: header

Path Parameters

assignmentId*string

Assignment id

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

application/problem+json

curl -X POST "https://loading/api/v1/lead-assignments/string/release" \  -H "Content-Type: application/json" \  -d '{    "rep_user_id": "string"  }'
{
  "$schema": "/api/v1/schemas/LeadAssignmentBody.json",
  "assignment_id": "string",
  "claimed_at": "2019-08-24T14:15:22Z",
  "completed_at": "2019-08-24T14:15:22Z",
  "features": null,
  "lead_ref": "string",
  "offered_at": "2019-08-24T14:15:22Z",
  "policy": "string",
  "prior_assignment_id": "string",
  "propensity": 0.1,
  "rep_user_id": "string",
  "sla_expires_at": "2019-08-24T14:15:22Z",
  "state": "string"
}
{
  "$schema": "/api/v1/schemas/ErrorModel.json",
  "detail": "Property foo is required but is missing.",
  "errors": [
    {
      "location": "string",
      "message": "string",
      "value": null
    }
  ],
  "instance": "https://example.com/error-log/abc123",
  "status": 400,
  "title": "Bad Request",
  "type": "https://example.com/errors/example"
}