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

# List Sessions

> List verification sessions with flexible filtering

```
GET /v1/sessions
```

Returns a paginated list of verification sessions. By default, returns sessions created by the authenticated user. Use query parameters to list by organization or filter by external ID.

## Request

### Headers

| Header      | Required | Description  |
| ----------- | -------- | ------------ |
| `x-api-key` | Yes      | Your API key |

### Query parameters

| Parameter         | Type    | Required | Default | Description                                                                               |
| ----------------- | ------- | -------- | ------- | ----------------------------------------------------------------------------------------- |
| `limit`           | number  | No       | `50`    | Number of sessions to return (1–500)                                                      |
| `next_token`      | string  | No       | —       | Pagination token from a previous response                                                 |
| `start_date`      | string  | No       | —       | Filter sessions created on or after this date (ISO 8601)                                  |
| `end_date`        | string  | No       | —       | Filter sessions created on or before this date (ISO 8601)                                 |
| `by_organization` | boolean | No       | `false` | When `true`, returns all sessions for your organization instead of only those you created |
| `external_id`     | string  | No       | —       | Filter sessions by your external reference ID                                             |
| `workflow_id`     | string  | No       | —       | Filter sessions by workflow ID                                                            |

<Info>
  Query modes are evaluated in priority order: `external_id` > `workflow_id` > `by_organization` > default sender-based query.
</Info>

### Example requests

#### List your sessions (default)

<CodeGroup>
  ```bash cURL theme={null}
  curl -X GET "https://api.deepidv.com/v1/sessions?limit=25&start_date=2025-01-01T00:00:00Z" \
    -H "x-api-key: YOUR_API_KEY"
  ```

  ```javascript Node.js theme={null}
  const params = new URLSearchParams({
    limit: "25",
    start_date: "2025-01-01T00:00:00Z",
  });

  const response = await fetch(
    `https://api.deepidv.com/v1/sessions?${params}`,
    {
      headers: { "x-api-key": "YOUR_API_KEY" },
    }
  );

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

  ```python Python theme={null}
  import requests

  response = requests.get(
      "https://api.deepidv.com/v1/sessions",
      headers={"x-api-key": "YOUR_API_KEY"},
      params={
          "limit": 25,
          "start_date": "2025-01-01T00:00:00Z",
      },
  )
  ```
</CodeGroup>

#### List all organization sessions

<CodeGroup>
  ```bash cURL theme={null}
  curl -X GET "https://api.deepidv.com/v1/sessions?by_organization=true&limit=100" \
    -H "x-api-key: YOUR_API_KEY"
  ```

  ```javascript Node.js theme={null}
  const params = new URLSearchParams({
    by_organization: "true",
    limit: "100",
  });

  const response = await fetch(
    `https://api.deepidv.com/v1/sessions?${params}`,
    {
      headers: { "x-api-key": "YOUR_API_KEY" },
    }
  );

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

  ```python Python theme={null}
  import requests

  response = requests.get(
      "https://api.deepidv.com/v1/sessions",
      headers={"x-api-key": "YOUR_API_KEY"},
      params={
          "by_organization": "true",
          "limit": 100,
      },
  )
  ```
</CodeGroup>

#### Filter by workflow ID

<CodeGroup>
  ```bash cURL theme={null}
  curl -X GET "https://api.deepidv.com/v1/sessions?workflow_id=wf_abc123" \
    -H "x-api-key: YOUR_API_KEY"
  ```

  ```javascript Node.js theme={null}
  const params = new URLSearchParams({
    workflow_id: "wf_abc123",
  });

  const response = await fetch(
    `https://api.deepidv.com/v1/sessions?${params}`,
    {
      headers: { "x-api-key": "YOUR_API_KEY" },
    }
  );

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

  ```python Python theme={null}
  import requests

  response = requests.get(
      "https://api.deepidv.com/v1/sessions",
      headers={"x-api-key": "YOUR_API_KEY"},
      params={"workflow_id": "wf_abc123"},
  )
  ```
</CodeGroup>

#### Filter by external ID

<CodeGroup>
  ```bash cURL theme={null}
  curl -X GET "https://api.deepidv.com/v1/sessions?external_id=user-12345" \
    -H "x-api-key: YOUR_API_KEY"
  ```

  ```javascript Node.js theme={null}
  const params = new URLSearchParams({
    external_id: "user-12345",
  });

  const response = await fetch(
    `https://api.deepidv.com/v1/sessions?${params}`,
    {
      headers: { "x-api-key": "YOUR_API_KEY" },
    }
  );

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

  ```python Python theme={null}
  import requests

  response = requests.get(
      "https://api.deepidv.com/v1/sessions",
      headers={"x-api-key": "YOUR_API_KEY"},
      params={"external_id": "user-12345"},
  )
  ```
</CodeGroup>

## Response

### 200 — Success

| Field        | Type           | Description                                                                                                          |
| ------------ | -------------- | -------------------------------------------------------------------------------------------------------------------- |
| `sessions`   | array          | Array of session objects (see [Retrieve Session](/api-reference/sessions/retrieve-session) for full field reference) |
| `next_token` | string \| null | Pagination token to fetch the next page. `null` when no more results                                                 |

<Info>
  The `user`, `sender_user`, and `resource_links` fields are only returned when retrieving a single session by ID. List responses include the `session_record` fields only.
</Info>

### Pagination

To fetch the next page of results, pass the `next_token` from the response as a query parameter:

```bash theme={null}
curl -X GET "https://api.deepidv.com/v1/sessions?limit=25&next_token=eyJpZCI6ImFiYzEyMyJ9" \
  -H "x-api-key: YOUR_API_KEY"
```

Continue paginating until `next_token` is `null`.

### Error responses

| Status                  | Description                                                                                   |
| ----------------------- | --------------------------------------------------------------------------------------------- |
| `400 Bad Request`       | Invalid query parameters (e.g., limit out of range, invalid date format, invalid next\_token) |
| `401 Unauthorized`      | Missing or invalid API key                                                                    |
| `429 Too Many Requests` | Rate limit exceeded                                                                           |

<ResponseExample>
  ```json 200 theme={null}
  {
    "sessions": [
      {
        "id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
        "organization_id": "org_abc123",
        "user_id": "usr_def456",
        "sender_user_id": "usr_ghi789",
        "status": "VERIFIED",
        "type": "session",
        "session_progress": "COMPLETED",
        "created_at": "2025-01-15T10:30:00.000Z",
        "updated_at": "2025-01-15T10:45:00.000Z"
      }
    ],
    "next_token": "eyJpZCI6ImFiYzEyMyJ9"
  }
  ```
</ResponseExample>
