Skip to main content

Managing subscriptions

A subscription tells RCM where to POST events, which event types to send, and how to authenticate each delivery. Everything on this page lives under /v1/integration/webhooks and is scoped to the provider in your OAuth2 token — you only ever see and manage your own subscriptions.

Reading subscriptions and managing them are enabled separately on your OAuth2 client. If a call returns 403, ask Integraciones to enable webhook-subscription management for your client.

Create a subscription​

POST /v1/integration/webhooks
Content-Type: application/json
Authorization: Bearer <token>

Request​

FieldTypeRequiredDescription
webhook_urlstringyesWhere RCM POSTs events. Max 500 chars, must match ^https?://.*. Use HTTPS outside local testing. Must be unique among your provider's subscriptions — you cannot create two subscriptions with the same URL.
subscribed_event_typesstring[]noEvent types to receive. Omit or send [] to receive every event type — see choosing event types. Values are not validated: a misspelled type is accepted and simply never matches.
auth_typeHMAC | BASICnoDefaults to HMAC. See Authentication.
basic_auth_client_idstringconditionalRequired when auth_type is BASIC. Max 255 chars.
basic_auth_client_secretstringconditionalRequired when auth_type is BASIC. Max 255 chars. Stored encrypted, never returned.
custom_headersobjectnoExtra headers sent on every delivery, e.g. an API key of your own. String values only.
descriptionstringnoFree text to identify the subscription. Max 500 chars.
metadataobjectnoFree-form object for your own bookkeeping.

HMAC example (the default)​

curl -X POST https://sandbox.osigu.com/rcm/v1/integration/webhooks \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{
"webhook_url": "https://his.hospital.com.br/webhooks/rcm",
"subscribed_event_types": [
"DOCUMENT_CLASSIFICATION_COMPLETED",
"DOCUMENT_CLASSIFICATION_FAILED",
"DOCUMENT_VALIDATION_COMPLETED",
"DOCUMENT_VALIDATION_REJECTED"
],
"description": "HIS receiver — support file outcomes"
}'

Basic-auth example​

curl -X POST https://sandbox.osigu.com/rcm/v1/integration/webhooks \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{
"webhook_url": "https://mirth.hospital.com.br/rcm-inbound",
"subscribed_event_types": ["DOCUMENT_VALIDATION_COMPLETED", "DOCUMENT_VALIDATION_REJECTED"],
"auth_type": "BASIC",
"basic_auth_client_id": "hospital-mirth",
"basic_auth_client_secret": "•••••••••",
"custom_headers": {"X-Channel": "rcm-support-files"},
"description": "Mirth channel — validation only"
}'

Response (201 Created)​

{
"id": "9b1c7f52-4a3e-4b8d-9f21-6c0d5e8a7b43",
"webhook_url": "https://his.hospital.com.br/webhooks/rcm",
"delivery_method": "PUSH",
"subscribed_event_types": [
"DOCUMENT_CLASSIFICATION_COMPLETED",
"DOCUMENT_CLASSIFICATION_FAILED",
"DOCUMENT_VALIDATION_COMPLETED",
"DOCUMENT_VALIDATION_REJECTED"
],
"status": "ACTIVE",
"auth_type": "HMAC",
"max_retry_attempts": 5,
"retry_backoff_seconds": 60,
"consecutive_failures": 0,
"circuit_breaker_threshold": 10,
"circuit_breaker_reset_after_seconds": 3600,
"total_events_sent": 0,
"total_events_failed": 0,
"custom_header_names": [],
"connection_timeout_ms": 5000,
"read_timeout_ms": 30000,
"description": "HIS receiver — support file outcomes",
"created_at": "2026-08-04T09:12:44.120-06:00",
"created_by": "integrations@hospital.com.br"
}

Note what is not in the response:

  • The HMAC secret. RCM generates one (256 bits, Base64) when auth_type is HMAC, but never returns it on this or any other endpoint. See getting the secret.
  • basic_auth_client_secret. Stored encrypted at rest and never echoed back. Only basic_auth_client_id comes back.
  • Your custom_headers values. Only the names come back, in custom_header_names.

