# Webhooks

API reference · v1.0.0

Flavio sends the events of an account to your URL as they happen. Each webhook belongs to
one account.

**Base URL**: There is no single base URL: each partner works on its own domain, under its own brand, so your customers never see ours. We give you yours when we set you up together. The examples use app.acmeseo.com.

## List webhooks

`GET /api/accounts/{uuid}/flavio/webhooks`

Returns the webhooks of the account, oldest first, each with how its last delivery went.
An account has at most 10.

### Authentication

- `Authorization` (header, Bearer JWT): The JWT of one account (HMAC-SHA256, signed with the API Key), sent as `Authorization: Bearer <JWT>`. It gives access to that account only: every operation of Flavio Agent, Webhooks, Site data and Keywords, competitors and pages, and updating the account.

### Parameters

- `uuid` (path, string, required): UUID of the Account

### Request

cURL:

```bash
curl https://app.acmeseo.com/api/accounts/{uuid}/flavio/webhooks \
  -H "Authorization: Bearer <JWT>" \
  -H "Accept: application/vnd.marketgoo.api+json"
```

HTTP:

```http
GET /api/accounts/{uuid}/flavio/webhooks HTTP/1.1
Host: app.acmeseo.com
Authorization: Bearer <JWT>
Accept: application/vnd.marketgoo.api+json
```

### Responses

#### 200 OK

`application/vnd.marketgoo.api+json`

- `data` (object[])
  - `id` (string): ID of the webhook
  - `type` (string): Defines the type of the object returned in `attributes`.
  - `attributes` (object)
    - `url` (string): Where Flavio sends the events
    - `events` (string[]): The types of event it receives. Empty, all of them.
    - `secret` (string): The key of the signatures. Only in the answer of **Create a webhook**.
    - `created_at` (string): When it was created (UTC)
    - `last_delivery_at` (string, nullable): When Flavio last tried to send it an event (UTC); `null` until the first time
    - `last_status` (integer, nullable): The HTTP status of that try; `null` when it got no answer, or before the first
    - `last_error` (string, nullable): Why that try failed, such as `timeout` or `HTTP 500`; `null` when it worked
    - `failing_since` (string, nullable): Since when its deliveries fail (UTC); `null` while the last one worked

```json
{
  "data": [
    {
      "type": "webhook",
      "id": "7",
      "attributes": {
        "url": "https://hooks.example-builder.com/flavio",
        "events": [
          "plan.ready",
          "intervention.opened",
          "intervention.resolved"
        ],
        "created_at": "2026-11-04T11:02:05Z",
        "last_delivery_at": "2026-11-06T04:12:10Z",
        "last_status": 200,
        "last_error": null,
        "failing_since": null
      }
    }
  ]
}
```

#### 403 Forbidden

`application/vnd.marketgoo.api+json`

- `errors` (object[])
  - `status` (number): Numerical status code of the error
  - `title` (string): A descriptive message of the error

```json
{
  "errors": [
    {
      "status": 403,
      "title": "Forbidden"
    }
  ]
}
```

#### 404 Not Found

`application/vnd.marketgoo.api+json`

- `errors` (object[])
  - `status` (number): HTTP status
  - `title` (string): Error message title
  - `detail` (string): Error message detail

```json
{
  "errors": [
    {
      "status": 404,
      "title": "Not Found",
      "detail": "The requested account ID was not found"
    }
  ]
}
```

## Create a webhook

`POST /api/accounts/{uuid}/flavio/webhooks`

Flavio sends each event of the account to `url` as it happens: a `POST` with the event in
JSON, the envelope that **Events** describes. Leave `events` out to receive all of them, or
list the types you want. Only what happens after the webhook exists is sent: what happened
before is on the timeline.

`url` must be `https` and reachable on the internet. The answer brings `secret`, only this
once: keep it to check that each delivery comes from Flavio. Each one carries the header
`X-Flavio-Signature: t=<timestamp>,v1=<signature>`, where the signature is the
HMAC-SHA256, in hexadecimal, of `<timestamp>.<body>` with `secret`. Compute it over the
body exactly as it arrives and compare it with `v1`; reject a `t` more than five minutes
old.

