Skip to main content
POST
/
webhook-subscriptions
New webhook subscription
using RestSharp;


var options = new RestClientOptions("https://api.sandbox.{id}.gr4vy.app/webhook-subscriptions");
var client = new RestClient(options);
var request = new RestRequest("");
request.AddHeader("Authorization", "Bearer <token>");
request.AddJsonBody("{\n  \"active\": true,\n  \"url\": \"https://example.com/webhooks\",\n  \"authentication\": {\n    \"kind\": \"basic\",\n    \"username\": \"username\",\n    \"password\": \"password\"\n  }\n}", false);
var response = await client.PostAsync(request);

Console.WriteLine("{0}", response.Content);
{
  "type": "webhook-subscription",
  "id": "8fd77b13-a5e3-43de-bd54-26a8a714ac18",
  "merchant_account_id": "default",
  "active": true,
  "url": "https://example.com/webhooks",
  "authentication": {
    "kind": "basic",
    "username": "username",
    "password": "password"
  },
  "secret": "234567890abcdef1234567890abcdef",
  "rotating": false
}
This endpoint requires the webhook-subscriptions.write scope.

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Headers

X-Gr4vy-Merchant-Account-ID
string

The ID of the merchant account to act upon. When not or provided, this value will default to the first merchant account a user has access to. This value can be set to * on some APIs to fetch resources from all merchant accounts.

Maximum string length: 255
Example:

"default"

Body

application/json
active
boolean

Defines if this subscription is currently active or not. When deactivated, webhook events are not sent to the endpoint configured for this subscription.

Example:

true

url
string<uri>

The URL of the endpoint to deliver webhook events to.

Example:

"https://example.com/webhooks"

authentication
Webhook subscription authentication · object

Response

Returns the new webhook subscription.

type
enum<string>

webhook-subscription.

Available options:
webhook-subscription
Example:

"webhook-subscription"

id
string

The unique Gr4vy ID for this webhook subscription.

Example:

"8fd77b13-a5e3-43de-bd54-26a8a714ac18"

merchant_account_id
string | null

The unique ID for a merchant account.

Example:

"default"

active
boolean

Defines if this subscription is currently active or not. When deactivated, webhook events are not sent to the endpoint configured for this subscription.

Example:

true

url
string<uri>

The URL of the endpoint to deliver webhook events to.

Example:

"https://example.com/webhooks"

authentication
Webhook subscription authentication · object
secret
string | null

The active secret value.

Example:

"234567890abcdef1234567890abcdef"

rotating
boolean

Flag to determine whether the subscription has a secret rotation in progress or not.

Example:

false