Skip to content

Accept data over HTTP

An http source is a push endpoint: a system posts a payload to the ingestor runtime, and the runtime turns it into dispatch jobs (or events) before it answers. The endpoint is served by the runtime (port 8091 by default, http://127.0.0.1:8091 under fcdev), not by the platform. For the concepts see Ingestion.

POST /ingest/{client}/{code}
POST /ingest/{application}/{client}/{code}

{client} is the client’s identifier or its platform id (clt_...). The short form works while only one application has an ingestion of that code for the client. When two do, it answers 409 AMBIGUOUS and the caller must use the application-qualified form. An unknown ingestion, or one that is not an http source, is 404. Only POST is served.

The checks run in this order and the first to fail answers: the ingestion, the login, the rate limit, accept (media type), the headers, the body.

auth.kind The caller sends What is checked
bearer Authorization: Bearer <token> The token equals the secret named in token: {name: ...}, a secret of the ingestion’s client
basic Authorization: Basic <base64 user:password> The user name equals username in the definition and the password equals the secret named in password. A user name may not contain :
flowcatalyst-token Authorization: Bearer <platform access token> The token verifies against the platform’s signing keys; its principal may act for the ingestion’s client and use the application named in application (a code). principalId (prn_...) narrows it to one principal

A service account’s sac_ id is not in its tokens, so name its principal in principalId.

A missing or wrong credential is 401. A valid platform token whose principal lacks the client, the application or the named principal is 403 FORBIDDEN. If the platform’s keys or the secret store cannot be read at that moment the answer is 503: send it again. Secrets are cached for a short while, so a rotated secret is in force within about a minute.

Use flowcatalyst-token when callers are already FlowCatalyst principals (it needs no shared secret). Use bearer or basic for third parties who can only hold a static credential.

source:
kind: http
auth: {...}
accept:
contentTypes: [application/xml, text/xml]
body: XML
  • contentTypes are media types as type/subtype, compared case-insensitively with the request’s Content-Type, parameters such as charset ignored. Absent or empty accepts any. Anything else is 415 UNSUPPORTED_MEDIA_TYPE, and so is a request with no Content-Type when a list is given.
  • body is checked before the payload is split; a failure is 400.
  • Once accept is set, a blank body is 400 EMPTY_BODY. Without accept a blank body makes no records and the answer is 202 without an id.
body Accepts Refusal
NONE (default) anything
JSON one JSON value INVALID_JSON
JSON_OBJECT one JSON object with at least one property INVALID_JSON or PAYLOAD_MUST_BE_A_NON_EMPTY_JSON_OBJECT
XML well-formed XML with a root element INVALID_XML

XML is parsed with DTDs and external entities off, and a DOCTYPE is refused outright. The refusal says where a body is malformed (line and column), never what it says. Every refusal has the body {"error": "<CODE>"}, with a message added where there is something to say.

Header Meaning
Idempotency-Key Names the request. Each record is keyed by it and its position, so sending the same request again makes no new jobs or events and the answer carries the same ids. Without it, a resend makes everything again
X-Message-Group 1 to 128 characters of A-Z a-z 0-9 _ . : -, else 400 INVALID_MESSAGE_GROUP. Every record gets the group {ingestionId}:{value}, so two ingestions never share a group. Without it the group is {ingestionId}: plus a hash of the Idempotency-Key (else of the payload), so a resend lands in the same group
X-Correlation-Id At most 100 characters, else 400 INVALID_CORRELATION_ID. It becomes every record’s correlation id; without it the correlation id is the record’s group

Message groups are what ordering is built on. Choose the value so that things that must stay in order share it.

Status Body Meaning
202 {"accepted": true, ...} The platform has the jobs (or events). Only now is it safe to forget the payload
503 {"error": "UNAVAILABLE"} The platform has none, or only some, of them. Send the same request again; with an Idempotency-Key nothing is made twice
422 REFUSED or UNPROCESSABLE The platform refused the records for good, or the payload could not be read. Do not send it again unchanged
429 {"error": "RATE_LIMITED"} with Retry-After See rate limits below
400, 401, 403, 404, 409, 415 As described above

The 202 names what was made, in record order:

Target Split none Any other split
dispatch job {"accepted": true, "jobId": "..."} {"accepted": true, "jobIds": [...]}
event {"accepted": true, "eventId": "..."} {"accepted": true, "eventIds": [...]}

A payload that makes no records has no ids: the list is empty, or the answer is {"accepted": true} alone. A resend under the same Idempotency-Key answers the same ids.

A client that treats 202 as “stored”, 503 as “retry” and 422 as “give up” is correct. Always send an Idempotency-Key so a retry after a timeout cannot duplicate.

rateLimit: {requests: 120, per: PT1M} # inside source:

rateLimit allows at most requests per per (1 to 1,000,000 requests; per from 1 ms to 1 day) to one ingestion; beyond it the answer is 429 RATE_LIMITED with Retry-After in seconds. A caller is counted only after it has logged in, so a stranger cannot use up an ingestion’s budget. The count is each runtime’s own: with several runtimes behind a load balancer, each allows the full limit.

Separately, failed logins are limited for every ingestion, with or without rateLimit. An address that fails to log in to one ingestion more than 20 times in a minute is answered 429 without its credentials being checked until the wait is over. Other addresses and ingestions are not held up. Only a refusal the caller caused counts: a 503 because keys or secrets could not be read does not, so an outage locks nobody out.

A record is one piece of the payload (the whole body for split none). Its content type is what the split makes of it: application/json, application/xml or text/csv. With split none the record keeps the Content-Type the caller sent, parameters included (application/json when none, or one over 100 characters).

Target DISPATCH_JOB (the default). The record becomes a dispatch job delivered to targetUrl:

  • envelope (dataOnly: false): the platform’s JSON envelope, the record in data (parsed when it is JSON, else a string), with dataContentType naming the record’s content type;
  • dataOnly: true: the record itself, byte for byte, with the job’s content type as the request’s Content-Type. The envelope’s fields travel as headers (X-Dispatch-Job-Id, X-Event-Type, X-FlowCatalyst-Client and the signature headers).

Target EVENT. The record becomes one platform event of the event type in target.code, stored through the same path as POST /api/events/batch, so the event type’s subscriptions deliver it. There is no targetUrl, pool or connection. The event’s source is ingestion:{application}:{code}. Event data is JSON: a JSON record that parses is the data as it is; any other record is wrapped as {"contentType": "...", "body": "..."} only when wrapNonJson: true, otherwise it is refused. wrapNonJson is required at save unless the records are known to be JSON (a json split, or split none with accept.body of JSON or JSON_OBJECT). It is never implicit.

An event is deduplicated per ingestion when its request carried an Idempotency-Key; a resend answers the first event’s id.

Example: XML from a partner, delivered raw to a processor

Section titled “Example: XML from a partner, delivered raw to a processor”

POST /ingest/acme/yard-trip with the caller’s own platform token. Each posted XML document is one dispatch job, delivered unchanged.

application: acme-integration # an INTEGRATION application; also the first part of target.code
client: acme
code: yard-trip
name: Yard trip (XML)
source:
kind: http
auth:
kind: flowcatalyst-token
application: acme-integration
accept:
contentTypes: [application/xml, text/xml]
body: XML
rateLimit: {requests: 600, per: PT1M}
split:
kind: none # the posted body is the one record
target:
kind: DISPATCH_JOB
code: acme-integration:function:yard-trip-ingest:dispatch
targetUrl: https://functions.example.com/fn/acme-integration.yard-trip-processor/deliver
pool: yard-process-pool
connection: acme-yard # its service account signs the delivery
mode: IMMEDIATE
batchSize: 1
dataOnly: true # deliver the XML itself, not the envelope
Terminal window
curl -X POST https://ingest.example.com/ingest/acme/yard-trip \
-H "Authorization: Bearer $TOKEN" -H "Content-Type: application/xml" \
-H "Idempotency-Key: trip-4711" --data-binary @trip.xml
# {"accepted":true,"jobId":"..."}
application: shop-integration
client: acme
code: orders
name: Orders (push)
source:
kind: http
auth:
kind: bearer
token: {name: orders-push-token} # a secret of client acme
accept:
contentTypes: [application/json]
body: JSON
split:
kind: json
arrayPath: $.orders # one record per element
target:
kind: EVENT
code: shop:orders:order:received # an existing event type
batchSize: 100
Terminal window
curl -X POST https://ingest.example.com/ingest/acme/orders \
-H "Authorization: Bearer $PUSH_TOKEN" -H "Content-Type: application/json" \
-H "X-Message-Group: tenant-7" -H "Idempotency-Key: batch-2026-10-31-1" \
-d '{"orders": [{"id": 1}, {"id": 2}]}'
# {"accepted":true,"eventIds":["...","..."]}

Sending the same request again answers the same two event ids and stores nothing new.

Keeping environment detail out of the file

Section titled “Keeping environment detail out of the file”

A definition that is the same in every environment keeps auth, accept, rateLimit and the delivery address out of the file. The source names a settings entry (source: {kind: http, config: yard-trip}) and the entry holds {"auth": {...}, "accept": {...}, "targetUrl": "..."} per environment. See Definition files and sets.

When a post misbehaves, Troubleshoot ingestion covers traces, which show the request and the exchange the runtime saw.