0

Get the signing secret for the default webhook

by
Published Oct 17, 2025

Get the signing secret for the default webhook endpoint. This is used to verify that webhook requests are coming from Replicate. Example cURL request: ```console curl -s \ -H "Authorization: Bearer $REPLICATE_API_TOKEN" \ https://api.replicate.com/v1/webhooks/default/secret ``` The response will be a JSON object with a `key` property: ```json { "key": "..." } ```

Script replicate Verified

The script

Submitted by hugo697 Bun
Verified 235 days ago
1
//native
2
type Replicate = {
3
  token: string;
4
};
5
/**
6
 * Get the signing secret for the default webhook
7
 * Get the signing secret for the default webhook endpoint. This is used to verify that webhook requests are coming from Replicate.
8

9
Example cURL request:
10

11
```console
12
curl -s \
13
  -H "Authorization: Bearer $REPLICATE_API_TOKEN" \
14
  https://api.replicate.com/v1/webhooks/default/secret
15
```
16

17
The response will be a JSON object with a `key` property:
18

19
```json
20
{
21
  "key": "..."
22
}
23
```
24

25
 */
26
export async function main(auth: Replicate) {
27
  const url = new URL(`https://api.replicate.com/v1/webhooks/default/secret`);
28

29
  const response = await fetch(url, {
30
    method: "GET",
31
    headers: {
32
      Authorization: "Bearer " + auth.token,
33
    },
34
    body: undefined,
35
  });
36
  if (!response.ok) {
37
    const text = await response.text();
38
    throw new Error(`${response.status} ${text}`);
39
  }
40
  return await response.json();
41
}
42