Skip to main content
Use these endpoints to create and manage webhooks that notify your application when field boundaries change, machine files finish processing, field operations are created, provider credentials expire, or satellite images are ready. For conceptual background, see Alerts Overview.

Base URL

https://api.withleaf.io/services/alerts/api/alerts

Endpoints

DescriptionMethodPath
Create a webhookPOST/webhooks
Get a webhookGET/webhooks/{id}
Get all webhooksGET/webhooks
Get failed callsGET/webhooks/failed-calls
Delete a webhookDELETE/webhooks/{id}
You cannot update a webhook. To change an existing webhook, delete it and create a new one. Keep the previous URL running until the new webhook is confirmed.
On delivery failure, Leaf retries at 1, 30, 60, and 240 minutes after the initial attempt.

Available events

You can subscribe to any combination of these events: Credentials
EventDescription
credentialsLimitedPermissionProvider credentials have limited permissions.
credentialsUnauthenticatedProvider credentials are no longer authenticated.
Fields and boundaries
EventDescription
fieldCreatedA field is created.
fieldUpdatedA field is updated.
fieldBoundaryCreatedA field boundary is created.
fieldBoundaryUpdatedA field boundary is updated.
fieldBoundaryDeletedA field boundary is deleted.
mergedFieldCreatedA merged field is created.
mergedFieldUpdatedA merged field is updated.
Machine files
EventDescription
uploadedFileProcessingFinishedAn uploaded machine file finishes processing.
uploadedFileProcessingFailedAn uploaded machine file fails processing.
providerFileProcessingFinishedA provider-synced machine file finishes processing.
providerFileProcessingFailedA provider-synced machine file fails processing.
mergedFileProcessingFinishedA merged file finishes processing.
mergedFileProcessingFailedA merged file fails processing.
automergedFileProcessingFinishedAn auto-merged field operation file finishes processing.
automergedFileProcessingFailedAn auto-merged field operation file fails processing.
batchUploadProcessingFinishedAll files in a batch upload have finished processing.
Field operations
EventDescription
operationCreatedA field operation is created.
operationUpdatedA field operation is updated.
operationProcessingFinishedA field operation finishes processing.
operationProcessingFailedA field operation fails processing.
Satellite imagery
EventDescription
newSatelliteImageA new satellite image is available.
satelliteSubscriptionFailedA satellite subscription fails.
Assets (Beta)
EventDescription
machineCreatedA machine is created.
machineUpdatedA machine is updated.
machineDeletedA machine is deleted.
implementCreatedAn implement is created.
implementUpdatedAn implement is updated.
operatorCreatedAn operator is created.
operatorUpdatedAn operator is updated.
Workflows (Beta)
EventDescription
workflowProcessingFinishedA workflow finishes processing.
workflowProcessingFailedA workflow fails processing.
Irrigation
EventDescription
newIrrigationActivityA new irrigation activity is available.
newFieldIrrigationActivityA new field irrigation activity is available.
Provider organizations
EventDescription
providerOrganizationCreatedA provider organization is created.
providerOrganizationBlockedA provider organization is blocked.
providerOrganizationRemovedA provider organization is removed.
You cannot register two webhooks that listen to the same event. Attempting to do so returns a 400 response with error eventRegisteredTwice.

Create a webhook

POST /webhooks Creates a webhook and begins delivering matching events immediately.

Request body

ParameterTypeRequiredDescription
eventsstring[]YesArray of event names from the available events list.
namestringYesDisplay name for the webhook.
secretstringYesSecret used for HMAC signature verification of payloads.
urlstringYesA valid HTTP(S) URL where Leaf delivers event payloads.

Request

curl -X POST \
  -H 'Content-Type: application/json' \
  -H 'Authorization: Bearer YOUR_TOKEN' \
  -d '{
    "events": ["fieldCreated", "operationCreated"],
    "name": "Field and operation listener",
    "secret": "your-hmac-secret",
    "url": "https://example.com/webhooks/leaf"
  }' \
  'https://api.withleaf.io/services/alerts/api/alerts/webhooks'

Response

{
  "id": "uuid",
  "events": ["fieldCreated", "operationCreated"],
  "name": "Field and operation listener",
  "secret": "your-hmac-secret",
  "url": "https://example.com/webhooks/leaf"
}

Get a webhook

GET /webhooks/{id} Returns a single webhook by its ID.

Parameters

ParameterTypeLocationRequiredDescription
idstringpathYesUUID of the webhook.

Request

curl -X GET \
  -H 'Authorization: Bearer YOUR_TOKEN' \
  'https://api.withleaf.io/services/alerts/api/alerts/webhooks/{id}'

Response

{
  "id": "uuid",
  "events": ["fieldCreated", "operationCreated"],
  "name": "Field and operation listener",
  "secret": "your-hmac-secret",
  "url": "https://example.com/webhooks/leaf"
}

Get all webhooks

GET /webhooks Returns all webhooks registered for the API owner.

Request

curl -X GET \
  -H 'Authorization: Bearer YOUR_TOKEN' \
  'https://api.withleaf.io/services/alerts/api/alerts/webhooks'

Response

[
  {
    "id": "uuid",
    "events": ["fieldCreated", "operationCreated"],
    "name": "Field and operation listener",
    "secret": "your-hmac-secret",
    "url": "https://example.com/webhooks/leaf"
  }
]

Get failed calls

GET /webhooks/failed-calls Returns a paginated list of failed webhook delivery attempts when any exist. Use the nextPageToken value from a response to fetch the next page. If no failed calls are available for the API owner, this endpoint returns 404.

Parameters

ParameterTypeLocationRequiredDescription
nextPageTokenstringqueryNoToken returned in the previous response to retrieve the next page.

Request

curl -X GET \
  -H 'Authorization: Bearer YOUR_TOKEN' \
  'https://api.withleaf.io/services/alerts/api/alerts/webhooks/failed-calls'

# To fetch the next page:
curl -X GET \
  -H 'Authorization: Bearer YOUR_TOKEN' \
  'https://api.withleaf.io/services/alerts/api/alerts/webhooks/failed-calls?nextPageToken=TOKEN_VALUE'

Response

{
  "items": [
    {
      "apiOwner": "your-api-owner",
      "createdAt": "2026-01-15T12:16:30Z",
      "url": "https://example.com/webhooks/leaf",
      "status": 502,
      "response": "Bad Gateway",
      "requestBody": "{\"leafUserId\":\"uuid\",\"fileId\":\"uuid\",\"type\":\"automergedFileProcessingFinished\",\"timestamp\":\"2026-01-15T12:16:27Z\"}"
    },
    {
      "apiOwner": "your-api-owner",
      "createdAt": "2026-01-15T14:10:05Z",
      "url": "https://example.com/webhooks/leaf",
      "connectionError": "ConnectionError: Remote end closed connection without response"
    }
  ],
  "nextPageToken": "eyJsYXN0..."
}

Delete a webhook

DELETE /webhooks/{id} Deletes a webhook. Returns 204 No Content on success. Leaf stops delivering events for this webhook immediately.

Parameters

ParameterTypeLocationRequiredDescription
idstringpathYesUUID of the webhook.

Request

curl -X DELETE \
  -H 'Authorization: Bearer YOUR_TOKEN' \
  'https://api.withleaf.io/services/alerts/api/alerts/webhooks/{id}'

Last modified on March 24, 2026