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

# Postman

> Import ready-made Postman collections and an environment for the sajn API

The Postman starter kit lets you make your first authenticated request, create resources, and explore every endpoint without writing requests by hand.

## Download the files

* [API reference collection](/downloads/postman/sajn-api-reference.postman_collection.json)
* [Getting started collection](/downloads/postman/sajn-getting-started.postman_collection.json)
* [Document lifecycle collection](/downloads/postman/sajn-document-lifecycle.postman_collection.json)
* [Contacts and parties collection](/downloads/postman/sajn-contacts-and-parties.postman_collection.json)
* [Environment](/downloads/postman/sajn-local.postman_environment.json)

Each link downloads a JSON file.

<CardGroup cols={2}>
  <Card title="Getting started" icon="rocket">
    A health check, your first list requests, and creating a contact and a document.
  </Card>

  <Card title="Document lifecycle" icon="file-signature">
    Create a contact and a document, add the contact as a party, send the document, get the signing URL, and get the signed PDF.
  </Card>

  <Card title="Contacts and parties" icon="users">
    Create a contact, find it by email, update it, and add it to a document as a party.
  </Card>

  <Card title="API reference" icon="code">
    Every endpoint, generated from the OpenAPI specification and grouped like the API reference.
  </Card>
</CardGroup>

## Import the collections

1. Download the collections you want and the environment.
2. In Postman, click **Import** and select the JSON files.
3. Open the imported **sajn Local** environment.
4. Set `apiKey` to an API key from **Inställningar > Utvecklare > API-nycklar**. For more information, see [Authentication](/get-started/authentication).
5. Leave `baseUrl` set to `https://app.sajn.se`. A sandbox key reaches your sandbox through the same URL.
6. Select **sajn Local** as the active environment.

## Variables

The collections share variables through the environment, so one request can use what an earlier request returned, even in another collection:

| Variable | Purpose | Default |
| - | - | - |
| `apiKey` | Bearer token for every request | Empty |
| `apiVersion` | Sent as the `Sajn-Version` header on every request | `2026-10` |
| `baseUrl` | Base URL of the API | `https://app.sajn.se` |
| `contactId`, `documentId`, `partyId`, `signingUrl` | Values that the workflow collections capture from responses | Empty |
| `identityCheckId`, `fileId`, `approvalRequestId` | IDs that the create requests in the API reference collection capture | Empty |
| `fileType` | File that **Get a document file** returns: `ORIGINAL`, `SIGNED`, or `JOURNAL` | `SIGNED` |

Every other path parameter, such as `templateId` or `webhookId`, has an empty variable of the same name in the environment. Set it before you run a request that uses it.

Test scripts save each captured value to the collection and to the active environment. List requests include every query parameter that the endpoint accepts, turned off; turn on the ones you need. To retry a write safely, turn on the `Idempotency-Key` header, which sends a new GUID with each request. For more information, see [Idempotency](/api-fundamentals/idempotency).

To test against another API version, change `apiVersion`. For the supported versions, see [API versioning](/api-fundamentals/versioning).

## Run the requests in order

1. In the getting started collection, run **Health check**.
2. Run **List all documents** or **List all contacts** to confirm that the key works.
3. Run **Create a new contact**, then **Create a new document**.
4. In the document lifecycle collection, run the requests from **Create a new contact** to **Get a party with signing URL**.
5. To sign as the contact, open the `signingUrl` value in a browser. The example parties use `example.com` addresses, so they don't receive the signing email.
6. After every party has signed, run **Get a document file**.

**Create a new document** creates a draft with one party, Maja Holm, who signs for a company. It also sets `expiresAt`, because a document needs an expiration date before you can send it. Change the date to one that suits your test.

**Get a document file** returns `409 INVALID_STATE` until the file exists. The signed PDF exists after every party has signed, including Maja Holm. **Create a new document** saves her party ID in `partyId`, and **Add a party to document** replaces it with the contact's. To get her signing URL, copy her ID from `parties` in the **Create a new document** response into `partyId`, and run **Get a party with signing URL** again.

If **Send document for signing** returns `409 APPROVAL_REQUIRED`, the document needs an approval before you can send it. To request one, use [Request approval of a document](/api-reference/request-approval-of-a-document).

## How the collections stay current

sajn generates the collections from the same OpenAPI specification as the [API reference](/api-reference/list-all-documents). When the API changes, the collections are regenerated, so request URLs, methods, and example bodies match the docs.


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