Detection API walkthrough

Video guide · 3:21For 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

Connect TruthScan's detectors to your own systems. Every detector follows the same pattern: get an upload URL, upload the file, submit it for detection, then check for the result.

  • Generate an API key
  • Upload and submit an image for detection
  • Poll for the result and read the response
  • Run bulk image scans with a ZIP
  • Apply the same pattern to video, audio, and PDF

Good to know

  • A scan usually finishes in a few seconds. On Enterprise plans, we can work with you to lower processing time for your volume.
  • Setup is quick: four requests take you from upload to result.
  • API access isn't included on every plan. If you can't create an API key, contact us and we'll enable API access for your account.
  • Need separate keys for development, testing, and production? Create as many API keys as you need in your dashboard, give each one a name, and revoke any key on its own.
  • Most teams send images above a chosen score to a person for review. See Choosing a review threshold.

Chapters

TranscriptRead along or copy
Intro

In this walkthrough, we'll connect to the TruthScan Detection API, from uploading a file to reading the result. We'll use the image detector, then show how the others follow the same pattern.

Get an API key

First, you'll need an API key. In your TruthScan account, open API Keys and click Generate New Key. Store it somewhere safe, like your secrets manager.

How it works

We'll use Postman. A scan takes four requests: get an upload URL, upload the file, submit it for detection, and check for the result. Scans run in the background, so you'll check back with the scan ID until it's done.

Step 1: Get an upload URL

Step one: request an upload URL. Send a GET request with your file name and your API key in the header. You'll get back an upload URL and a file path.

Step 2: Upload the file

Step two: upload the image to that URL with a PUT request. Set the content type to match your file. An empty success response means it worked.

Step 3: Submit for detection

Step three: submit the file for detection. Send a POST request with your key and the file's URL. You can also ask for a heatmap and detailed analysis. You'll get back a scan ID with a status of pending.

Step 4: Get the result

Step four: send the scan ID to the query endpoint, and repeat until the status is done. The response includes the score, the final verdict, how confident TruthScan is in that verdict, any quality warnings, and a heatmap link if you asked for one.

Bulk scans

To scan many images at once, upload a ZIP the same way, then send it to the bulk upload endpoint. You'll get one ID to check for the whole batch.

Video, audio, and PDF

Video, audio, and PDF work the same way. Each has its own address and detect endpoint, and returns an ID you check with query. Video also lets you choose standard or face swap detection, and PDF tells you whether a document is genuine or tampered.

Credits and wrap up

You can check your remaining credits anytime with the check credits endpoint. For rate limits, errors, and every field, see the API docs for each detector. Thanks for watching.

Buttons and links7

Endpoints

WhatEndpoint
Image hosthttps://detect-image.truthscan.com
Get upload URLGET /get-presigned-url?file_name=...
UploadPUT {presigned_url}
Submit imagePOST /detect
Bulk ZIPPOST /bulk-upload
Get resultPOST /query
CreditsGET /check-user-credits
Video hosthttps://detect-video.truthscan.com (POST /detect-file or /detect)
Audio hosthttps://detect-audio.truthscan.com (POST /detect)
PDF hosthttps://detect-text.truthscan.com (POST /detect-pdf)
Was this helpful?
Still need help?Our support team replies within 12 business hours.
Send a support request