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

# Register a webhook endpoint

POST https://api.goautolane.com/rs/v1/webhooks
Content-Type: application/json

Registers an HTTPS endpoint for reservation events. Needs `webhooks:manage` and `reservations:read`, since the endpoint receives whole reservations. The URL must resolve to a public address; we check that at registration.

The `201` is the only time the secret is shown in full. Store it: every later read masks it, and only a rotation yields a usable secret again. An organization holds at most 10 endpoints, deactivated ones included, because endpoints cannot be deleted; reuse a slot by repointing one with `PUT`. `Idempotency-Key` is ignored here, so a create retried after a lost response can register a duplicate that receives every event too; find it with `GET /rs/v1/webhooks` and switch it off with `PUT`.

Reference: https://docs.goautolane.com/direct-delivery/api-reference/webhooks/create

## Authentication

- `Authorization` header (bearer token, required) — API key generated in the Autolane Portal. Keys are organization-scoped, carry granular permissions, and are environment-specific: a sandbox key only works against the sandbox host, and a production key only against the production host.

## Servers

- `https://api.goautolane.com` (Production, default)
- `https://api-sandbox.goautolane.com` (Sandbox)

## Request

### Body (application/json)

This endpoint expects a CreateWebhookBody.

- `url` (string, required)
- `subscribed_events` (list of enum, required)
  - Allowed values: `reservation.status_changed`, `reservation.handoff_updated`, `reservation.exception`

## Response

### 201

The registered endpoint, carrying its secret in full for the only time

- `success` (boolean, required)
- `data` (WebhookResponseData, required)

## Errors

### 400 Bad Request Error

Invalid JSON, or a body field that fails validation (`VALIDATION_ERROR`)

- `success` (boolean, required)
- `error` (string, required) — Human-readable error message
- `code` (string, required) — Stable machine-readable error code

### 401 Unauthorized Error

Missing or invalid API key (`INVALID_API_KEY`)

- `success` (boolean, required)
- `error` (string, required) — Human-readable error message
- `code` (string, required) — Stable machine-readable error code

### 403 Forbidden Error

Key valid but not usable here: wrong environment (`WRONG_ENV_KEY`), missing `webhooks:manage` or `reservations:read` permission (`PERMISSION_DENIED`), the organization is not enrolled as a fleet partner (`NOT_FLEET_PARTNER`), or the organization is deactivated or not yet provisioned in this environment (`ORG_INACTIVE`)

- `success` (boolean, required)
- `error` (string, required) — Human-readable error message
- `code` (string, required) — Stable machine-readable error code

### 422 Unprocessable Entity Error

`INVALID_WEBHOOK_URL`: the URL is not a public HTTPS endpoint. `WEBHOOK_LIMIT_REACHED`: the organization already holds 10 endpoints.

- `success` (boolean, required)
- `error` (string, required) — Human-readable error message
- `code` (string, required) — Stable machine-readable error code

### 500 Internal Server Error

Internal error (`INTERNAL_ERROR`)

- `success` (boolean, required)
- `error` (string, required) — Human-readable error message
- `code` (string, required) — Stable machine-readable error code

### 503 Service Unavailable Error

`URL_VALIDATION_UNAVAILABLE`: our capacity to validate the endpoint URL is exhausted, not a problem with your URL. Retry the same request.

- `success` (boolean, required)
- `error` (string, required) — Human-readable error message
- `code` (string, required) — Stable machine-readable error code

## Types

### WebhookResponseData

- `webhook` (WebhookEndpoint, required)

### WebhookEndpoint

- `webhook_id` (string, required)
- `url` (string, required)
- `secret` (string, required) — Shown in full only in the response that creates or rotates it; masked everywhere else
- `subscribed_events` (list of enum, required)
  - Allowed values: `reservation.status_changed`, `reservation.handoff_updated`, `reservation.exception`
- `is_active` (boolean, required)
- `created_at` (datetime, required)
- `updated_at` (datetime, required)

## Examples

**Request**

```json
{
  "url": "string",
  "subscribed_events": [
    "reservation.status_changed"
  ]
}
```

**Response**

```json
{
  "success": true,
  "data": {
    "webhook": {
      "webhook_id": "string",
      "url": "string",
      "secret": "whsec_…cdef",
      "subscribed_events": [
        "reservation.status_changed"
      ],
      "is_active": true,
      "created_at": "2024-01-15T09:30:00Z",
      "updated_at": "2024-01-15T09:30:00Z"
    }
  }
}
```

**SDK Code**

```python
import requests

url = "https://api.goautolane.com/rs/v1/webhooks"

payload = {
    "url": "string",
    "subscribed_events": ["reservation.status_changed"]
}
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

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

print(response.json())
```

```javascript
const url = 'https://api.goautolane.com/rs/v1/webhooks';
const options = {
  method: 'POST',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: '{"url":"string","subscribed_events":["reservation.status_changed"]}'
};

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.goautolane.com/rs/v1/webhooks"

	payload := strings.NewReader("{\n  \"url\": \"string\",\n  \"subscribed_events\": [\n    \"reservation.status_changed\"\n  ]\n}")

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

	req.Header.Add("Authorization", "Bearer <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.goautolane.com/rs/v1/webhooks")

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

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"url\": \"string\",\n  \"subscribed_events\": [\n    \"reservation.status_changed\"\n  ]\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.goautolane.com/rs/v1/webhooks")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"url\": \"string\",\n  \"subscribed_events\": [\n    \"reservation.status_changed\"\n  ]\n}")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.goautolane.com/rs/v1/webhooks', [
  'body' => '{
  "url": "string",
  "subscribed_events": [
    "reservation.status_changed"
  ]
}',
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
  ],
]);

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

```csharp
using RestSharp;

var client = new RestClient("https://api.goautolane.com/rs/v1/webhooks");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"url\": \"string\",\n  \"subscribed_events\": [\n    \"reservation.status_changed\"\n  ]\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = [
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
]
let parameters = [
  "url": "string",
  "subscribed_events": ["reservation.status_changed"]
] as [String : Any]

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

let request = NSMutableURLRequest(url: NSURL(string: "https://api.goautolane.com/rs/v1/webhooks")! 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()
```