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

# API introduction

> Use the Watchdog API to upload invoices and follow their processing and assessment state.

The Watchdog API provides server-to-server invoice ingestion and reconciliation. The generated endpoint reference on this site comes directly from Watchdog's production OpenAPI 3.1 contract.

## Base URL

```text theme={null}
https://api.watchdog.no
```

All versioned operations are under `/v1`. Requests and responses use JSON except for invoice upload, which uses `multipart/form-data`.

## Available operations

| Operation                       | Purpose                                                    | Scope            |
| ------------------------------- | ---------------------------------------------------------- | ---------------- |
| `POST /v1/invoices/upload`      | Upload a primary invoice and optional attachments          | `invoices:write` |
| `GET /v1/invoices/{invoice_id}` | Read the current processing and aggregate assessment state | `invoices:read`  |
| `GET /v1/invoices`              | List non-deleted invoices for the token organization       | `invoices:read`  |

## Typical integration flow

<Steps>
  <Step title="Create an API key">
    An organization administrator creates a key in Watchdog and stores the plaintext token securely.
  </Step>

  <Step title="Upload an invoice">
    Send the primary invoice document and optional attachments. A successful response returns `201 Created` and a `Location` header.
  </Step>

  <Step title="Poll the invoice resource">
    Fetch the `Location` resource while invoice or alert processing is active. Respect `Retry-After` whenever it is present.
  </Step>

  <Step title="Use the result">
    Read processing state, aggregate alert state, and `invoice_url`. Treat a result as conclusive for the current snapshot only when the relevant processing status is terminal.
  </Step>
</Steps>

<CardGroup cols={2}>
  <Card title="Authentication" icon="key" href="/api-reference/authentication">
    Create, store, rotate, and send API keys safely.
  </Card>

  <Card title="Upload and poll" icon="file-arrow-up" href="/api-reference/upload-and-poll">
    Implement the complete invoice-ingestion lifecycle.
  </Card>
</CardGroup>
