For AI agents: the documentation index is at /llms.txt and a Markdown version of this page is at /truthscan-ai-capture-api-documentation.md.

Capture API
ISO 27001SOC 2 CertifiedGDPR CompliantGASA Partner

TruthScan Capture API

Mint a phone capture link, receive a signed photo, and read the result with your API key.

Authentication

Create a secret key in your account.

Send it on every call as the x-api-key header or as Authorization: Bearer. The key must belong to an organization with API access. The capture link opened on the phone does not use this key.

Replace YOUR_API_KEY with your secret key.

Create a session

Returns a capture link. inviteeEmail is required. expiresInSeconds defaults to 15 minutes and cannot exceed 7 days. maxCaptures defaults to 20 and cannot exceed 20. webhookUrl is optional. When set, it must be https and must resolve to a public address. webhookSecret is returned only in this response. metadata is optional: a flat JSON object of your own references, such as customerId or ticketId. Values must be strings, numbers, booleans, or null, with up to 50 keys. It is returned when you read the session and in each capture.completed webhook. instructions is optional: a welcome note and requests, each marked required or not. The phone lists them. Tapping one opens the camera for that photo. A required request needs a submitted photo. An optional one can be skipped. instructions.success is optional and is shown after Finish. Saved photo-step templates are listed and edited at /api/capture/templates with the same API key. This request does not take a template id; send those steps in instructions.

POST /api/capture/session/create

Set sendEmail to true to have TruthScan email the link. Then subject and message are required. Put {link} in the message where the capture URL should appear. emailSent is true only when that email went out. Otherwise send captureLink yourself.

Store webhookSecret. It is the HMAC key for capture.completed.

Example request

curl -X POST https://truthscan.com/api/capture/session/create \
  -H 'Content-Type: application/json' \
  -H 'x-api-key: YOUR_API_KEY' \
  -d '{
    "inviteeEmail": "person@example.com",
    "expiresInSeconds": 900,
    "maxCaptures": 1,
    "webhookUrl": "https://example.com/hooks/capture",
    "metadata": {
      "customerId": "cust_98765",
      "ticketId": "tick_12345"
    }
  }'

Example response

{
  "sessionId": "11111111-1111-4111-8111-111111111111",
  "captureToken": "…",
  "captureUrl": "/capture/11111111-1111-4111-8111-111111111111?token=…",
  "captureLink": "https://truthscan.com/capture/11111111-1111-4111-8111-111111111111?token=…",
  "expiresAt": "2026-10-07T16:00:00.000Z",
  "expiresInSeconds": 900,
  "maxCaptures": 1,
  "challenge": "other_side",
  "webhookSecret": "…",
  "emailSent": false
}

Read results

Poll the session until capturesUsed increases, or wait for the webhook. Download URLs expire after one hour.

Session status

Expiry, captures used, the webhook URL you registered, and your metadata.

GET /api/capture/sessions/{sessionId}

Example request

curl https://truthscan.com/api/capture/sessions/SESSION_ID \
  -H 'x-api-key: YOUR_API_KEY'

Example response

{
  "sessionId": "11111111-1111-4111-8111-111111111111",
  "expiresAt": "2026-10-07T16:00:00.000Z",
  "maxCaptures": 1,
  "capturesUsed": 1,
  "inviteeEmail": "person@example.com",
  "webhookUrl": "https://example.com/hooks/capture",
  "metadata": {
    "customerId": "cust_98765",
    "ticketId": "tick_12345"
  },
  "createdAt": "2026-10-07T15:45:00.000Z"
}

List photos

Photos for one session, newest first. Query page and limit (max 50). Each item is a summary plus downloadUrl. The list location only includes latitude, longitude, and altitude. Fetch the asset for accuracy, heading, and speed.

GET /api/capture/sessions/{sessionId}/assets

Example request

curl 'https://truthscan.com/api/capture/sessions/SESSION_ID/assets?page=1&limit=20' \
  -H 'x-api-key: YOUR_API_KEY'

Example response

{
  "assets": [
    {
      "id": "22222222-2222-4222-8222-222222222222",
      "verificationState": "trusted",
      "trustTier": "standard",
      "decision": "passed",
      "decisionFlags": [],
      "risk": { "score": 0.95, "flags": ["geolocation_low_accuracy"] },
      "capturedAtUtc": "2026-10-07T15:50:00.000Z",
      "submittedAtUtc": "2026-10-07T15:50:01.200Z",
      "signedAtUtc": "2026-10-07T15:50:03.000Z",
      "captureToSubmitMs": 1200,
      "geolocation": {
        "latitude": 37.7749,
        "longitude": -122.4194,
        "altitude": 15,
        "altitudeAccuracyMeters": null,
        "accuracyMeters": null,
        "headingDegrees": null,
        "speedMetersPerSecond": null
      },
      "deviceModel": "iPhone",
      "devicePlatform": "iOS",
      "inviteeEmail": "person@example.com",
      "thumbnailUrl": "https://…",
      "downloadUrl": "https://…"
    }
  ],
  "pagination": {
    "page": 1,
    "totalPages": 1,
    "total": 1,
    "hasPreviousPage": false,
    "hasNextPage": false
  }
}

