> ## Documentation Index
> Fetch the complete documentation index at: https://docs.mygigsters.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Subscribe webhook events

> Registers a new webhook destination URL with specified event subscriptions and generates a secure HMAC signing secret key for payload verification.

### Headers

**x-api-version** `string` *required*

Target API version (e.g. `1.2`).

### Request Body Parameters

**url** `string` *required*

Publicly accessible HTTPS destination URL where webhook event payloads will be delivered (e.g. `https://example.com/webhook`).

**events** `array of numbers` *required*

Array of numeric event IDs to subscribe to (e.g. `[13, 14, 15]` obtained from the **Get Webhook Events** endpoint).

### Response Body

**success** `boolean`

Indicates whether the webhook subscription was created successfully (`true`).

**id** `number`

Unique identifier assigned to this webhook subscription.

**url** `string`

The registered HTTPS callback endpoint URL.

**secretKey** `string`

Cryptographic secret key used to compute and verify the HMAC signature of incoming webhook delivery payloads. Store securely.

**eventIds** `array of numbers`

List of event IDs that are subscribed to this webhook endpoint.

### Response Codes

| Code | Description |
| - | - |
| 200 | Webhook subscription registered successfully. |
| 400 | Bad Request. Invalid destination URL or event IDs. |
| 401 | Unauthorized. Missing, expired, or invalid partner Bearer token. |
| 500 | Internal Server Error. |

```bash cURL theme={null}
curl -X POST https://qa-payments.mygigsters.com.au/api/v1/partner/webhooks/subscribe \
  -H "Content-Type: application/json" \
  -H "X-API-Version: 1.2" \
  -H "Authorization: Bearer <accessToken>" \
  -d '{
  "url": "https://example.com/webhook",
  "events": [
    13,
    14,
    15
  ]
}'
```

```javascript Node.js theme={null}
const response = await fetch("https://qa-payments.mygigsters.com.au/api/v1/partner/webhooks/subscribe", {
  method: "POST",
  headers: {
    Authorization: "Bearer <accessToken>",
    "Content-Type": "application/json",
    "X-API-Version": "1.2",
  },
  body: JSON.stringify({
    "url": "https://example.com/webhook",
    "events": [
      13,
      14,
      15
    ]
  }),
});

const data = await response.json();
console.log(data);
```

```python Python theme={null}
import requests

response = requests.post(
    "https://qa-payments.mygigsters.com.au/api/v1/partner/webhooks/subscribe",
    headers={
        "Authorization": "Bearer <accessToken>",
        "X-API-Version": "1.2",
    },
    json={
        "url": "https://example.com/webhook",
        "events": [
            13,
            14,
            15,
        ],
    },
)

print(response.json())
```

```ruby Ruby theme={null}
require "net/http"
require "json"
require "uri"

uri = URI("https://qa-payments.mygigsters.com.au/api/v1/partner/webhooks/subscribe")
request = Net::HTTP::Post.new(uri)
request["Authorization"] = "Bearer <accessToken>"
request["Content-Type"] = "application/json"
request["X-API-Version"] = "1.2"
request.body = <<~JSON
  {
    "url": "https://example.com/webhook",
    "events": [
      13,
      14,
      15
    ]
  }
JSON

response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) do |http|
  http.request(request)
end

puts JSON.parse(response.body)
```

```php PHP theme={null}
<?php

$ch = curl_init("https://qa-payments.mygigsters.com.au/api/v1/partner/webhooks/subscribe");

curl_setopt_array($ch, [
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_CUSTOMREQUEST => "POST",
    CURLOPT_HTTPHEADER => [
        "Authorization: Bearer <accessToken>",
        "Content-Type: application/json",
        "X-API-Version: 1.2",
    ],
    CURLOPT_POSTFIELDS => <<<'JSON'
{
  "url": "https://example.com/webhook",
  "events": [
    13,
    14,
    15
  ]
}
JSON,
]);

$response = curl_exec($ch);
curl_close($ch);

print_r(json_decode($response, true));
```

```java Java theme={null}
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;

public class Example {
    public static void main(String[] args) throws Exception {
        String body = String.join("\n",
            "{",
            "  \"url\": \"https://example.com/webhook\",",
            "  \"events\": [",
            "    13,",
            "    14,",
            "    15",
            "  ]",
            "}"
        );

        HttpRequest request = HttpRequest.newBuilder()
            .uri(URI.create("https://qa-payments.mygigsters.com.au/api/v1/partner/webhooks/subscribe"))
            .header("Authorization", "Bearer <accessToken>")
            .header("Content-Type", "application/json")
            .header("X-API-Version", "1.2")
            .method("POST", HttpRequest.BodyPublishers.ofString(body))
            .build();

        HttpResponse<String> response = HttpClient.newHttpClient()
            .send(request, HttpResponse.BodyHandlers.ofString());

        System.out.println(response.body());
    }
}
```

```go Go theme={null}
package main

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

func main() {
	body := strings.NewReader(`{
  "url": "https://example.com/webhook",
  "events": [
    13,
    14,
    15
  ]
}`)

	req, err := http.NewRequest("POST", "https://qa-payments.mygigsters.com.au/api/v1/partner/webhooks/subscribe", body)
	if err != nil {
		panic(err)
	}
	req.Header.Set("Authorization", "Bearer <accessToken>")
	req.Header.Set("Content-Type", "application/json")
	req.Header.Set("X-API-Version", "1.2")

	res, err := http.DefaultClient.Do(req)
	if err != nil {
		panic(err)
	}
	defer res.Body.Close()

	data, _ := io.ReadAll(res.Body)
	fmt.Println(string(data))
}
```

```csharp .NET theme={null}
using System.Net.Http.Headers;
using System.Text;

using var client = new HttpClient();

var request = new HttpRequestMessage(HttpMethod.Post, "https://qa-payments.mygigsters.com.au/api/v1/partner/webhooks/subscribe");
request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", "<accessToken>");
request.Headers.Add("X-API-Version", "1.2");
request.Content = new StringContent(@"{
  ""url"": ""https://example.com/webhook"",
  ""events"": [
    13,
    14,
    15
  ]
}", Encoding.UTF8, "application/json");

var response = await client.SendAsync(request);
Console.WriteLine(await response.Content.ReadAsStringAsync());
```

```json Response theme={null}
{
  "success": true,
  "id": 2,
  "url": "https://example.com/webhook",
  "secret_key": "LptaMacK*9o$HZEAkY0H",
  "event_ids": [
    13,
    14,
    15
  ]
}
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.