---
title: Construct the Document API client
summary: Resolve endpoint and caller identity for the Document API.
status: draft
owner: Technical Writer
last_reviewed: 2026-07-31
library: SAIF.Business.Policy.Audit.ApiCalls
reference_type: package
operation_id: OP-004
trigger: A caller instantiates `DocumentApiCall`.
---

# Construct the Document API client

Resolve endpoint and caller identity for the Document API.

| Field | Value |
| --- | --- |
| **Operation ID** | OP-004 |
| **Trigger** | A caller instantiates `DocumentApiCall`. |
| **Inputs** | None. |
| **Outputs** | Initialized `JsonHttpClient` stored inside `DocumentApiCall`. |
| **Primary components** | `DocumentApiCall.DocumentApiCall()` |
| **Entry point** | `Business\SAIF.Business.Policy.Audit.ApiCalls\DocumentApiCall.cs` |

## Steps

1. Create `ClientInfo` with application ID `PremiumAudit` ([BR-AAC-001](../business-rules.md#br-aac-001-outbound-clients-identify-as-premiumaudit)).
2. Populate `ClientInfo.MachineName` and `ClientInfo.UserId` from `EnvironmentService` ([BR-AAC-002](../business-rules.md#br-aac-002-outbound-clients-propagate-machine-and-user-identity)).
3. Read environment setting `documentapi.url` and convert it to the base `Uri` for the client ([BR-AAC-003](../business-rules.md#br-aac-003-api-base-urls-come-from-environment-settings)).
4. Construct `JsonHttpClient` with the resolved URI and `ClientInfo` only; no authenticator is attached for this downstream service ([BR-AAC-009](../business-rules.md#br-aac-009-only-the-policy-audit-api-client-attaches-an-authenticator)).

## Process flow

The following diagram visualizes this operation's control flow.

```mermaid
flowchart TD
  Start(["new DocumentApiCall()"]) --> Info[Build ClientInfo]
  Info --> Config[Read documentapi.url]
  Config --> Client[Create JsonHttpClient]
  Client --> Done([Client ready])
```

## Failure and edge-case behavior

- A missing or malformed `documentapi.url` setting prevents client construction.
- Authentication behavior is delegated to the downstream service and hosting environment.

## Related documentation
- [Operations and processes](../operations-processes.md)
- [Business rules](../business-rules.md)
- [Configuration](../configuration.md)

## Sources
- `Business\SAIF.Business.Policy.Audit.ApiCalls\DocumentApiCall.cs`