Delivery starts immediately: status is ACTIVE from creation.

Choosing event types​

subscribed_event_types is a filter applied at delivery time. Two things to know:

  • An empty array (or omitting the field) means "everything", not "nothing". RCM does not emit any event family for a provider until OSIGU enables it — the document events included — and account, charge, invoice and settlement events can be enabled later. An unfiltered subscription can therefore start quiet and later receive far more traffic than you expected. Be explicit unless you really want all of it.
  • One subscription can carry several event types, and you can also split them across subscriptions pointed at different URLs. Splitting is useful when different systems own different outcomes:
# Subscription 1 → the HIS, which files the approved document
{"webhook_url": "https://his.hospital.com.br/webhooks/rcm-approved",
"subscribed_event_types": ["DOCUMENT_VALIDATION_COMPLETED"]}

# Subscription 2 → the billing team's queue, which works the rejections
{"webhook_url": "https://ops.hospital.com.br/webhooks/rcm-rejected",
"subscribed_event_types": ["DOCUMENT_VALIDATION_REJECTED", "DOCUMENT_CLASSIFICATION_FAILED"]}

Each subscription has its own auth and its own circuit breaker. Retries, however, are counted per event, not per subscription. When an event matches several subscriptions, RCM attempts all of them in the same cycle and marks the event delivered as soon as any one answers 2xx. A subscription that failed in that cycle is not retried for that event. If your systems must each receive every event, give each one subscriptions with non-overlapping event types, as in the example above.

The event types for the support-file flow are listed in the event catalog.

Getting your HMAC secret​

The signing secret is generated server-side and is never exposed through the API — not on create, not on read. To receive it, request it from the Integraciones team (support@osigu.com) referencing your subscription id. It is delivered out of band.

There is also no self-service rotation endpoint. Rotation is performed by the Integraciones team on request. Because a new secret takes effect on the next delivery, coordinate a cutover window and accept both secrets while it runs — see secret rotation without downtime.

For BASIC subscriptions you own the credentials, so you can rotate them yourself with a PUT (below): send a new basic_auth_client_secret and accept both values on your side during the window.

Delivery, retries and timeouts​

These are properties of the subscription, set by RCM at creation. They are returned on every read so you can see what your subscription is actually operating with:

FieldDefaultMeaning
connection_timeout_ms5000How long RCM waits to establish the TCP connection.
read_timeout_ms30000How long RCM waits for your response after sending the request. Return 2xx before this — acknowledge first, process asynchronously.
max_retry_attempts5Stored and returned on the subscription, but not currently applied. The attempt limit is set per event by RCM (5 attempts) and does not change with this value. Treat it as informational.
retry_backoff_seconds60Stored and returned on the subscription, but not currently applied by the dispatcher — retries are paced by its once-per-minute cycle, not by this value. Treat it as informational.
circuit_breaker_threshold10Consecutive failures that trip the breaker for this subscription.
circuit_breaker_reset_after_seconds3600How long the breaker stays open before RCM re-activates the subscription automatically.

How it behaves in practice:

  1. The dispatcher runs once per minute and picks up pending events in batches, oldest first.
  2. Anything that is not a 2xx — including a connection error or a timeout — counts as a failed attempt. The event stays pending and is retried on a later cycle until it reaches 5 attempts, after which it is marked ERROR and no longer retried. There is no exponential backoff: attempts are paced by the dispatcher cycle, so an event is given up roughly five minutes after its first failure.
  3. Failures also increment consecutive_failures on the subscription. At circuit_breaker_threshold the subscription flips to ERROR and stops receiving deliveries. A background job re-checks every few minutes and re-activates it once circuit_breaker_reset_after_seconds has elapsed; you can also reset it manually.
  4. A successful delivery resets consecutive_failures to zero.

Watch consecutive_failures, total_events_failed and last_successful_delivery_at on the subscription to tell "my receiver is fine" from "RCM stopped sending because my receiver kept failing".

