Capture API walkthrough Beta

Video guide · 6:07For developers and technical teams
Need subtitles in another language?How to turn them on
  1. Play the video, then select the CC (subtitles) button in the bottom right of the player.
  2. Select Settings (the gear icon), then Subtitles/CC.
  3. Choose the language you want from the list.

On a phone, tap the video once to show the controls, then tap CC or the gear icon.

In this guide

Set up the Capture API end to end: get an API key, create a capture session with optional photo instructions, check its status, pull the photos, and verify the webhook TruthScan sends when a capture comes in.

  • Get API access and generate an API key
  • Create a capture session, with optional instructions
  • Check a session's status
  • List photos and get one photo's full record
  • Receive and verify the capture.completed webhook

Chapters

TranscriptRead along or copy
Intro

In this walkthrough, we'll set up the TruthScan Capture API, from creating a capture session to getting back a verified photo.

Sign in

First, sign in to your TruthScan account. You'll need an API key, so we'll start there.

Get an API key

Once you're in, you'll land on your account page. Scroll down to the API Keys section. If you're on a new account, submit the request form here first to get API access. Once you have access, generate a new key. Copy it somewhere safe and treat it like a password.

Open the docs

Next, open the Capture API docs. We'll follow them as our reference the whole way through.

Postman and Beeceptor

We'll send our requests in Postman, where I've already set up each one. To test webhooks, we'll use Beeceptor, a free tool that gives you a test URL and shows exactly what TruthScan sends to it. We'll use this URL as our webhook.

Create a session

Step one, create a session with a POST request. Your API key goes in the request headers as X-API-Key. I have already added mine. Then click Send, and your session is created.

Read the response

The response includes the session ID and the capture link. You'll also see the photo limit in max captures and a webhook secret. Save that secret now. It's only shown once, and you'll need it to verify webhooks.

Add instructions

You can also guide the end user with an instructions object in the same request. It sets the welcome note, the photos you need, and a success message.

Instructions in Postman

Here it is in Postman, added to the request body. Welcome is the first thing they see before the camera opens. Requests lists each photo you need, up to eight. Each has its text and required. False means it's optional. Success shows once they tap Finish. Click Send, and the session is created. You'll get 201 Created with the same session ID, capture link, and webhook secret. Now, when they open the link, they'll see your instructions first.

Open the capture link

Now, open the capture link from the response. On a computer, it shows a QR code, since capture only works on a phone. Scan it to continue.

Check session status

Once the photo's submitted, let's check the session. Session Status shows when it expires, how many captures are used, and your webhook URL. In Postman, copy the session ID from the Create Session response. Paste it into the Session Status request and click Send. The response shows the session details. Captures Used is now 1 because we've already taken the photo. If no photo has been submitted yet, it stays at 0. You'll also see the photo limit, the expiry, and the webhook URL.

List photos

Next, list the photos in the session. List Photos returns them newest first, in pages of up to 50. Copy the same session ID, open the List Photos request, and paste it into the URL. Then click Send. Each photo comes back with its asset ID, its verification state, and a risk score. The docs show every field, including the decision and a download link. Download links expire after one hour, so save the file soon after.

Get one photo

To get one photo's full record, copy its asset ID. Paste it into the Get One Photo request and click Send. This is the photo's complete record. Its verification state is trusted, which means the signature checks out. Below that, you'll find the decision, the image analysis, and the device and sensor details. One thing to keep in mind, the trust tier and risk score aren't authenticity verdicts. The risk score shows how complete the phone's sensor data was.

Webhooks

Finally, webhooks. After a trusted capture, TruthScan sends a capture.completed event to your webhook URL with the session ID, asset ID, decision, and image analysis. Here's the one we received in Beeceptor earlier. Check the X-TruthScan-Signature header with your webhook secret, so you know it really came from TruthScan. The request body has the event ID, the type, and a data object with the session ID, asset ID, and decision. This one came back as review, which means a person should check it before you accept it.

Wrap up

And that's it. You're now ready to start using TruthScan's Live Capture. For rate limits, error codes, and the full field reference, see the Capture API documentation or contact our support team.

Buttons and links10
API KeysSend201 CreatedX-API-Keymax capturesCaptures Usedcapture.completedX-TruthScan-Signature

Endpoints

WhatEndpoint
Auth headerx-api-key: YOUR_API_KEY
Create sessionPOST /api/capture/session/create
Session statusGET /api/capture/sessions/{sessionId}
List photosGET /api/capture/sessions/{sessionId}/assets
One photoGET /api/capture/assets/{assetId}
Webhook eventcapture.completed (verify X-TruthScan-Signature, HMAC-SHA256)
Up nextDetection History and the Chrome extension
Was this helpful?
Still need help?Our support team replies within 12 business hours.
Send a support request