Evaluate

Evaluate a message synchronously and get the result in the response, without storing anything. Useful for testing a profile or for scoring inside your own pipeline.

The EvaluationResult object

Properties

  • Name
    object
    Type
    'evaluation_result'
    Description

    The object type.

  • Name
    livemode
    Type
    boolean
    Description

    true for live data, false for data created with a test key.

  • Name
    classification
    Type
    'lead' | 'junk' | 'not_lead'
    Description

     

  • Name
    junk
    Type
    object or null
    Description

    Why the message isn't a lead

  • Name
    profile
    Type
    object | object
    Description

     

  • Name
    leads
    Type
    array of LeadEvaluation
    Description

    0..N leads found in the message

  • Name
    usage
    Type
    object
    Description

     

  • Name
    timing
    Type
    object
    Description

     

  • Name
    pipelineVersion
    Type
    string
    Description

     


POST/v1/evaluate

Evaluate a message right away, without storing anything

Finds the lead(s) in a message, filters junk and scores each lead with a profile. Synchronous (usually 5–10 s). Nothing is stored: no history, no duplicate detection, no webhooks.

Optional attributes

  • Name
    text
    Type
    string
    Description

    Free text: an email body, a chat message, a transcript…

  • Name
    email
    Type
    object
    Description

     

  • Name
    fields
    Type
    object
    Description

    Form fields exactly as received; no mapping needed

  • Name
    channel
    Type
    string
    Description

    email, form, chat, … Inferred when omitted

  • Name
    profileId
    Type
    string
    Description

    Profile to score with (its active version). Default: the workspace default profile

  • Name
    profile
    Type
    object
    Description

    A whole profile document inline, instead of a stored profile

Request

POST
/v1/evaluate
curl -X POST https://core.leadveyor.com/v1/evaluate \
  -H "Authorization: Bearer {api_key}" \
  -H "Leadveyor-Workspace: {workspace_id}"  # account-wide keys only \
  -H "Content-Type: application/json" \
  -d '{
    "text": "text",
    "email": {
      "from": "from",
      "subject": "subject",
      "text": "text",
      "html": "html"
    },
    "fields": {
      "name": "Sarah",
      "message": "Wedding for 120 guests"
    },
    "channel": "channel"
  }'

Response 200

{
  "object": "evaluation_result",
  "livemode": false,
  "classification": "lead",
  "junk": {
    "category": "category",
    "confidence": "confidence",
    "reason": "reason",
    "rule": "rule"
  },
  "profile": {
    "id": "id",
    "version": 0
  },
  "leads": [
    {
      "contact": {
        "name": null,
        "firstName": null,
        "lastName": null,
        "emails": [
          "owner@acme.example"
        ],
        "phones": [
          "phones"
        ],
        "other": [
          {
            "type": "type",
            "value": "value"
          }
        ],
        "company": null
      },
      "request": {
        "summary": "summary",
        "service": null
      },
      "location": {
        "address": null,
        "city": null,
        "postcode": null,
        "country": null
      },
      "language": null,
      "fields": {},
      "evaluation": {
        "score": null,
        "tier": "tier",
        "confidence": 0,
        "decidedBy": {
          "id": "id",
          "type": "disqualify",
          "reason": "reason"
        },
        "dimensions": [
          {
            "id": "id",
            "label": "label",
            "score": null,
            "confidence": 0,
            "known": [
              "known"
            ],
            "unknown": [
              "unknown"
            ]
          }
        ],
        "criteria": [
          {
            "id": "id",
            "label": "label",
            "type": "rule",
            "result": "met",
            "grade": null,
            "points": 0,
            "evidence": null,
            "dimension": null
          }
        ]
      }
    }
  ],
  "usage": {
    "costUsd": 0,
    "inputTokens": 0,
    "outputTokens": 0,
    "models": [
      "models"
    ]
  },
  "timing": {
    "totalMs": 0,
    "steps": [
      {
        "name": "name",
        "ms": 0,
        "detail": "detail"
      }
    ]
  },
  "pipelineVersion": "pipelineVersion"
}

Was this page helpful?