Answer with a `2xx` within 10 seconds and do the work afterwards. Any other answer, or none,
is retried with longer and longer waits for 24 hours; after that the event is not sent
again. Flavio can send the same event twice, so deduplicate by its `id`, and events can
arrive out of order, so sort them by `created_at`. To check your endpoint right away, use
**Test a webhook**.

### Authentication

- `Authorization` (header, Bearer JWT): The JWT of one account (HMAC-SHA256, signed with the API Key), sent as `Authorization: Bearer <JWT>`. It gives access to that account only: every operation of Flavio Agent, Webhooks, Site data and Keywords, competitors and pages, and updating the account.

### Parameters

- `uuid` (path, string, required): UUID of the Account

### Request body

`application/vnd.marketgoo.api+json`

- `data` (object)
  - `type` (string, required): Required json:api item type. Always `webhook`.
  - `attributes` (object)
    - `url` (string, required): Where Flavio sends the events. `https`, reachable on the internet.
    - `events` (string[]): The types of event to send, from the catalog of **Events**. Empty or left out, all of them.

### Request

cURL:

```bash
curl -X POST https://app.acmeseo.com/api/accounts/{uuid}/flavio/webhooks \
  -H "Authorization: Bearer <JWT>" \
  -H "Accept: application/vnd.marketgoo.api+json" \
  -H "Content-Type: application/vnd.marketgoo.api+json" \
  -d '{
  "data": {
    "type": "webhook",
    "attributes": {
      "url": "https://hooks.example-builder.com/flavio",
      "events": [
        "plan.ready",
        "intervention.opened",
        "intervention.resolved"
      ]
    }
  }
}'
```

HTTP:

```http
POST /api/accounts/{uuid}/flavio/webhooks HTTP/1.1
Host: app.acmeseo.com
Authorization: Bearer <JWT>
Accept: application/vnd.marketgoo.api+json
Content-Type: application/vnd.marketgoo.api+json

{
  "data": {
    "type": "webhook",
    "attributes": {
      "url": "https://hooks.example-builder.com/flavio",
      "events": [
        "plan.ready",
        "intervention.opened",
        "intervention.resolved"
      ]
    }
  }
}
```

### Responses

#### 201 Created

`application/vnd.marketgoo.api+json`

- `data` (object)
  - `id` (string): ID of the webhook
  - `type` (string): Defines the type of the object returned in `attributes`.
  - `attributes` (object)
    - `url` (string): Where Flavio sends the events
    - `events` (string[]): The types of event it receives. Empty, all of them.
    - `secret` (string): The key of the signatures. Only in the answer of **Create a webhook**.
    - `created_at` (string): When it was created (UTC)
    - `last_delivery_at` (string, nullable): When Flavio last tried to send it an event (UTC); `null` until the first time
    - `last_status` (integer, nullable): The HTTP status of that try; `null` when it got no answer, or before the first
    - `last_error` (string, nullable): Why that try failed, such as `timeout` or `HTTP 500`; `null` when it worked
    - `failing_since` (string, nullable): Since when its deliveries fail (UTC); `null` while the last one worked

```json
{
  "data": {
    "type": "webhook",
    "id": "7",
    "attributes": {
      "url": "https://hooks.example-builder.com/flavio",
      "events": [
        "plan.ready",
        "intervention.opened",
        "intervention.resolved"
      ],
      "secret": "3f9c1a7e5b2d4f6081a3c5e7f9b1d3e5a7c9e1f3b5d7f9a1c3e5",
      "created_at": "2026-11-04T11:02:05Z",
      "last_delivery_at": null,
      "last_status": null,
      "last_error": null,
      "failing_since": null
    }
  }
}
```

#### 400 Bad Request

`application/vnd.marketgoo.api+json`

- `errors` (object[])
  - `title` (string): Error message title
  - `detail` (string): Error message detail
  - `source` (object): The field that triggered the error
    - `pointer` (string)

```json
{
  "errors": [
    {
      "title": "Invalid field",
      "detail": "Must be an https address reachable on the internet",
      "source": {
        "pointer": "/data/attributes/url"
      }
    }
  ]
}
```

#### 403 Forbidden

`application/vnd.marketgoo.api+json`

- `errors` (object[])
  - `status` (number): Numerical status code of the error
  - `title` (string): A descriptive message of the error

```json
{
  "errors": [
    {
      "status": 403,
      "title": "Forbidden"
    }
  ]
}
```

