---
title: Bill queue processing
summary: Retrieve the next claim bill from the processing queue, or restore a bill to the queue.
status: draft
owner: SAIF.Core documentation team
last_reviewed: 2026-09-24
library: SAIF.Data
reference_type: package
operation_id: OP-SD-06
trigger: Bill-entry task processing requests the next queued bill, or restores one.
---

# Bill queue processing

Retrieve the next claim bill from the processing queue, or restore a bill to the queue.

| Field | Value |
| --- | --- |
| **Operation ID** | OP-SD-06 |
| **Trigger** | Bill-entry task processing requests the next queued bill, or restores one. |
| **Inputs** | Queue flag, task id |
| **Outputs** | Bill data with return/image codes, or a restore result code |
| **Primary components** | `CCClaimApiService.GetNextClaimBillFromQueue`, `RestoreClaimBillToQueue` |
| **Entry point** | `Data/SAIF.Data/Queries/Claims/CCClaimApiService.cs` |

## Steps

1. PUT `v1/BillEntryTaskProcess/NextBillFromQueue/{flag}`. The response maps as follows ([SD-BR-013](../business-rules.md#sd-br-013-bill-queue-http-status-mapping)):
   - 200: deserialize the bill.
   - 404: `ReturnCode=1`, `ImageId=-1`.
   - 500: `ReturnCode=-1`, `ImageId=-1`.
5. Restore: PUT `v1/BillEntryTaskProcess/RestoreBill/{taskId}`. Returns 1 on 200, otherwise 0 ([SD-BR-013](../business-rules.md#sd-br-013-bill-queue-http-status-mapping)).

## Process flow

The following diagram visualizes this operation's control flow.

```mermaid
flowchart TD
	Start(["Bill-entry task processing requests the next queued bill,<br>or restores one."]) --> S1["`CCClaimApiService.GetNextClaimBillFromQueue`"]
	S1 --> S2{"Rules satisfied?"}
	S2 -->|Yes| EndOk([Result returned])
	S2 -->|No| EndErr([Exception / empty result])
```

## Failure and edge-case behavior
- Unmapped status codes: treated per the 500 branch (return -1/-1) per the source's default handling*.

## Related documentation
- [Operations and processes](../operations-processes.md)
- [Business rules](../business-rules.md)
- [SQL catalog](../sql/index.md)
- [Database tables](../database-tables.md)


## Sources
- `Data/SAIF.Data/Queries/Claims/CCClaimApiService.cs`
