---
title: Get policy header
summary: Fetches the policy header from the Policy Header API and adjusts associations for external users by user type.
status: draft
owner: SAIF IT Core Services
last_reviewed: 2026-10-12
library: BolMiddleware
reference_type: package
operation_id: OP-12
trigger: IPolicyHeaderService.GetHeader call
---

# Get policy header

`PolicyHeaderService` is the facade over the Policy Header API client. It returns the header for a policy and trims the associations list for external users.

| Field | Value |
| --- | --- |
| **Operation ID** | OP-12 |
| **Trigger** | `IPolicyHeaderService.GetHeader` call |
| **Inputs** | Policy number, optional customer id, optional user type code |
| **Outputs** | `PolicyHeader` |
| **Primary components** | `PolicyHeaderService.GetHeader`, `PolicyHeaderService.GetRelationships` |
| **Entry point** | `src/BolMiddleware/Services/Headers/Policy/PolicyHeaderService.cs` |

## Steps

1. Call the Policy Header API client with the policy number and an external-user flag that is true when the customer id is greater than zero.
2. When the flag is true and a header came back, switch on the user type code ([BR-BOLMIDDLEWARE-013](../business-rules.md#br-bolmiddleware-013-external-association-filtering)):
   - `POLCY`: replace the associations with those from a second header lookup for the customer id.
   - `AGNCY`: keep only associations that contain a policy whose `AgencyId` equals the customer id.
   - Any other code: leave the associations unchanged.
3. Return the header.
   - On exception: log the error through `ISaifLogService` and return a default `PolicyHeader` ([BR-BOLMIDDLEWARE-021](../business-rules.md#br-bolmiddleware-021-silent-failure-degradation)).
4. `GetRelationships(policyNumber)` returns the list of policy associations from the same API and follows the same logging behavior.

## Process flow

The following diagram visualizes this operation's control flow.

```mermaid
flowchart TD
	Start([GetHeader]) --> S1[Call Policy Header API with external flag]
	S1 --> D1{Customer id above zero?}
	D1 -->|No| EndOk([Return header])
	D1 -->|Yes| D2{User type code?}
	D2 -->|POLCY| S2[Replace associations from customer id lookup]
	D2 -->|AGNCY| S3[Keep associations with matching AgencyId]
	D2 -->|Other| EndOk
	S2 --> EndOk
	S3 --> EndOk
	S1 -->|Exception| EndErr([Log and return default])
```

## Failure and edge-case behavior

- A failed API call yields an empty header rather than an error, so the page cannot distinguish an outage from a missing policy.
- The `POLCY` branch makes a second API call; the customer id and type code come from the web context, not the identity.

## Related documentation
- [Index](../index.md)
- [Overview](../overview.md)
- [Architecture](../architecture.md)
- [Dependencies](../dependencies.md)
- [Configuration](../configuration.md)
- [Operations and processes](../operations-processes.md)
- [Business rules](../business-rules.md)
- [Security and authorization](../security-authorization.md)
- [Service registration](../service-registration.md)
- [API reference](../api/index.md)

## Sources
- src/BolMiddleware/Services/Headers/Policy/PolicyHeaderService.cs
- src/BolMiddleware/Services/Headers/Policy/IPolicyHeaderService.cs