#### 404 Not Found

`application/vnd.marketgoo.api+json`

- `errors` (object[])
  - `status` (number): HTTP status
  - `title` (string): Error message title
  - `detail` (string): Error message detail

```json
{
  "errors": [
    {
      "status": 404,
      "title": "Not Found",
      "detail": "The requested account ID was not found"
    }
  ]
}
```

#### 409 Conflict

`application/vnd.marketgoo.api+json`

- `errors` (object[])
  - `status` (number): HTTP status
  - `title` (string): Error message title
  - `detail` (string): Error message detail

```json
{
  "errors": [
    {
      "status": 409,
      "title": "Conflict",
      "detail": "An account has at most 10 webhooks"
    }
  ]
}
```

## Update a webhook

`PATCH /api/accounts/{uuid}/flavio/webhooks/{webhook_id}`

Changes `url` or `events`. `secret` stays the same: to change it, delete the webhook and
create another one.

### Authentication

- `Authorization` (header, Bearer JWT): The JWT of one account (HMAC-SHA256, signed with the API Key), sent as `Authorization: Bearer <JWT>`. It gives access to that account only: every operation of Flavio Agent, Webhooks, Site data and Keywords, competitors and pages, and updating the account.

### Parameters

- `uuid` (path, string, required): UUID of the Account
- `webhook_id` (path, string, required): ID of the webhook

### Request body

`application/vnd.marketgoo.api+json`

- `data` (object)
  - `type` (string, required): Required json:api item type. Always `webhook`.
  - `attributes` (object)
    - `url` (string): Where Flavio sends the events. `https`, reachable on the internet.
    - `events` (string[]): The types of event to send, from the catalog of **Events**. Empty, all of them.

### Request

cURL:

```bash
curl -X PATCH https://app.acmeseo.com/api/accounts/{uuid}/flavio/webhooks/7 \
  -H "Authorization: Bearer <JWT>" \
  -H "Accept: application/vnd.marketgoo.api+json" \
  -H "Content-Type: application/vnd.marketgoo.api+json" \
  -d '{
  "data": {
    "type": "webhook",
    "attributes": {
      "events": []
    }
  }
}'
```

HTTP:

```http
PATCH /api/accounts/{uuid}/flavio/webhooks/7 HTTP/1.1
Host: app.acmeseo.com
Authorization: Bearer <JWT>
Accept: application/vnd.marketgoo.api+json
Content-Type: application/vnd.marketgoo.api+json

{
  "data": {
    "type": "webhook",
    "attributes": {
      "events": []
    }
  }
}
```

### Responses

#### 200 OK

`application/vnd.marketgoo.api+json`

- `data` (object)
  - `id` (string): ID of the webhook
  - `type` (string): Defines the type of the object returned in `attributes`.
  - `attributes` (object)
    - `url` (string): Where Flavio sends the events
    - `events` (string[]): The types of event it receives. Empty, all of them.
    - `secret` (string): The key of the signatures. Only in the answer of **Create a webhook**.
    - `created_at` (string): When it was created (UTC)
    - `last_delivery_at` (string, nullable): When Flavio last tried to send it an event (UTC); `null` until the first time
    - `last_status` (integer, nullable): The HTTP status of that try; `null` when it got no answer, or before the first
    - `last_error` (string, nullable): Why that try failed, such as `timeout` or `HTTP 500`; `null` when it worked
    - `failing_since` (string, nullable): Since when its deliveries fail (UTC); `null` while the last one worked

```json
{
  "data": {
    "type": "webhook",
    "id": "7",
    "attributes": {
      "url": "https://hooks.example-builder.com/flavio",
      "events": [
        "plan.ready",
        "intervention.opened",
        "intervention.resolved"
      ],
      "created_at": "2026-11-04T11:02:05Z",
      "last_delivery_at": "2026-11-06T04:12:10Z",
      "last_status": 200,
      "last_error": null,
      "failing_since": null
    }
  }
}
```

#### 400 Bad Request

`application/vnd.marketgoo.api+json`

- `errors` (object[])
  - `title` (string): Error message title
  - `detail` (string): Error message detail
  - `source` (object): The field that triggered the error
    - `pointer` (string)

