Skip to main content
Register Webhook Event
curl --request POST \
  --url https://api.yapily.com/webhook/events \
  --header 'Authorization: Basic <encoded-value>' \
  --header 'Content-Type: application/json;charset=UTF-8' \
  --data '
{
  "applicationId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
  "categories": [
    "<string>"
  ],
  "callbackUrl": {
    "main": {
      "url": "<string>"
    },
    "backup": {
      "url": "<string>"
    }
  },
  "metadata": {}
}
'
import requests

url = "https://api.yapily.com/webhook/events"

payload = {
    "applicationId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
    "categories": ["<string>"],
    "callbackUrl": {
        "main": { "url": "<string>" },
        "backup": { "url": "<string>" }
    },
    "metadata": {}
}
headers = {
    "Authorization": "Basic <encoded-value>",
    "Content-Type": "application/json;charset=UTF-8"
}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
const options = {
  method: 'POST',
  headers: {
    Authorization: 'Basic <encoded-value>',
    'Content-Type': 'application/json;charset=UTF-8'
  },
  body: JSON.stringify({
    applicationId: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
    categories: ['<string>'],
    callbackUrl: {main: {url: '<string>'}, backup: {url: '<string>'}},
    metadata: {}
  })
};

fetch('https://api.yapily.com/webhook/events', options)
  .then(res => res.json())
  .then(res => console.log(res))
  .catch(err => console.error(err));
<?php

$curl = curl_init();

curl_setopt_array($curl, [
  CURLOPT_URL => "https://api.yapily.com/webhook/events",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "POST",
  CURLOPT_POSTFIELDS => json_encode([
    'applicationId' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
    'categories' => [
        '<string>'
    ],
    'callbackUrl' => [
        'main' => [
                'url' => '<string>'
        ],
        'backup' => [
                'url' => '<string>'
        ]
    ],
    'metadata' => [
        
    ]
  ]),
  CURLOPT_HTTPHEADER => [
    "Authorization: Basic <encoded-value>",
    "Content-Type: application/json;charset=UTF-8"
  ],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
package main

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

func main() {

	url := "https://api.yapily.com/webhook/events"

	payload := strings.NewReader("{\n  \"applicationId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n  \"categories\": [\n    \"<string>\"\n  ],\n  \"callbackUrl\": {\n    \"main\": {\n      \"url\": \"<string>\"\n    },\n    \"backup\": {\n      \"url\": \"<string>\"\n    }\n  },\n  \"metadata\": {}\n}")

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

	req.Header.Add("Authorization", "Basic <encoded-value>")
	req.Header.Add("Content-Type", "application/json;charset=UTF-8")

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

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

	fmt.Println(string(body))

}
HttpResponse<String> response = Unirest.post("https://api.yapily.com/webhook/events")
  .header("Authorization", "Basic <encoded-value>")
  .header("Content-Type", "application/json;charset=UTF-8")
  .body("{\n  \"applicationId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n  \"categories\": [\n    \"<string>\"\n  ],\n  \"callbackUrl\": {\n    \"main\": {\n      \"url\": \"<string>\"\n    },\n    \"backup\": {\n      \"url\": \"<string>\"\n    }\n  },\n  \"metadata\": {}\n}")
  .asString();
require 'uri'
require 'net/http'

url = URI("https://api.yapily.com/webhook/events")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Basic <encoded-value>'
request["Content-Type"] = 'application/json;charset=UTF-8'
request.body = "{\n  \"applicationId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n  \"categories\": [\n    \"<string>\"\n  ],\n  \"callbackUrl\": {\n    \"main\": {\n      \"url\": \"<string>\"\n    },\n    \"backup\": {\n      \"url\": \"<string>\"\n    }\n  },\n  \"metadata\": {}\n}"

response = http.request(request)
puts response.read_body
{
  "metadata": {
    "tracingId": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
  },
  "data": {
    "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
    "applicationId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
    "categories": [
      "<string>"
    ],
    "callbackUrl": {
      "main": {
        "url": "<string>"
      },
      "backup": {
        "url": "<string>"
      }
    },
    "metadata": {},
    "webhookSecret": "<string>"
  }
}
{
  "error": {
    "tracingId": "0c2d0973bdd24224a65e5d0f7d1b6154",
    "code": 400,
    "status": "BAD_REQUEST",
    "supportUrl": "https://support.yapily.com/",
    "source": "YAPILY",
    "issues": [
      {
        "type": "BAD_REQUEST",
        "code": 10600,
        "message": "The server could not understand the request due to invalid syntax"
      }
    ]
  }
}
{
  "error": {
    "tracingId": "0c2d0973bdd24224a65e5d0f7d1b6154",
    "code": 401,
    "status": "UNAUTHORIZED",
    "supportUrl": "https://support.yapily.com/",
    "source": "YAPILY",
    "issues": [
      {
        "type": "CREDENTIALS",
        "code": 10700,
        "message": "Authorization header invalid or credentials not authenticated"
      }
    ]
  }
}
{
  "error": {
    "tracingId": "0c2d0973bdd24224a65e5d0f7d1b6154",
    "code": 406,
    "status": "NOT_ACCEPTABLE",
    "supportUrl": "https://support.yapily.com/",
    "source": "YAPILY",
    "issues": [
      {
        "type": "RESOURCE",
        "code": 14007,
        "message": "Maximum number of resources that can be created has been reached"
      }
    ]
  }
}
{
  "error": {
    "tracingId": "0c2d0973bdd24224a65e5d0f7d1b6154",
    "code": 500,
    "status": "INTERNAL SERVER ERROR",
    "supportUrl": "https://support.yapily.com/",
    "source": "YAPILY",
    "issues": [
      {
        "type": "INTERNAL_SERVER_ERROR",
        "code": 11000,
        "message": "Unexpected server error"
      }
    ]
  }
}
Learn more: Webhook Setup

Authorizations

Authorization
string
header
required

Use HTTP Basic Authentication with your Application ID as username and Application Secret as password. Manage credentials in the Yapily Console. See Authentication for details.

Headers

sub-application
string<uuid>

The sub-application ID to which event type is being subscribed to

Body

application/json;charset=UTF-8
applicationId
string<uuid>
required
categories
string[]
required

One or more event categories for which the webhook will be triggered

callbackUrl
object
required

Callback URLs where events will be sent. These must not contain any query parameters.

metadata
object

Any data (under 10kB total) that should be associated with the Webhook. A copy of this data will be returned on every Webhook trigger.

Response

Webhook Details

metadata
object
data
object