Get one photo

The same record as the capture detail page, plus assetUrl for the signed JPEG. The sample keeps the fields you branch on. device also includes screen, camera list, GPU, and input. sensors.geolocation repeats the location object.

GET /api/capture/assets/{assetId}

Example request

curl https://truthscan.com/api/capture/assets/ASSET_ID \
  -H 'x-api-key: YOUR_API_KEY'

Example response

{
  "id": "22222222-2222-4222-8222-222222222222",
  "sessionId": "11111111-1111-4111-8111-111111111111",
  "verificationState": "trusted",
  "trustTier": "standard",
  "decision": "review",
  "decisionFlags": [{ "code": "device_clock_skew", "class": "contextual" }, { "code": "gps_ip_distance_yellow", "class": "informational" }],
  "duplicateOf": null,
  "reviewReason": null,
  "imageAnalysis": {
    "status": "ready",
    "verdict": "real",
    "labelConfidence": 98.4,
    "agreement": "strong",
    "screenRecapture": false,
    "qualityWarnings": [],
    "indicators": [],
    "description": "A person holding a driver's license in a doorway.",
    "imageTags": ["person", "license", "doorway", "indoor", "document"],
    "requestedPhoto": "Front of the driver's license",
    "requestCompliance": "pass",
    "detectorVersion": null
  },
  "risk": { "score": 0.95, "flags": ["geolocation_low_accuracy"] },
  "inviteeEmail": "person@example.com",
  "mimeType": "image/jpeg",
  "assetUrl": "https://…",
  "thumbnailUrl": null,
  "capturedAtUtc": "2026-10-07T15:50:00.000Z",
  "submittedAtUtc": "2026-10-07T15:50:01.200Z",
  "serverReceivedAtUtc": "2026-10-07T15:50:02.000Z",
  "signedAtUtc": "2026-10-07T15:50:03.000Z",
  "createdAtUtc": "2026-10-07T15:50:03.100Z",
  "captureToSubmitMs": 1200,
  "timing": {
    "capturedAtUtc": "2026-10-07T15:50:00.000Z",
    "submittedAtUtc": "2026-10-07T15:50:01.200Z",
    "serverReceivedAtUtc": "2026-10-07T15:50:02.000Z",
    "signedAtUtc": "2026-10-07T15:50:03.000Z",
    "captureToSubmitMs": 1200
  },
  "geolocation": {
    "latitude": 37.7749,
    "longitude": -122.4194,
    "altitude": 15,
    "altitudeAccuracyMeters": 10,
    "accuracyMeters": 12,
    "headingDegrees": null,
    "speedMetersPerSecond": null
  },
  "deviceModel": "iPhone",
  "devicePlatform": "iOS",
  "device": {
    "browserName": "Mobile Safari",
    "platform": "iOS",
    "timezone": "America/Los_Angeles",
    "screenWidth": 390,
    "screenHeight": 844,
    "camera": { "width": 1920, "height": 1080, "facingMode": "environment" },
    "connection": { "effectiveType": "4g", "downlinkMbps": 10, "rttMs": 50 },
    "network": {
      "publicIp": "203.0.113.10",
      "publicIpv4": "203.0.113.10",
      "ipSource": "cloudflare_visitor",
      "browserReportedIpv4": "203.0.113.10",
      "ipObservations": [
        { "address": "203.0.113.10", "source": "cloudflare_visitor", "trusted": true },
        { "address": "203.0.113.10", "source": "browser_stun", "trusted": false }
      ],
      "privacy": { "status": "not_detected", "reasons": [] },
      "country": "US",
      "city": "San Francisco"
    }
  },
  "sensors": {
    "gyroVariance": 0.02,
    "accelVariance": 0.11,
    "motionSampleCount": 24,
    "gyroSampleCount": 12,
    "accelSampleCount": 12,
    "permissionDenied": {
      "camera": false,
      "geolocation": false,
      "motion": false
    }
  }
}

Result fields

Branch on decision. verificationState only says the signature is valid. assetUrl and downloadUrl expire after one hour.