```json
{
  "errors": [
    {
      "title": "Invalid field",
      "detail": "Must be an https address reachable on the internet",
      "source": {
        "pointer": "/data/attributes/url"
      }
    }
  ]
}
```

#### 403 Forbidden

`application/vnd.marketgoo.api+json`

- `errors` (object[])
  - `status` (number): Numerical status code of the error
  - `title` (string): A descriptive message of the error

```json
{
  "errors": [
    {
      "status": 403,
      "title": "Forbidden"
    }
  ]
}
```

#### 404 Not Found

`application/vnd.marketgoo.api+json`

- `errors` (object[])
  - `status` (number): HTTP status
  - `title` (string): Error message title
  - `detail` (string): Error message detail

```json
{
  "errors": [
    {
      "status": 404,
      "title": "Not Found",
      "detail": "The requested webhook was not found"
    }
  ]
}
```

## Delete a webhook

`DELETE /api/accounts/{uuid}/flavio/webhooks/{webhook_id}`

Flavio stops sending events to the webhook, the ones still being retried too.

### Authentication

- `Authorization` (header, Bearer JWT): The JWT of one account (HMAC-SHA256, signed with the API Key), sent as `Authorization: Bearer <JWT>`. It gives access to that account only: every operation of Flavio Agent, Webhooks, Site data and Keywords, competitors and pages, and updating the account.

### Parameters

- `uuid` (path, string, required): UUID of the Account
- `webhook_id` (path, string, required): ID of the webhook

### Request

cURL:

```bash
curl -X DELETE https://app.acmeseo.com/api/accounts/{uuid}/flavio/webhooks/7 \
  -H "Authorization: Bearer <JWT>"
```

HTTP:

```http
DELETE /api/accounts/{uuid}/flavio/webhooks/7 HTTP/1.1
Host: app.acmeseo.com
Authorization: Bearer <JWT>
```

### Responses

#### 204 No Content

No response body.

#### 403 Forbidden

`application/vnd.marketgoo.api+json`

- `errors` (object[])
  - `status` (number): Numerical status code of the error
  - `title` (string): A descriptive message of the error

```json
{
  "errors": [
    {
      "status": 403,
      "title": "Forbidden"
    }
  ]
}
```

#### 404 Not Found

`application/vnd.marketgoo.api+json`

- `errors` (object[])
  - `status` (number): HTTP status
  - `title` (string): Error message title
  - `detail` (string): Error message detail

```json
{
  "errors": [
    {
      "status": 404,
      "title": "Not Found",
      "detail": "The requested webhook was not found"
    }
  ]
}
```

## Test a webhook

`POST /api/accounts/{uuid}/flavio/webhooks/{webhook_id}/test`

Sends the webhook a `webhook.test` event within a minute, signed like any other. It is
not on the timeline. How it went shows in `last_status` and `last_error` of the webhook.

### Authentication

- `Authorization` (header, Bearer JWT): The JWT of one account (HMAC-SHA256, signed with the API Key), sent as `Authorization: Bearer <JWT>`. It gives access to that account only: every operation of Flavio Agent, Webhooks, Site data and Keywords, competitors and pages, and updating the account.

### Parameters

- `uuid` (path, string, required): UUID of the Account
- `webhook_id` (path, string, required): ID of the webhook

### Request

cURL:

```bash
curl -X POST https://app.acmeseo.com/api/accounts/{uuid}/flavio/webhooks/7/test \
  -H "Authorization: Bearer <JWT>"
```

HTTP:

```http
POST /api/accounts/{uuid}/flavio/webhooks/7/test HTTP/1.1
Host: app.acmeseo.com
Authorization: Bearer <JWT>
```

### Responses

#### 202 Accepted

No response body.

#### 403 Forbidden

`application/vnd.marketgoo.api+json`

- `errors` (object[])
  - `status` (number): Numerical status code of the error
  - `title` (string): A descriptive message of the error

```json
{
  "errors": [
    {
      "status": 403,
      "title": "Forbidden"
    }
  ]
}
```

#### 404 Not Found

`application/vnd.marketgoo.api+json`

- `errors` (object[])
  - `status` (number): HTTP status
  - `title` (string): Error message title
  - `detail` (string): Error message detail

```json
{
  "errors": [
    {
      "status": 404,
      "title": "Not Found",
      "detail": "The requested webhook was not found"
    }
  ]
}
```
