> ## Documentation Index
> Fetch the complete documentation index at: https://docs.camber.so/llms.txt
> Use this file to discover all available pages before exploring further.

# Quickstart

> This page has everything you need to start verifying documents with Camber.

Here's the game plan:

1. Start a document verification by calling the [start verification](/api-reference/document-verification/start-verification) endpoint.
2. Setup a webhook to receive notifications when the verification is complete.
3. Retrieve the verification result using the [retrieve verification](/api-reference/document-verification/retrieve-verification) endpoint.

All requests will use the base URL `https://api.camber.so/v1`. Make sure you have generated an API key (authentication token) from the [Camber dashboard](https://app.camber.so).

## Start a verification

```typescript theme={null}
const BASE_URL = "https://api.camber.so/v1";
const headers = {
  Authorization: `Bearer ${API_KEY}`,
};
```

<Info>
  Important: Signed URLs should be valid for at least 10 minutes.
</Info>

```typescript theme={null}
const body = {
  document: {
    type: "tuberculosis_test", // document type
    url: "https://example.com/tuberculosis_test.pdf", // signed url
    external_id: "document123",
  },
  person: {
    first_name: "John",
    last_name: "Doe",
    dob: "1990-01-01", // YYYY-MM-DD
    external_id: "person123", // user id in your system
  },
  external_id: "verification123", // optional unique identifier for the verification
};

const response = await fetch(`${BASE_URL}/document-verifications`, {
  method: "POST",
    body: JSON.stringify(body),
  }
);

if (!response.ok) {
  throw new Error(`HTTP error! status: ${response.status}`);
}

const data = await response.json();
console.log(data);
```

## Setup a webhook server

```typescript theme={null}
import express from 'express';
import { Webhook } from "svix";

const secret = "whsec_...";

const app = express();

app.post('/webhook', (req, res) => {

    const wh = new Webhook(secret);
    const payload = wh.verify(req.body, req.headers['svix-signature'], req.headers['svix-timestamp']);
    console.log(payload);

  const event = msg.event_type;
  switch (event) {
    case "document_verification.completed":
      console.log("Document verification completed");
      break;
    case "document_verification.failed":
      console.log("Document verification failed");
      break;
  }

  // handle the webhook
  res.sendStatus(200);
});
```

## Retrieve a verification

```typescript theme={null}
const id = payload.data.id;

const response = await fetch(`${BASE_URL}/document-verifications/${id}`, {
  headers,
});

if (!response.ok) {
  throw new Error(`HTTP error! status: ${response.status}`);
}

const result = await response.json();
const { decision, confidence, issues, data } = result;
console.log(decision, confidence, issues, data);
```

That's it! You've now successfully run a document verification. The rest is up to you :)
