POST
/
webhook-subscriptions
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io/ioutil"
)

func main() {

	url := "https://api.{gr4vy_id}.gr4vy.app/webhook-subscriptions"

	payload := strings.NewReader("{\n  \"active\": true,\n  \"url\": \"https://example.com/webhooks\",\n  \"authentication\": {\n    \"kind\": \"basic\",\n    \"username\": \"username\",\n    \"password\": \"password\"\n  }\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("Authorization", "Bearer <token>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := ioutil.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
{
  "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 length: 255
Example:

"default"

Body

application/json

Response

200
application/json

Returns the new webhook subscription.

The response is of type object.