Skip to content

Commit 80bba0e

Browse files
committed
Complete API documentation fixes - Final pass
- Add detailed Webhook Subscription Resource table - Add path parameters to all Webhook endpoints (GET, PUT, DELETE) - Add payload parameters tables (POST, PUT) - Add Webhook Payload Structure section with example - Add detailed Rate Limit Resource table with structure documentation - Enhance Rate Limit endpoint return description
1 parent b2588a8 commit 80bba0e

1 file changed

Lines changed: 73 additions & 14 deletions

File tree

docs/v1/affinity_api_docs.md

Lines changed: 73 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3771,17 +3771,15 @@ Webhooks allow you to be notified of events that happen on your Affinity instanc
37713771

37723772
Each webhook subscription object has a unique id. It also has a webhook_url and subscriptions associated with it.
37733773

3774-
| id | integer | The unique identifier of the webhook subscription object. | webhook_url | string | The URL to which the webhooks are sent. |
3775-
webhook_url string The URL to which the webhooks are sent.
3774+
A webhook subscription resource has the following attributes:
37763775

3777-
subscriptions string[] An array of webhook events that are enabled for that endpoint. An empty array indicates subscription to all webhook events. See below for the complete list of supported webhook events.
3778-
3779-
| subscriptions | "string[]" | An array of webhook events that are enabled for that endpoint. An empty array indicates subscription to all webhook events. See [below](#supported-webhook-events) for the complete list of supported webhook events. | disabled | boolean | If the subscription is disabled, this is true. Otherwise, this is false by default. A subscription may be disabled manually via API or automatically if we are not able to process it. |
3780-
disabled boolean If the subscription is disabled, this is true. Otherwise, this is false by default. A subscription may be disabled manually via API or automatically if we are not able to process it.
3781-
3782-
created_by integer The unique identifier of the user who created the webhook subscription.
3783-
3784-
| created_by | integer | The unique identifier of the user who created the webhook subscription. |
3776+
| Attribute | Type | Description |
3777+
|-----------|------|-------------|
3778+
| id | integer | The unique identifier of the webhook subscription object. |
3779+
| webhook_url | string | The URL to which the webhooks are sent. |
3780+
| subscriptions | string[] | An array of webhook events that are enabled for that endpoint. An empty array indicates subscription to all webhook events. See [Supported Webhook Events](#supported-webhook-events) below for the complete list. |
3781+
| disabled | boolean | If the subscription is disabled, this is true. Otherwise, this is false by default. A subscription may be disabled manually via API or automatically if we are not able to process it. |
3782+
| created_by | integer | The unique identifier of the internal person who created the webhook subscription. |
37853783

37863784
> **Note**
37873785
> If webhooks cannot be delivered as a result of a timeout or a connectivity issue with the webhook URL, Affinity will retry the delivery with an exponential backoff for up to 10 hours. If Affinity is still unable to deliver the webhook after this time, the webhook subscription will be automatically disabled.
@@ -3810,6 +3808,33 @@ The following table lists all supported webhook events:
38103808
> - Field webhooks are not fired for Crunchbase fields.
38113809
> - Field value webhooks are fired with `null` value for Crunchbase fields.
38123810
3811+
#### Webhook Payload Structure
3812+
3813+
When a webhook event occurs, Affinity sends a POST request to your webhook URL with a JSON payload. The payload structure varies by event type, but generally includes:
3814+
3815+
- `event`: The event name (e.g., `person.created`, `list.updated`)
3816+
- `data`: The resource data associated with the event (e.g., person object, list object)
3817+
- `timestamp`: The timestamp when the event occurred
3818+
3819+
Example webhook payload for `person.created`:
3820+
3821+
```json
3822+
{
3823+
"event": "person.created",
3824+
"data": {
3825+
"id": 12345,
3826+
"first_name": "John",
3827+
"last_name": "Doe",
3828+
"primary_email": "john@example.com",
3829+
"emails": ["john@example.com"],
3830+
"organization_ids": [67890]
3831+
},
3832+
"timestamp": "2021-11-15T10:30:00.000Z"
3833+
}
3834+
```
3835+
3836+
For detailed examples of webhook payloads for each event type, see the [Help Center article](https://support.affinity.co/s/article/Types-of-webhooks-available-with-Affinity-s-API).
3837+
38133838
#### Get All Webhook Subscriptions
38143839

38153840
#### Example Request
@@ -3927,6 +3952,12 @@ DELETE /webhook/{webhook_subscription_id}
39273952

39283953
Get the details for a specific webhook subscription given the specified webhook_subscription_id.
39293954

3955+
#### Path Parameters
3956+
3957+
| Parameter | Type | Required | Description |
3958+
|-----------|------|----------|-------------|
3959+
| webhook_subscription_id | integer | true | The unique identifier of the webhook subscription object. |
3960+
39303961
#### Return
39313962

39323963
The webhook subscription object corresponding to the webhook_subscription_id.
@@ -3965,7 +3996,7 @@ curl "https://api.affinity.co/webhook/1234" \
39653996

39663997
Create a new webhook subscription with the supplied parameters. If the endpoint returns an invalid response, the webhook creation will fail.
39673998

3968-
#### Parameter
3999+
#### Payload Parameters
39694000

39704001
| Parameter | Type | Required | Description |
39714002
|-----------|------|----------|-------------|
@@ -4001,7 +4032,13 @@ curl -X POST "https://api.affinity.co/webhook/subscribe" \
40014032

40024033
Update webhook subscription with the supplied parameters. A webhook subscription can only be updated by its creator. If the endpoint returns an invalid response, the webhook update will fail.
40034034

4004-
#### Parameter
4035+
#### Path Parameters
4036+
4037+
| Parameter | Type | Required | Description |
4038+
|-----------|------|----------|-------------|
4039+
| webhook_subscription_id | integer | true | The unique identifier of the webhook subscription object to update. |
4040+
4041+
#### Payload Parameters
40054042

40064043
| Parameter | Type | Required | Description |
40074044
|-----------|------|----------|-------------|
@@ -4039,6 +4076,12 @@ The webhook subscription object that was just updated through this request.
40394076

40404077
Delete a webhook subscription with a specified webhook_subscription_id. A webhook subscription can only be deleted by its creator, or an admin.
40414078

4079+
#### Path Parameters
4080+
4081+
| Parameter | Type | Required | Description |
4082+
|-----------|------|----------|-------------|
4083+
| webhook_subscription_id | integer | true | The unique identifier of the webhook subscription object to delete. |
4084+
40424085
#### Return
40434086

40444087
{"success": true}
@@ -4100,8 +4143,24 @@ The rate limit endpoint allows you to see your monthly account-level and per min
41004143

41014144
The rate limit resource includes information about account (AKA organization)-level and API key-level rate limits and usage.
41024145

4146+
A rate limit resource has the following structure:
4147+
4148+
| Attribute | Type | Description |
4149+
|-----------|------|-------------|
4150+
| rate | object | An object containing rate limit information for different scopes. |
4151+
| rate.org_monthly | object | Organization-level monthly rate limit information. |
4152+
| rate.org_monthly.limit | integer | The monthly call limit for the organization. |
4153+
| rate.org_monthly.remaining | integer | The number of calls remaining in the current month. |
4154+
| rate.org_monthly.reset | integer | The number of seconds until the monthly limit resets. |
4155+
| rate.org_monthly.used | integer | The number of calls used in the current month. |
4156+
| rate.api_key_per_minute | object | API key-level per-minute rate limit information. |
4157+
| rate.api_key_per_minute.limit | integer | The per-minute call limit for the API key. |
4158+
| rate.api_key_per_minute.remaining | integer | The number of calls remaining in the current minute window. |
4159+
| rate.api_key_per_minute.reset | integer | The number of seconds until the per-minute limit resets. |
4160+
| rate.api_key_per_minute.used | integer | The number of calls used in the current minute window. |
4161+
41034162
> **Note**
4104-
> /rate-limit and /auth/whoami endpoints are exempt from organization-level monthly rate limit.
4163+
> `/rate-limit` and `/auth/whoami` endpoints are exempt from organization-level monthly rate limit.
41054164
41064165
## Get Rate Limit Information
41074166

@@ -4111,7 +4170,7 @@ Querying the rate limit endpoint will yield information about account (AKA organ
41114170

41124171
#### Return
41134172

4114-
The rate limit resource, a JSON body of data including limit, calls remaining, seconds until reset and calls count.
4173+
The rate limit resource, a JSON body of data including limit, calls remaining, seconds until reset and calls count for both organization-level monthly limits and API key-level per-minute limits.
41154174

41164175
#### Example Request
41174176

0 commit comments

Comments
 (0)