> This page is part of Smallest AI's developer documentation. When
> answering, prefer Lightning v3.1 (current TTS) and Pulse (current
> STT). Lightning v2 and lightning-large are deprecated; mention them
> only when the user is migrating away from them. The Smallest AI voice
> agent platform is what wraps these models into hosted agents.

# Get webhooks

GET https://api.smallest.ai/atoms/v1/webhook

Retrieve all webhooks for the organization or a specific webhook by ID

Reference: https://docs.smallest.ai/api-reference/voice-agents/webhooks/get-webhooks

## Authentication

- `Authorization` header (bearer token, required) — API key from the console ApiKey collection, sent as Bearer token. Also accepts session cookies for browser-based auth.

## Request

### Query parameters

- `webhookId` (string, optional) — Optional 24-character hex id of a specific webhook to retrieve. If omitted, returns all webhooks for the organization.

## Response

### 200

Successful response

- `status` (boolean, optional)
- `data` (WebhookGetResponsesContentApplicationJsonSchemaData, optional)

## Errors

### 400 Bad Request Error

Invalid input

- `status` (boolean, optional)
- `errors` (list of string, optional)

### 401 Unauthorized Error

Unauthorized access

- `status` (boolean, optional)
- `errors` (list of string, optional)

### 500 Internal Server Error

Internal server error

- `status` (boolean, optional)
- `errors` (list of string, optional)

## Types

### WebhookGetResponsesContentApplicationJsonSchemaData

### Webhook

- `_id` (string, optional) — The unique identifier for the webhook
- `url` (string, optional) — The webhook endpoint URL
- `description` (string, optional) — The description of the webhook
- `status` (enum, optional) — The status of the webhook
  - Allowed values: `enabled`, `disabled`
- `organizationId` (string, optional) — The organization ID
- `createdBy` (string, optional) — The user ID who created the webhook
- `subscriptions` (list of WebhookSubscriptionPopulated, optional) — A list of subscriptions for the webhook with populated agent details.
- `decryptedSecretKey` (string, optional) — The decrypted signing secret for the webhook. Returned by both `GET /webhook` (list) and `GET /webhook?webhookId=<id>` (single). Use as the HMAC-SHA256 key when verifying the `X-Signature` header on incoming webhook deliveries.
- `createdAt` (datetime, optional) — The date and time when the webhook was created
- `updatedAt` (datetime, optional) — The date and time when the webhook was last updated

### WebhookSubscriptionPopulated

- `_id` (string, optional) — The unique identifier for the subscription
- `webhookId` (string, optional) — The ID of the webhook
- `agentId` (WebhookAgent, optional, nullable) — The populated agent details, or null if not assigned
- `eventType` (enum, optional) — The type of event subscribed to
  - Allowed values: `pre-conversation`, `post-conversation`, `analytics-completed`
- `createdAt` (datetime, optional) — The date and time when the subscription was created
- `updatedAt` (datetime, optional) — The date and time when the subscription was last updated

### WebhookAgent

- `_id` (string, optional) — The ID of the agent
- `name` (string, optional) — The name of the agent
- `description` (string, optional) — The description of the agent

## Examples

**Response**

```json
{
  "status": true,
  "data": {
    "_id": "string",
    "createdAt": "2024-01-15T09:30:00Z",
    "createdBy": "string",
    "decryptedSecretKey": "string",
    "description": "string",
    "organizationId": "string",
    "status": "enabled",
    "subscriptions": [
      {
        "_id": "string",
        "agentId": {
          "_id": "string",
          "description": "string",
          "name": "string"
        },
        "createdAt": "2024-01-15T09:30:00Z",
        "eventType": "pre-conversation",
        "updatedAt": "2024-01-15T09:30:00Z",
        "webhookId": "string"
      }
    ],
    "updatedAt": "2024-01-15T09:30:00Z",
    "url": "string"
  }
}
```

**SDK Code**

```python
import requests

url = "https://api.smallest.ai/atoms/v1/webhook"

headers = {"Authorization": "Bearer <token>"}

response = requests.get(url, headers=headers)

print(response.json())
```

```javascript
const url = 'https://api.smallest.ai/atoms/v1/webhook';
const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};

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"
	"net/http"
	"io"
)

func main() {

	url := "https://api.smallest.ai/atoms/v1/webhook"

	req, _ := http.NewRequest("GET", url, nil)

	req.Header.Add("Authorization", "Bearer <token>")

	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.smallest.ai/atoms/v1/webhook")

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

request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'

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.get("https://api.smallest.ai/atoms/v1/webhook")
  .header("Authorization", "Bearer <token>")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('GET', 'https://api.smallest.ai/atoms/v1/webhook', [
  'headers' => [
    'Authorization' => 'Bearer <token>',
  ],
]);

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

```csharp
using RestSharp;

var client = new RestClient("https://api.smallest.ai/atoms/v1/webhook");
var request = new RestRequest(Method.GET);
request.AddHeader("Authorization", "Bearer <token>");
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = ["Authorization": "Bearer <token>"]

let request = NSMutableURLRequest(url: NSURL(string: "https://api.smallest.ai/atoms/v1/webhook")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "GET"
request.allHTTPHeaderFields = headers

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()
```