FieldMeaning
verificationStateSignature check only: trusted, valid_untrusted, invalid, or none. trusted means TruthScan signed the file.
decisionpassed, review, unable_to_verify, or rejected
decisionFlagsWhy the decision was reached. A hard flag rejects; contextual requires review; unavailable means the check could not run; informational records evidence without changing the outcome. GPS/IP distance is green below 50 km, yellow from 50–150 km, and red above 150 km. Yellow and red show as warnings but do not require review on their own. An unlisted platform and GPU pair also requires review. Blur, darkness, or low image quality requires review. A phone clock more than 5 minutes from the server when the photo is sent to be signed requires review.
imageAnalysisAdvisory image-detector evidence. description is one or two sentences about what is in the photo, or null when that step does not finish. imageTags lists up to five short tags for the same photo and is empty when that step does not finish. requestedPhoto is the photo step this image was taken for, or null when the link had no steps. requestCompliance is pass, fail, or review for that step, or null when there was no step or the check did not finish. fail or review sets decision to review unless decision is already rejected. screenRecapture true requires review and a live retake. verdict and labelConfidence do not change the decision during shadow mode; confidence is model confidence, not a probability of fraud.
trustTierstandard or high. Not an authenticity verdict.
risk.scoreSensor completeness from 0 to 1. It is not an authenticity score.
risk.flagscamera_permission_denied, geolocation_permission_denied, geolocation_missing, geolocation_low_accuracy, motion_permission_denied, motion_samples_missing, gyro_missing, zero_gyro_variance, accel_missing
geolocationlatitude, longitude, altitude, altitudeAccuracyMeters, accuracyMeters, headingDegrees, speedMetersPerSecond
deviceBrowser, platform, user agent, timezone, screen, camera, connection, and network. network includes the selected public IP, its source, every validated server/header/browser IP observation, ASN owner, coarse location, and VPN/proxy assessment. A privacy signal is evidence for review, not proof.
sensorsCombined, gyroscope, and accelerometer sample counts; gyroVariance; accelVariance; and permissionDenied for camera, geolocation, and motion
timingShutter, submit, server received, and signed times, plus captureToSubmitMs

Webhook

After a trusted capture, TruthScan POSTs capture.completed to webhookUrl. Redirects are not followed. The body does not include precise location. Fetch the asset for the full record.

Read X-TruthScan-Signature. It is t=<unix seconds>,v1=<hex>. Compute HMAC-SHA256 over t + "." + the raw body using webhookSecret, and reject timestamps more than five minutes off.

Example body

{
  "id": "…",
  "type": "capture.completed",
  "data": {
    "sessionId": "11111111-1111-4111-8111-111111111111",
    "assetId": "22222222-2222-4222-8222-222222222222",
    "verificationState": "trusted",
    "trustTier": "standard",
    "decision": "review",
    "flags": ["device_clock_skew", "gps_ip_distance_yellow"],
    "imageAnalysis": {
      "status": "ready",
      "verdict": "real",
      "labelConfidence": 98.4,
      "agreement": "strong",
      "screenRecapture": false,
      "qualityWarnings": [],
      "indicators": [],
      "description": "A person holding a driver's license in a doorway.",
      "imageTags": ["person", "license", "doorway", "indoor", "document"],
      "requestedPhoto": "Front of the driver's license",
      "requestCompliance": "pass",
      "detectorVersion": null
    },
    "metadata": {
      "customerId": "cust_98765",
      "ticketId": "tick_12345"
    },
    "capturedAtUtc": "2026-10-07T15:50:00.000Z"
  }
}

Rate limits

Limits are shared across instances. A 429 includes Retry-After in seconds.

Limits

Each call counts as one request against both the IP and the organization.

PathBucketLimit
Create and readIP600 / minute
Create and readOrganization2,000 / minute
Phone captureIP60 / minute
Phone captureOrganization2,000 / minute

Create and read covers POST /api/capture/session/create plus the three GET result routes. Phone capture covers nonce, upload-url, and sign. The phone does not send your API key. Free Trial organizations are lower: 120 create-and-read requests per minute per IP and 300 per organization, and 60 phone requests per minute per IP and 300 per organization. Invitation emails are 30 per hour and 150 per day. That cap returns 429 with code INVITE_EMAIL_LIMIT.

Throttled response

Wait for Retry-After, then send the request again.

HTTP/1.1 429 Too Many Requests
Retry-After: 12
Content-Type: application/json

{
  "error": "Rate limit exceeded",
  "code": "RATE_LIMIT_EXCEEDED",
  "retryAfter": 12
}

What to read

  • Retry-After: seconds until the window resets
  • retryAfter: the same value in the JSON body

Best practices

  • Poll session status instead of listing assets on a tight loop.
  • Prefer the webhook when you can receive HTTPS callbacks.

Errors

Failed calls return JSON with error and code.

401 and 403 mean the key cannot be used. 404 means the session or asset is not in your organization.

CodeMeaning
MISSING_API_KEYNo x-api-key or Bearer token
INVALID_API_KEYKey is unknown, inactive, or has no organization
ORG_NO_API_ACCESSOrganization API access is off
INVITEE_EMAIL_REQUIREDinviteeEmail was missing
INVITEE_EMAIL_INVALIDinviteeEmail is not a valid address
INVITE_MESSAGE_REQUIREDsendEmail is true and message is missing or too long
INVITE_SUBJECT_REQUIREDsendEmail is true and subject is missing
WEBHOOK_URL_REJECTEDwebhookUrl is not public https
SESSION_NOT_FOUNDNo session with that id in your organization
ASSET_NOT_FOUNDNo asset with that id in your organization
RATE_LIMIT_EXCEEDEDToo many requests in the current window
INVITE_EMAIL_LIMITFree Trial invitation email cap. The body includes limit, window (hour or day), and retryAfter

Frequently asked questions

How the Capture API fits into your backend.