Skip to content

Request access

Tell us about your processing, and we'll reply by email.

API reference

Webhook

Where events go, the low balance alerts of your gas wallet, and the signing secret. The events themselves: Webhook events.

GET/v1/webhook

StatusDescription
200Your webhook settings. Returns Webhook.
401unauthorized: no API key, an unknown one or a revoked one.
403partner_disabled: your account is disabled.
404not_found: no webhook is set.
Terminal window
curl "https://api-testnet.portuna.io/v1/webhook" \
-H "Authorization: Bearer $PORTUNA_API_KEY"
200 OK
{
"url": "https://processing.example/hooks/sweeps",
"secret": "whsec_q8Kx2mR4tY7uI0oP3aS6dF9gH1jK5lZ8xC2vB4nM7qW",
"low_balance": [
{
"chain_id": 11155111,
"threshold": "20000000000000000",
"low": false
}
]
}

PUT/v1/webhook

Sets the URL events go to and the low balance alerts of your gas wallet. Only public https addresses; redirects are not followed. The response carries the secret that signs deliveries: it is created with the webhook and stays the same when the URL changes. low_balance replaces all the alerts: chains without a threshold there get no alert, and a request without low_balance removes them all.

FieldTypeDescription
url requiredstring (uri)Where events go. Up to 2048 characters.
low_balancearray of objectLow balance alerts of your gas wallet, at most one per chain.
low_balance[].chain_id requiredChainIDThe chain’s id (EIP-155): 11155111 Sepolia and 97 BSC testnet with a test key, 1 Ethereum and 56 BSC with a live key.
low_balance[].threshold requiredAmountAlert when the gas wallet’s balance on this chain falls below this, in wei; above zero.
StatusDescription
200The webhook is set. Returns Webhook.
400invalid_json: the body is not JSON, is over 64 KiB or has unknown fields.
401unauthorized: no API key, an unknown one or a revoked one.
403partner_disabled: your account is disabled.
422invalid_url: the URL is not a public https URL; unknown_chain: a chain in low_balance is not supported or is listed twice; invalid_amount: a threshold is not an integer above zero.
Terminal window
curl -X PUT "https://api-testnet.portuna.io/v1/webhook" \
-H "Authorization: Bearer $PORTUNA_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"url": "https://processing.example/hooks/sweeps",
"low_balance": [
{
"chain_id": 11155111,
"threshold": "20000000000000000"
}
]
}'
200 OK
{
"url": "https://processing.example/hooks/sweeps",
"secret": "whsec_q8Kx2mR4tY7uI0oP3aS6dF9gH1jK5lZ8xC2vB4nM7qW",
"low_balance": [
{
"chain_id": 11155111,
"threshold": "20000000000000000",
"low": false
}
]
}

DELETE/v1/webhook

Removes the webhook and its low balance alerts. Events not delivered yet are dropped: they show as failed in the delivery log. A webhook set again later gets a new secret.

StatusDescription
204Deleted.
401unauthorized: no API key, an unknown one or a revoked one.
403partner_disabled: your account is disabled.
404not_found: no webhook is set.
Terminal window
curl -X DELETE "https://api-testnet.portuna.io/v1/webhook" \
-H "Authorization: Bearer $PORTUNA_API_KEY"

GET/v1/webhook/deliveries

Your events, newest first, and how their delivery went. An event that was delivered, or failed for good, is kept for 90 days.

NameInTypeDescription
limitqueryintegerHow many rows a page holds. From 1 to 200. Default: 50.
cursorquerystringThe next_cursor of the previous page; none for the first page.
StatusDescription
200A page of events. Returns the fields below.
400invalid_query: a query parameter is not valid; message says which.
401unauthorized: no API key, an unknown one or a revoked one.
403partner_disabled: your account is disabled.
FieldTypeDescription
items requiredarray of WebhookDelivery
next_cursor requiredNextCursorThe cursor of the next page; null on the last page.
Terminal window
curl "https://api-testnet.portuna.io/v1/webhook/deliveries?limit=2" \
-H "Authorization: Bearer $PORTUNA_API_KEY"
200 OK
{
"items": [
{
"id": "4b8e0d6a-2c1f-4e37-9a55-0f6d3b2e1c84",
"event": "transaction.mined",
"status": "pending",
"attempts": 2,
"last_status_code": 502,
"last_error": "status 502",
"created_at": "2026-10-27T10:05:00Z",
"delivered_at": null,
"next_attempt_at": "2026-10-27T10:05:31Z"
},
{
"id": "7e2c9a41-3b5d-4f60-8c17-d9a0e4b2f816",
"event": "transaction.mined",
"status": "delivered",
"attempts": 1,
"last_status_code": 204,
"last_error": null,
"created_at": "2026-10-27T10:01:12Z",
"delivered_at": "2026-10-27T10:01:13Z",
"next_attempt_at": null
}
],
"next_cursor": "eyJ0IjoiMjAyNi0xMC0yN1QxMDowMToxMloiLCJpZCI6IjdlMmM5YTQxIn0"
}

POST/v1/webhook/test

Queues a sample transaction.mined event, with test: true in its data. It is signed and delivered like any other event, and shows in the delivery log. Nothing in it is real: transaction 0, sweeps with zero ids, a hash of zeros.

StatusDescription
202The event is queued. Returns the fields below.
401unauthorized: no API key, an unknown one or a revoked one.
403partner_disabled: your account is disabled.
404not_found: no webhook is set.
FieldTypeDescription
id requiredstring (uuid)The event’s id, as in the delivery and in the delivery log.
Terminal window
curl -X POST "https://api-testnet.portuna.io/v1/webhook/test" \
-H "Authorization: Bearer $PORTUNA_API_KEY"
202 Accepted
{
"id": "4b8e0d6a-2c1f-4e37-9a55-0f6d3b2e1c84"
}