> This page is for Spain Public Administration Flow.

> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://infonite.dev/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://infonite.dev/_mcp/server.

# On Flow Started

POST 

Triggered when your customer opens the Spain Public Administration widget and the session goes live.

`data` is the browser context it was opened with — origin, user agent, address — the first line of the audit trail of this session. Nothing has been retrieved yet.

**The schema below describes `data` decrypted — on purpose**, so this reference has a model you can read and code against. What arrives at your endpoint depends on how the session was created:

* **With an `aes_key`**: `data` is a single string, `aes::Base64(IV + Ciphertext + Tag)`. Decrypt it and you get exactly the object documented below. The walkthrough and the code are in [Payload Encryption](/guides/payload-encryption).
* **Without an `aes_key`**: `data` is **not in the body at all** — absent, not `null`. Somebody's records are never put on the wire unencrypted, so the event tells you what happened and you read the content from [Get Session Results](https://infonite.dev/flows/spain-public-administration/api-reference/spain-public-administration-api/sessions-results/flows-es-public-administration-v-1-session-results) when it arrives.

**Answer `2xx` as soon as the payload reaches you**, whatever your processing does with it afterwards: any other status is recorded as a failed delivery even though the event arrived. [Answering a delivery](/guides/webhooks#answering-a-delivery) has the handler to copy.

Reference: https://infonite.dev/flows/spain-public-administration/api-reference/spain-public-administration-api/webhooks/webhook-es-public-administration-started

## Request

### Payload

- `event_class` ("EsPublicAdministrationV1FlowEvent", required) — Payload class discriminator — always this value for Spain Public Administration events.
- `app_id` (string, required)
- `customer_id` (string, required)
- `session_id` (string, required)
- `producer` ("es-public-administration", required) — The flow that produced the event.
- `event` ("es-public-administration:started", required) — The event type: `started`.
- `status_code` (enum, required) — Describes the status of a flow.
  - Allowed values: `READY`, `WAITING`, `COMPLETED`, `FAILED`, `SYSTEM_CANCELLED`, `CLIENT_CANCELLED`, `CUSTOMER_CANCELLED`, `TIMED_OUT`, `CONFIGURATION_ERROR`
- `date` (string, optional)
- `status_message` (string, optional, nullable)
- `data` (catgrid_flows__flows__es_public_administration__v1__machine__ctx__FlowOpenCtx__Out, optional) — The browser context the session was opened with. Documented decrypted: on the wire it is the `aes::…` string of this object when the session carries an `aes_key`, and absent when it does not.

## Types

### catgrid_flows__flows__es_public_administration__v1__machine__ctx__FlowOpenCtx__Out

Browser metadata of the customer device.

- `origin` (string, optional)
- `user_agent` (string, optional)
- `browser_session` (string, optional)
- `user_ip` (string, optional)