You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/v1/affinity_api_docs.md
+73-14Lines changed: 73 additions & 14 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -3771,17 +3771,15 @@ Webhooks allow you to be notified of events that happen on your Affinity instanc
3771
3771
3772
3772
Each webhook subscription object has a unique id. It also has a webhook_url and subscriptions associated with it.
3773
3773
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:
3776
3775
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. |
3785
3783
3786
3784
> **Note**
3787
3785
> 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:
3810
3808
> - Field webhooks are not fired for Crunchbase fields.
3811
3809
> - Field value webhooks are fired with `null` value for Crunchbase fields.
3812
3810
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).
Create a new webhook subscription with the supplied parameters. If the endpoint returns an invalid response, the webhook creation will fail.
3967
3998
3968
-
#### Parameter
3999
+
#### Payload Parameters
3969
4000
3970
4001
| Parameter | Type | Required | Description |
3971
4002
|-----------|------|----------|-------------|
@@ -4001,7 +4032,13 @@ curl -X POST "https://api.affinity.co/webhook/subscribe" \
4001
4032
4002
4033
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.
4003
4034
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
4005
4042
4006
4043
| Parameter | Type | Required | Description |
4007
4044
|-----------|------|----------|-------------|
@@ -4039,6 +4076,12 @@ The webhook subscription object that was just updated through this request.
4039
4076
4040
4077
Delete a webhook subscription with a specified webhook_subscription_id. A webhook subscription can only be deleted by its creator, or an admin.
4041
4078
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
+
4042
4085
#### Return
4043
4086
4044
4087
{"success": true}
@@ -4100,8 +4143,24 @@ The rate limit endpoint allows you to see your monthly account-level and per min
4100
4143
4101
4144
The rate limit resource includes information about account (AKA organization)-level and API key-level rate limits and usage.
4102
4145
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. |
| 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
+
4103
4162
> **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.
4105
4164
4106
4165
## Get Rate Limit Information
4107
4166
@@ -4111,7 +4170,7 @@ Querying the rate limit endpoint will yield information about account (AKA organ
4111
4170
4112
4171
#### Return
4113
4172
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.
0 commit comments