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

# Quickstart Guide

This guide will help you get started with Captide quickly, showing you how to set up both the REST API and the Document Auditing JavaScript SDK to embed corporate disclosure intelligence into your systems.

> [!NOTE]
>
> Before you begin, make sure you [request a Captide test API key](https://www.captide.ai/contact/api-request).

## Using the REST API

### Authentication

All API requests require authentication using your API key in the `X-API-Key` header:

```bash theme={null}
curl --request GET \
  --url 'https://rest-api.captide.co/api/v2/companies/list?limit=10' \
  --header 'X-API-Key: YOUR_API_KEY'
```

### Example 1: Retrieve Company Information

Use the [/companies/list](https://docs.captide.ai/api-reference/endpoint/companies.md) endpoint to find companies in Captide and retrieve their company `id`, which you can pass to other endpoints. Tickers are accepted with or without an exchange suffix (`STO.AX` or `STO`).

```bash theme={null}
curl --request GET \
  --url 'https://rest-api.captide.co/api/v2/companies/list?tickers=STO.AX' \
  --header 'X-API-Key: YOUR_API_KEY'
```

```json theme={null}
[
  {
    "id": "77848abe-a215-41b7-8950-86e89ea1fadc",
    "name": "Santos Ltd.",
    "tickers": ["STO.AX"],
    "countries": ["AU"],
    "filesWithSec": false,
    "cik": null,
    "permId": "4295857141"
  }
]
```

To look companies up by name instead, use [/companies/search](https://docs.captide.ai/api-reference/endpoint/search_company.md) (for example `?query=Santos`).

### Example 2: Retrieve Company Documents

Use the [/documents/list](https://docs.captide.ai/api-reference/endpoint/documents.md) endpoint to search for documents by `documentCategories`, `secFormTypes`, fiscal period, date range, or by the filing company's `companyTickers` or `companyIds`.
In the example below, we use the `id` of Santos to retrieve its latest `interim-financial-report` documents:

```bash theme={null}
curl --request GET \
  --url 'https://rest-api.captide.co/api/v2/documents/list?companyIds=77848abe-a215-41b7-8950-86e89ea1fadc&documentCategories=interim-financial-report&limit=10' \
  --header 'X-API-Key: YOUR_API_KEY'
```

The response contains the metadata of each document, newest first. Keep the document `id`: you use it to retrieve the document's files.

```json theme={null}
[
  {
    "id": "97ac0c55-7349-46ec-8670-92f8524f5294",
    "documentCategory": "interim-financial-report",
    "secFormType": null,
    "title": "Third Quarter Report",
    "description": "Santos Limited third quarter report for the period ending 30 September 2026, summarising record quarterly production and free cash flow, operational performance across assets (including Barossa, Pikka and PNG LNG), sales and pricing, updated 2026 guidance and project developments.",
    "date": "2026-10-22",
    "fiscalQuarter": 3,
    "fiscalYear": 2026,
    "fiscalPeriod": "quarter",
    "language": "en",
    "companyId": "77848abe-a215-41b7-8950-86e89ea1fadc",
    "companyName": "Santos Ltd.",
    "companyTickers": ["STO.AX"],
    "metadata": {}
  },
  ...
]
```

Once you have identified the documents you need, pass their `id` to the [/documents/\{id}](https://docs.captide.ai/api-reference/endpoint/get_document.md) endpoint to get links to the files:

```bash theme={null}
curl --request GET \
  --url 'https://rest-api.captide.co/api/v2/documents/97ac0c55-7349-46ec-8670-92f8524f5294' \
  --header 'X-API-Key: YOUR_API_KEY'
```

```json theme={null}
{
  "id": "97ac0c55-7349-46ec-8670-92f8524f5294",
  "documentCategory": "interim-financial-report",
  "secFormType": null,
  "title": "Third Quarter Report",
  "description": "Santos Limited third quarter report for the period ending 30 September 2026, summarising record quarterly production and free cash flow, …",
  "date": "2026-10-22",
  "fiscalQuarter": 3,
  "fiscalYear": 2026,
  "fiscalPeriod": "quarter",
  "language": "en",
  "companyId": "77848abe-a215-41b7-8950-86e89ea1fadc",
  "companyName": "Santos Ltd.",
  "companyTickers": ["STO.AX"],
  "originalFileUrl": "https://files.captide.co/original-docs/77848abe-a215-41b7-8950-86e89ea1fadc/97ac0c55-7349-46ec-8670-92f8524f5294.pdf?se=2026-11-03T18%3A15%3A55Z&sp=r&sv=2025-07-05&sr=b&sig=…",
  "markdownFileUrl": "https://files.captide.co/markdown-docs/77848abe-a215-41b7-8950-86e89ea1fadc/97ac0c55-7349-46ec-8670-92f8524f5294.md?se=2026-11-03T18%3A15%3A55Z&sp=r&sv=2025-07-05&sr=b&sig=…",
  "layoutJsonFileUrl": "https://files.captide.co/original-docs/77848abe-a215-41b7-8950-86e89ea1fadc/97ac0c55-7349-46ec-8670-92f8524f5294.json?se=2026-11-03T18%3A15%3A55Z&sp=r&sv=2025-07-05&sr=b&sig=…",
  "metadata": {}
}
```

`originalFileUrl` links to the original document and `markdownFileUrl` to its Markdown version, which is optimized for downstream analysis and LLM ingestion. For documents processed by Captide's OCR pipeline, `layoutJsonFileUrl` links to the document's layout as JSON: each page's text, tables and figures, with their position on the page. It's `null` for other documents.

> [!NOTE]
>
> File links are signed and expire **one hour** after the request (the `se` parameter). Request the document again for fresh links instead of storing them.

### Example 3: Prompt-Based Chunk Retrieval

With Captide, you can create RAG-based applications and tools without the need to collect, preprocess, chunk, or store document excerpts yourself. Send a natural language query to the [/rag/chunks](https://docs.captide.ai/api-reference/endpoint/chunks.md) endpoint and you'll receive the relevant document excerpts from our database.

```bash theme={null}
curl --request POST \
  --url 'https://rest-api.captide.co/api/v2/rag/chunks' \
  --header 'X-API-Key: YOUR_API_KEY' \
  --header 'Content-Type: application/json' \
  --data '{"query": "Provide the net dollar retention of Zscaler for the last two quarters"}'
```

The response includes the relevant chunks with their page number and document metadata:

```json theme={null}
{
  "relevantChunks": [
    {
      "content": "please join us at our upcoming Investor Day on October 6 in New York City. I want to thank our employees, customers and partners for their continued support. …",
      "pageNumber": 5,
      "excerpt": null,
      "documentMetadata": {
        "id": "a0dcd3e7-7985-4fbc-9c77-371b4232e242",
        "title": "Zscaler, Inc. Earnings Call Transcript Q4 2026 (2026-09-03)",
        "documentCategory": "earnings-call-transcript",
        "secFormType": null,
        "date": "2026-09-03",
        "fiscalQuarter": 4,
        "fiscalYear": 2026,
        "companyName": "Zscaler, Inc.",
        "companyTickers": ["ZS"],
        "metadata": null
      }
    },
    ...
  ]
}
```

You can then use the relevant chunks as context for AI-generated responses, and combine them with context from other sources, such as internal data or structured databases. To search only specific documents, add their IDs to the body as `documentIds`, comma-separated.

### Example 4: AI Agent Response

Captide answers questions grounded in corporate disclosures, with every statement traceable to its source. Send the query as JSON to the [/rag/agent-response](https://docs.captide.ai/api-reference/endpoint/agent.md) endpoint:

```bash theme={null}
curl --request POST \
  --url 'https://rest-api.captide.co/api/v2/rag/agent-response' \
  --header 'X-API-Key: YOUR_API_KEY' \
  --header 'Content-Type: application/json' \
  --data '{"query": "Provide the net dollar retention of Zscaler for the last two quarters"}'
```

The answer is in the `content` field, in Markdown, with citations such as `[#43c00004]` embedded in the text. Every citation is a key in `sourceMap`, which holds the chunk it came from and the exact `excerpt` that supports it. When the same chunk supports several statements, later citations carry a suffix (`#43c00004:2`), each with its own entry and excerpt.

```json theme={null}
{
  "content": "Zscaler’s net dollar retention / net retention was **115%** for each of the last two reported quarters available in the retrieved disclosures.\n\n| Quarter | Net dollar retention / net retention |\n|---|---:|\n| Q4 FY2026 | **115%** [#43c00004] |\n| Q3 FY2026 | **115%** [#4e0f0010] |\n\nNote: In Q4 FY2026, management said NRR was “consistent each quarter this year at **115%**” [#43c00004:2]. …",
  "sourceMap": {
    "#43c00004": {
      "content": "please join us at our upcoming Investor Day on October 6 in New York City. …",
      "pageNumber": 5,
      "excerpt": "115%",
      "documentMetadata": {
        "id": "a0dcd3e7-7985-4fbc-9c77-371b4232e242",
        "title": "Zscaler, Inc. Earnings Call Transcript Q4 2026 (2026-09-03)",
        "documentCategory": "earnings-call-transcript",
        "secFormType": null,
        "date": "2026-09-03",
        "fiscalQuarter": 4,
        "fiscalYear": 2026,
        "companyName": "Zscaler, Inc.",
        "companyTickers": ["ZS"],
        "metadata": null
      }
    },
    "#43c00004:2": { ... },
    "#4e0f0010": { ... },
    "#4e0f0010:2": { ... }
  }
}
```

Use `documentMetadata.id`, `pageNumber` and `excerpt` from a `sourceMap` entry to open the source in Captide's Document Auditing SDK and highlight the passage (see [below](#using-the-document-auditing-javascript-sdk)).

### Example 5: Streaming AI Agent Response

The [/rag/agent-response-stream](https://docs.captide.ai/api-reference/endpoint/agent_stream.md) endpoint streams the agent's progress and answer as Server-Sent Events (SSE). Use it in chat interfaces, where you want to show what the agent is doing and display the answer as it is written.

```bash theme={null}
curl --no-buffer --request POST \
  --url 'https://rest-api.captide.co/api/v2/rag/agent-response-stream' \
  --header 'X-API-Key: YOUR_API_KEY' \
  --header 'Content-Type: application/json' \
  --data '{"query": "Provide the net dollar retention of Zscaler for the last two quarters"}'
```

Each event is a `data:` line holding a JSON object. Its `type` is one of:

| `type` | Meaning |
| - | - |
| `thinking` | Progress update, with a `stage` such as `search`, `document_selection` or `analyzing`. |
| `message` | The next piece of the answer. Append the `content` of each one to build the answer. |
| `content_final` | The complete answer after post-processing (repeated citations renumbered as `#ref:2`, …). When present, it replaces the text built from `message` events. |
| `sources` | The `sourceMap`: every citation in the answer mapped to its chunk and excerpt, as in Example 4. |
| `warning` | A non-fatal issue, such as no relevant documents being found. |
| `done` | The stream is complete. |

```
data: {"type": "thinking", "role": "assistant", "content": "Identifying companies from your query...", "stage": "search"}

data: {"type": "thinking", "role": "assistant", "content": "Selecting documents for Zscaler, Inc....", "stage": "document_selection"}

data: {"type": "thinking", "role": "assistant", "content": "Found 5 relevant pages.", "stage": "analyzing"}

data: {"type": "message", "role": "assistant", "content": "Z"}

data: {"type": "message", "role": "assistant", "content": "sc"}

...

data: {"type": "content_final", "role": "assistant", "content": "Zscaler’s net dollar retention / net retention for the last two reported quarters was: …"}

data: {"type": "sources", "content": {"#43c00004": {"content": "…", "pageNumber": 5, "excerpt": "115%", "documentMetadata": {"id": "a0dcd3e7-7985-4fbc-9c77-371b4232e242", "title": "Zscaler, Inc. Earnings Call Transcript Q4 2026 (2026-09-03)", …}}, …}}

data: {"type": "done"}
```

## Using the Document Auditing JavaScript SDK

### Installation

Install the Captide SDK in your project:

```bash theme={null}
npm install captide pdfjs-dist
# or
yarn add captide pdfjs-dist
```

### Integration Example

The viewer loads documents through a `fetchDocumentFn` you provide. Point it at your own backend, which calls `GET /api/v2/documents/{id}` with your API key (see the [Backend Integration guide](https://docs.captide.ai/integration/backend.md)), so the key never reaches the browser.

```jsx theme={null}
import React from 'react';
import { DocumentViewer, DocumentViewerProvider, useDocumentViewer } from 'captide';

// Returns the document for the viewer, from your backend proxy
const fetchDocument = async (documentId) => {
  const response = await fetch(`/api/documents/${documentId}`);
  if (!response.ok) throw new Error(`Failed to load document ${documentId}`);
  return response.json();
};

export default function App() {
  return (
    <DocumentViewerProvider fetchDocumentFn={fetchDocument}>
      <SourceButton />
      <div style={{ height: '600px', width: '100%', border: '1px solid #ccc' }}>
        <DocumentViewer />
      </div>
    </DocumentViewerProvider>
  );
}

function SourceButton() {
  const { loadDocument } = useDocumentViewer();

  // A sourceMap entry from /rag/agent-response or the stream's `sources` event
  const source = {
    pageNumber: 5,
    excerpt: '115%',
    documentMetadata: { id: 'a0dcd3e7-7985-4fbc-9c77-371b4232e242' }
  };

  // Opens the document at the cited page and highlights the excerpt
  const openSource = () =>
    loadDocument(source.documentMetadata.id, {
      page: source.pageNumber,
      snippet: source.excerpt ?? undefined
    });

  return <button onClick={openSource}>View source</button>;
}
```

## Next Steps

* Explore the [API Reference](https://docs.captide.ai/api-reference/introduction.md) for detailed documentation.
* Obtain a license for production or commercial use: [Contact our team](https://www.captide.ai/contact/api-request).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.