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

# Auto-book completed

> referral.auto_book_completed webhook

Fired when an asynchronous Partner API auto-book request reaches a terminal
result. [Submit a booking](/guides/submit-a-booking) describes the request that
starts the attempt.

## Delivery

Scan sends the event to the first available destination:

1. The `webhook_url` supplied on the booking request.
2. The account webhook configured on the **API access** tab.
3. No webhook when neither exists; poll the referral instead.

Account webhooks are signed as described in [Webhooks](/guides/webhooks).
A request-specific webhook is not signed with the account credential.

| Header             | Value                                                   |
| ------------------ | ------------------------------------------------------- |
| `Content-Type`     | `application/json`                                      |
| `User-Agent`       | `Scan.com-Webhook/1.0`                                  |
| `X-Scan-Event`     | `referral.auto_book_completed`                          |
| `X-Scan-Timestamp` | Unix timestamp; configured account webhooks only        |
| `X-Scan-Signature` | HMAC-SHA256 signature; configured account webhooks only |

## Payload

The body contains `occurred_at`, the terminal `auto_book_request`, and the
current referral snapshot. Outcomes include `booked`, `contacted_for_booking`,
`no_availability`, and `booking_failed`.

This event does not currently include `event_id`. Make processing idempotent
using `auto_book_request.id` and its terminal `status`.

## Response

Return any HTTP `2xx` response after storing the event. For account webhooks,
the retry policy is documented in [Webhooks](/guides/webhooks). If delivery is
unavailable, poll
[`GET /api/v2/referrals/{referral_id}`](/api-reference/referrals/returns-a-referral-by-id)
and inspect `auto_book_request.status` and `auto_book_request.outcome`.


## OpenAPI

````yaml openapi.yaml webhook autoBookCompleted
openapi: 3.1.0
info:
  title: Scan.com API
  version: v2
  description: >
    This API provides comprehensive access to Scan.com’s core functionalities, 

    including management of referrals, patient information, authentication, body
    parts, 

    and imaging modalities. It enables seamless integration for scheduling, data
    retrieval, 

    and workflow automation within the Scan.com platform, facilitating efficient
    and secure 

    handling of medical imaging processes.
servers:
  - url: https://api.staging.scan.com
    description: Sandbox
  - url: https://api.scan.com
    description: Production
security:
  - BearerAuth: []
tags:
  - name: Courier SSO
    description: >-
      Mint a one-time Courier portal SSO URL with the same Bearer token used for
      the rest of the API.
  - name: Webhooks
    description: >-
      Outbound HTTP POST notifications sent to your api_credentials.webhook_url
      when visit or notification status changes. Configure api_credentials on
      your LawFirm, Practice, CoordinationGroup, Insurance, Employer, or
      NurseCaseManagementGroup.
  - name: Order Documents
    description: >-
      Retrieve radiology report PDFs, DICOM imaging, and invoices for orders
      visible to the authenticated group.
  - name: Locations
    description: >-
      Rank nearby imaging centers for a referral after medical safety answers
      are on file. Partners submit a preferred center; Scan books the visit.
  - name: Testing
    description: Staging-only fixture bootstrap, status advancement, and test webhooks.
  - name: FHIR
    description: >-
      Opt-in FHIR R4 read shapes for DiagnosticReport and ImagingStudy. Not a
      FHIR server.
paths: {}
components:
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      description: >
        `Authorization: Bearer <api_token>`. Sandbox tokens come from Get API
        keys

        and allow 2,000 successful requests or 7 days. Failed 4xx/5xx responses
        do

        not consume the allowance. Production tokens are issued from the group's

        API access tab.

````