> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.prolific.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.prolific.com/_mcp/server.

# Confirm a subscription

POST https://api.prolific.com/api/v1/hooks/subscriptions/{subscription_id}/
Content-Type: application/json

Confirm a subscription to an event type

Reference: https://docs.prolific.com/api-reference/webhooks/confirm-subscription

## Authentication

- `Authorization` header (required) (prefixed with `Token `) — The Prolific API uses API token to authenticate requests. You can create an API token directly from your settings. Your API token does not have an expiry date and carries full permission, so be sure to keep them secure. If your token is leaked, delete it and create a new one directly in the app. In your requests add `Authorization` header with the value `Token <your token>`.

## Request

### Path parameters

- `subscription_id` (string, required) — Subscription id

### Body (application/json)

- `secret` (string, required) — The secret that was generated when the subscription was created and returned as the `X-Hook-Secret` header.

## Response

### 200

Confirmed

- `event_type` (string, required) — The name of the event type associated to the subscription.
- `target_url` (string, required) — The URL that the subscription will notify when your event type is triggered.
- `workspace_id` (string, required) — The ID of the workspace we will create the subscription in.
- `id` (string, optional) — The ID of the subscription.
- `is_enabled` (boolean, optional) — Whether the subscription is enabled or not.

## Examples

**Request**

```json
{
  "secret": "a1b2c3d4e5f6g7h8i9j0klmnopqrstuvwx1234567890abcdef"
}
```

**Response**

```json
{
  "event_type": "participant.completed",
  "target_url": "https://webhooks.example.com/prolific/events",
  "workspace_id": "ws_1234567890abcdef",
  "id": "sub_9f8e7d6c5b4a3210",
  "is_enabled": true
}
```

**SDK Code**

```python
import requests

url = "https://api.prolific.com/api/v1/hooks/subscriptions/subscription_id/"

payload = { "secret": "a1b2c3d4e5f6g7h8i9j0klmnopqrstuvwx1234567890abcdef" }
headers = {
    "Authorization": "Token <token>",
    "Content-Type": "application/json"
}

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

print(response.json())
```

```javascript
const url = 'https://api.prolific.com/api/v1/hooks/subscriptions/subscription_id/';
const options = {
  method: 'POST',
  headers: {Authorization: 'Token <token>', 'Content-Type': 'application/json'},
  body: '{"secret":"a1b2c3d4e5f6g7h8i9j0klmnopqrstuvwx1234567890abcdef"}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go
package main

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

func main() {

	url := "https://api.prolific.com/api/v1/hooks/subscriptions/subscription_id/"

	payload := strings.NewReader("{\n  \"secret\": \"a1b2c3d4e5f6g7h8i9j0klmnopqrstuvwx1234567890abcdef\"\n}")

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

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

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

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

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

}
```

```ruby
require 'uri'
require 'net/http'

url = URI("https://api.prolific.com/api/v1/hooks/subscriptions/subscription_id/")

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

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Token <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"secret\": \"a1b2c3d4e5f6g7h8i9j0klmnopqrstuvwx1234567890abcdef\"\n}"

response = http.request(request)
puts response.read_body
```

```java
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.prolific.com/api/v1/hooks/subscriptions/subscription_id/")
  .header("Authorization", "Token <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"secret\": \"a1b2c3d4e5f6g7h8i9j0klmnopqrstuvwx1234567890abcdef\"\n}")
  .asString();
```

```php
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.prolific.com/api/v1/hooks/subscriptions/subscription_id/', [
  'body' => '{
  "secret": "a1b2c3d4e5f6g7h8i9j0klmnopqrstuvwx1234567890abcdef"
}',
  'headers' => [
    'Authorization' => 'Token <token>',
    'Content-Type' => 'application/json',
  ],
]);

echo $response->getBody();
```

```csharp
using RestSharp;

var client = new RestClient("https://api.prolific.com/api/v1/hooks/subscriptions/subscription_id/");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Token <token>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"secret\": \"a1b2c3d4e5f6g7h8i9j0klmnopqrstuvwx1234567890abcdef\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = [
  "Authorization": "Token <token>",
  "Content-Type": "application/json"
]
let parameters = ["secret": "a1b2c3d4e5f6g7h8i9j0klmnopqrstuvwx1234567890abcdef"] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://api.prolific.com/api/v1/hooks/subscriptions/subscription_id/")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```