Create Event Subscription
post
/v1/besu/event-subscriptions
Creates a callback-based subscription for newHeads or filtered logs events, with optional block ranges, retry settings, OAuth, and TLS configuration. It returns the newly created subscription, including its ID and running status.
Request
There are no request parameters for this operation.
Supported Media Types
- application/json
Root Schema : schema
Type:
objectRequest to create a Besu event subscription. Supports recoverable event types only: `newHeads` and `logs`. `logsFilter` is only valid when `type=logs`.
`nonEmptyBlocksOnly` is only valid when `type=newHeads`.
Show Source
-
callbackUrl(required): string
(uri)
HTTPS callback endpoint. HTTP endpoints are rejected by default.
-
confirmations: integer
Minimum Value:
0Required block confirmations before callbacks are emitted. -
endBlock: integer
(int64)
Minimum Value:
0Highest block number to process before the subscription is considered complete. -
expiresAt: string
(date-time)
Optional RFC 3339 timestamp after which the subscription is automatically expired.
-
logsFilter: object
EventSubscriptionLogsFilter
Log filter criteria for a
logsevent subscription. Topic positions are ordered. Nested topic arrays (OR topic sets) are not supported.The filter is validated witheth_getLogswhen the subscription is created. -
maxCallbackRetry: integer
Minimum Value:
1Maximum number of delivery attempts before a payload is dead-lettered. -
nonEmptyBlocksOnly: boolean
When
true,newHeadscallbacks are emitted only for blocks that contain at least one transaction; empty blocks are not delivered. -
oauth: object
EventSubscriptionOAuthConfig
OAuth 2.0 configuration for callback authentication.
-
retryBaseMs: integer
Minimum Value:
1Initial delay in milliseconds used when scheduling callback retries. -
retryMaxMs: integer
Minimum Value:
1Upper bound in milliseconds for retry backoff; must be greater than or equal toretryBaseMs. -
startBlock: integer
(int64)
Minimum Value:
0Earliest block number to begin processing; omit to start from the current chain state. -
tls: object
EventSubscriptionTlsConfig
TLS or mTLS configuration for callback delivery. If mTLS is used, both
clientCertandclientKeymust be provided together. -
type(required): string
Allowed Values:
[ "newHeads", "logs" ]Event type to subscribe to; supported values arenewHeadsandlogs.
Nested Schema : EventSubscriptionLogsFilter
Type:
objectLog filter criteria for a
Show Source
logs event subscription. Topic positions are ordered. Nested topic arrays (OR topic sets) are not supported.The filter is validated with eth_getLogs when the subscription is created.-
address: string
Minimum Length:
42Maximum Length:42Pattern:^0x[0-9a-fA-F]{40}$Contract address whose logs are included. -
topics: array
topics
Maximum Number of Items:
4Ordered topic filters; use null entries as wildcards for positional topics.
Nested Schema : EventSubscriptionOAuthConfig
Type:
objectOAuth 2.0 configuration for callback authentication.
Show Source
-
authInHeader: boolean
Default Value:
trueControls OAuth token request client-auth placement. When true, sends `clientId:clientSecret` in an HTTP Basic Authorization header to the token endpoint. When false, sendsclient_idandclient_secretform fields in the token request body. -
clientId(required): string
OAuth 2.0 client identifier registered for the callback endpoint.
-
clientSecret(required): string
OAuth 2.0 client secret used for token acquisition.
-
grantType: string
Default Value:
client_credentialsAllowed Values:[ "client_credentials", "refresh_token" ]OAuth 2.0 token grant used for callback access-token acquisition.client_credentialsobtains an access token with the configured client credentials.refresh_tokenuses the suppliedrefreshTokenand retains any replacement refresh token returned by the identity provider. -
refreshToken: string
Required when
grantType=refresh_token; pre-provisioned OAuth refresh token used to mint callback access tokens. -
scopes: string
Space-delimited OAuth scopes requested during token exchange.
-
tls: object
EventSubscriptionTlsConfig
TLS or mTLS configuration for callback delivery. If mTLS is used, both
clientCertandclientKeymust be provided together. -
tokenTls: object
EventSubscriptionTlsConfig
TLS or mTLS configuration for callback delivery. If mTLS is used, both
clientCertandclientKeymust be provided together. -
tokenUrl(required): string
(uri)
OAuth 2.0 token endpoint used to obtain access tokens for callbacks.
Match All
OAuth 2.0 configuration for callback authentication.
Show Source
Nested Schema : EventSubscriptionTlsConfig
Type:
objectTLS or mTLS configuration for callback delivery. If mTLS is used, both
Show Source
clientCert and clientKey must be provided together.-
caCert: string
PEM-encoded CA certificate used to verify callback server certificates.
-
clientCert: string
PEM-encoded client certificate for callback mTLS.
-
clientKey: string
PEM-encoded PKCS#8 private key for callback mTLS.
-
insecureSkipVerify: boolean
Default Value:
falseWhentrue, skips TLS certificate verification. Use only in controlled non-production environments.
Nested Schema : topics
Type:
arrayMaximum Number of Items:
4Ordered topic filters; use null entries as wildcards for positional topics.
Show Source
-
Array of:
[
"string",
"null"
]
Minimum Length:
66Maximum Length:66Pattern:^0x[0-9a-fA-F]{64}$
Examples
Back to Top
Response
Supported Media Types
- application/json
201 Response
Returns the created event subscription.
Root Schema : EventSubscriptionResponse
Type:
objectEvent subscription configuration and current lifecycle state.
Show Source
-
callbackUrl: string
HTTPS endpoint receiving callback deliveries.
-
confirmations: integer
Block confirmation threshold configured for the subscription.
-
cursor: object
EventSubscriptionCursor
Event processing position for an event subscription.
-
endBlock: integer
(int64)
Final block number to process before stopping, when provided.
-
expiresAt: string
(date-time)
Timestamp after which the subscription is automatically considered expired.
-
nonEmptyBlocksOnly: boolean
Indicates whether empty
newHeadsblocks are suppressed for this subscription. -
startBlock: integer
(int64)
First block number considered when replaying events, when provided.
-
stateChangedAt: string
(date-time)
Timestamp when the lifecycle status was most recently updated.
-
stateReason: string
Optional transition reason for terminal state changes.
-
status: string
Current lifecycle state of the subscription (
running,stopped,deleted,completed, orexpired). -
subId: string
Unique identifier for the subscription.
-
type: string
Event type for the subscription (
newHeadsorlogs).
Nested Schema : EventSubscriptionCursor
Type:
objectEvent processing position for an event subscription.
Show Source
-
lastFinalizedBlock: integer
(int64)
Most recent finalized block used for head progression.
-
lastFinalizedBlockHash: string
Block hash for
lastFinalizedBlock, when known. -
lastLogBlock: integer
(int64)
Most recent block used for log delivery.
-
lastLogBlockHash: string
Block hash for
lastLogBlock, when known. -
lastLogIndex: integer
Last delivered log index in
lastLogBlockwhen resuming within-block. -
lastLogTxIndex: integer
Last delivered transaction index in
lastLogBlockwhen resuming within-block.
Examples
400 Response
Validation failed.
Root Schema : ErrorResponse
Type:
objectError response returned by the service.
Show Source
-
decodedError:
Returned only when `decode.errors=true` and decodable revert bytes are present.
-
error: string
Short error summary suitable for display.
-
hint: [
"string",
"null"
]
Optional guidance for resolving the error.
-
message: [
"string",
"null"
]
Additional error details, when available.
-
policy:
Present for policy warnings or denials such as preflight failure.
-
preflight:
Present for preflight-gated transaction submission errors.
-
requestId: [
"string",
"null"
]
Client-provided correlation ID echoed in the response.
-
upstreamCode: [
"integer",
"null"
]
Besu node error code, when provided by the RPC endpoint.
-
upstreamData: [
"string",
"null"
]
Error data returned by the Besu node in 0x-prefixed hexadecimal or JSON format, when available.
-
upstreamError: [
"object",
"null"
]
upstreamError
Additional Properties Allowed:
trueComplete error object returned by the Besu node, including code, message, and data fields, when available.
Nested Schema : upstreamError
Type:
objectAdditional Properties Allowed:
trueComplete error object returned by the Besu node, including code, message, and data fields, when available.
Examples
500 Response
Unexpected service error.
Root Schema : ErrorResponse
Type:
objectError response returned by the service.
Show Source
-
decodedError:
Returned only when `decode.errors=true` and decodable revert bytes are present.
-
error: string
Short error summary suitable for display.
-
hint: [
"string",
"null"
]
Optional guidance for resolving the error.
-
message: [
"string",
"null"
]
Additional error details, when available.
-
policy:
Present for policy warnings or denials such as preflight failure.
-
preflight:
Present for preflight-gated transaction submission errors.
-
requestId: [
"string",
"null"
]
Client-provided correlation ID echoed in the response.
-
upstreamCode: [
"integer",
"null"
]
Besu node error code, when provided by the RPC endpoint.
-
upstreamData: [
"string",
"null"
]
Error data returned by the Besu node in 0x-prefixed hexadecimal or JSON format, when available.
-
upstreamError: [
"object",
"null"
]
upstreamError
Additional Properties Allowed:
trueComplete error object returned by the Besu node, including code, message, and data fields, when available.
Nested Schema : upstreamError
Type:
objectAdditional Properties Allowed:
trueComplete error object returned by the Besu node, including code, message, and data fields, when available.
Examples
503 Response
Event subscriptions are unavailable.
Root Schema : ErrorResponse
Type:
objectError response returned by the service.
Show Source
-
decodedError:
Returned only when `decode.errors=true` and decodable revert bytes are present.
-
error: string
Short error summary suitable for display.
-
hint: [
"string",
"null"
]
Optional guidance for resolving the error.
-
message: [
"string",
"null"
]
Additional error details, when available.
-
policy:
Present for policy warnings or denials such as preflight failure.
-
preflight:
Present for preflight-gated transaction submission errors.
-
requestId: [
"string",
"null"
]
Client-provided correlation ID echoed in the response.
-
upstreamCode: [
"integer",
"null"
]
Besu node error code, when provided by the RPC endpoint.
-
upstreamData: [
"string",
"null"
]
Error data returned by the Besu node in 0x-prefixed hexadecimal or JSON format, when available.
-
upstreamError: [
"object",
"null"
]
upstreamError
Additional Properties Allowed:
trueComplete error object returned by the Besu node, including code, message, and data fields, when available.
Nested Schema : upstreamError
Type:
objectAdditional Properties Allowed:
trueComplete error object returned by the Besu node, including code, message, and data fields, when available.
Examples