Tracking headers​

Every delivery carries the headers documented in common headers. For correlation and idempotency:

HeaderUse
X-RCM-Event-IDThis is your idempotency key. A UUID that identifies the event and stays the same across every retry of it. Dedupe on this.
X-RCM-Event-TypeRoute without parsing the body.
X-RCM-TimestampDelivery/signature time. Reject deliveries skewed more than ~5 minutes.

There is no separate per-attempt delivery id header, and no attempt counter in the request. From the receiver's side a retry is indistinguishable from the first attempt except that X-RCM-Event-ID repeats — which is exactly why dedupe must be keyed on it and must happen before you apply any side effect.

Auxiliary endpoints​

List subscriptions​

GET /v1/integration/webhooks

Returns your provider's subscriptions as an array of the same resource shown above.

Get one subscription​

GET /v1/integration/webhooks/{webhookId}

An id that doesn't exist or doesn't belong to your provider currently returns 500 — see errors.

Update a subscription​

PUT /v1/integration/webhooks/{webhookId}

All fields are optional — send only what changes. Accepts the same fields as create, including auth_type and the basic-auth credentials, so this is how you switch a subscription between HMAC and BASIC or rotate your basic-auth secret.

curl -X PUT https://sandbox.osigu.com/rcm/v1/integration/webhooks/9b1c7f52-4a3e-4b8d-9f21-6c0d5e8a7b43 \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{"subscribed_event_types": ["DOCUMENT_VALIDATION_REJECTED"]}'

Returns 200 with the updated resource. Keep in mind:

  • custom_headers and metadata are replaced as a whole, not merged. To add one header, send the full map.
  • Switching auth_type to BASIC requires both credentials in the same request.
  • Switching from BASIC back to HMAC generates a new signing secret, which is not returned. Request it from Integraciones before the switch, or your receiver will reject the next deliveries.

Pause and resume​

POST /v1/integration/webhooks/{webhookId}/pause
POST /v1/integration/webhooks/{webhookId}/resume

Pausing sets status to PAUSED and stops deliveries; use it during a planned receiver outage instead of letting failures trip the circuit breaker. Resume returns it to ACTIVE; it only works on a paused subscription (otherwise it currently returns 500 — see errors).

Events that occur while paused are held as pending and do not consume delivery attempts: they are delivered once you resume, however long the pause. Two caveats:

  • If another active subscription of yours matches the same event, the event is delivered there and marked delivered — the paused subscription will not receive it on resume.
  • Held events stay at the head of the queue. A long pause with a large backlog can delay deliveries to your other subscriptions, so prefer short windows.

Reset the circuit breaker​

POST /v1/integration/webhooks/{webhookId}/reset-circuit-breaker

Clears the failure counter and returns a subscription in ERROR to ACTIVE, without waiting for the automatic reset. It only works on a subscription in ERROR (otherwise it currently returns 500 — see errors). Fix your receiver first — resetting into a still-broken endpoint just trips the breaker again.

Events that arrived while the breaker was open were kept pending without consuming attempts, so they are delivered after the reset.

Delete a subscription​

DELETE /v1/integration/webhooks/{webhookId}

204 No Content. This is a soft delete: the record is disabled and deliveries stop.

Errors​

Errors use the standard error format.

SituationStatus
A request field fails validation: missing or malformed webhook_url, a field over its maximum length, BASIC without both credentials422
Your client is not enabled for the operation403
Unknown webhookId, or one that belongs to another provider500 (code 055-1000)
webhook_url already used by another of your subscriptions500 (code 055-1000)
resume on a subscription that is not paused, or reset-circuit-breaker on one that is not in ERROR500 (code 055-1000)
The 500s above are a known limitation

These cases should return 404, 409 and 400 respectively. Today they come back as a generic 500, so the status code alone doesn't tell them apart from a real server failure. Before retrying a 500 on these endpoints, check the subscription with GET. When this is fixed, the change will be announced in the changelog.

Next steps​