---
title: How integrations work
description: What an integration is in Hydda One, the calls it makes, and how an organization installs and configures it.
---

Hydda One hands some jobs to a system outside it. It builds an invoice, but an ERP issues it. It writes a contract, but a signing service collects the signatures. An **integration** is the system that does one of these jobs for an organization.

To Hydda One, an integration is an API client: a client id and a client secret that an administrator has tied to one job. An invoicing integration makes these calls:

| | Call | What it is for |
| --- | --- | --- |
| 1 | `POST /oauth/token` | Get an access token. |
| 2 | `GET /v1/integrations/configurations` | Read where the organization switched it on. |
| 3 | `POST /v1/integrations/configurations/{configurationId}/ready` | Say that it works there. |
| 4 | `GET /v1/billing/send-queue` | Read the work that waits. |
| 5 | `POST /v1/billing/batch/report-sent` | Report what it did. |

[Build your own integration](/guides/integrations/build-your-own) walks through each one, with a worker you can start from.

## Integration points

A job that an integration can take over is called an **integration point**. There are two:

| Integration point | Name in the admin console | The job | Filled |
| --- | --- | --- | --- |
| `billing.invoicing` | Invoicing | Issue each approved invoice, deliver it, and report payments. Optionally review each invoice before it is created. | Once for the whole organization. |
| `crm.signing` | Contract signing | Send each contract for signature, and report how the signing ends. | Once for each business context. |

A point takes **one integration at a time**. An organization has one invoicing integration. Each business context has one signing integration, and two business contexts can use different ones.

Until an integration fills a point, the work waits. Approved invoices stay approved, and operators cannot send contracts for signature.

:::note[Not every API client is an integration]
Selling bookable resources on your own website fills no integration point. That needs only an **Application**: a client id and secret with the `Booking Integration` role. See [Booking](/guides/surfaces/booking).
:::

## The parts of an integration

```mermaid
flowchart TD
  APP["Integration<br/><i>what it is, and which point it fills</i>"]
  INS["Installation<br/><i>the integration inside one organization</i>"]
  C1["Configuration<br/><i>organization</i>"]
  C2["Configuration<br/><i>business context A</i>"]
  C3["Configuration<br/><i>business context B</i>"]
  APP -- "an administrator installs it" --> INS
  INS --> C1
  INS --> C2
  INS --> C3
```

| Part | What it is | Who changes it |
| --- | --- | --- |
| **Integration** | Its name, the integration point it fills, and its capabilities there. | An administrator, in the admin console. |
| **Installation** | The integration inside one organization. It can be disabled, enabled again or uninstalled. | An administrator. |
| **Configuration** | Switches the integration on in one place: the whole organization, or one business context. | An administrator saves it. Your integration reports its status. |

A capability is a part of the job. Invoicing has two: `sending`, which every invoicing integration has, and `basisVerification`, the optional review of each invoice before it is created.

Your integration only ever sees its configurations. An invoicing integration has one:

```json
{
  "id": "0b9f3c1e-5a4d-4c2b-8e7f-6a5b4c3d2e1f",
  "operationalContextId": "7d1e2f3a-4b5c-4d6e-8f70-1a2b3c4d5e6f",
  "level": "organization",
  "values": {},
  "secrets": {},
  "status": "pending"
}
```

| Integration point | `level` of the configuration that fills it | Role the integration needs there |
| --- | --- | --- |
| `billing.invoicing` | `organization`. One configuration. | `Billing Integration`, at the organization. |
| `crm.signing` | `business_context`. One for each business context that signs. | `Signing Integration`, at that business context. |

One invoicing integration serves every business context of the organization. Each invoice names the business context it belongs to, and the integration picks the right ERP account from it. See [the company an invoice belongs to](/guides/concepts/invoicing#the-company-an-invoice-belongs-to).

### The integration says when it is ready

An administrator can save a configuration, but only the integration knows whether it can reach the ERP. So the integration sets the status:

```bash
# It works
curl -X POST "https://api.hydda.one/v1/integrations/configurations/$CONFIGURATION_ID/ready" \
  -H "Authorization: Bearer $ACCESS_TOKEN"

# It does not
curl -X POST "https://api.hydda.one/v1/integrations/configurations/$CONFIGURATION_ID/failed" \
  -H "Authorization: Bearer $ACCESS_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{ "code": "erp_unreachable", "reason": "The ERP did not answer." }'
```

```mermaid
stateDiagram-v2
  [*] --> pending: an administrator saves it
  pending --> ready: the integration reports ready
  pending --> failed: the integration reports failed
  ready --> failed: it stops working
  failed --> ready: it works again
  ready --> pending: an administrator changes it
  failed --> pending: an administrator changes it
```

Hydda One starts to use an integration only when its configuration is `ready`. Until then the billing queues answer `400` with `BILLING_INTEGRATION_NOT_CONFIGURED`, and operators cannot send contracts for signature in that business context.

The [Integrations API guide](/guides/surfaces/integrations) has the details of these calls.

## Nobody calls your integration

Hydda One never calls an integration. There is no webhook and no callback address to register. An integration **polls** queues for work and **reports** the outcomes, up to 200 in one request.

So an integration needs no public address, no inbound firewall rule and no signature check. If it is down for an hour, the work is still on the queue when it comes back.

## Connectors from Hydda

Hydda runs integrations of its own for some providers: Payer for invoicing, and Scrive for contract signing. The admin console marks them **Hydda**, and an integration you build **Your own**.

A connector calls the same API as your integration and fills the same integration points. A point takes one integration at a time, so an administrator removes a connector before yours can take its place. See [Take over from a connector](/guides/integrations/build-your-own#take-over-from-a-connector).

Three things in these guides apply to connectors only. Skip them when you build your own:

| For connectors only | Where it comes up | What you do instead |
| --- | --- | --- |
| The installation-token grant, signed with the connector's private key. | [Authentication](/guides/authentication) | Use `client_credentials` with your client id and secret. |
| Fields in `values` and `secrets`, from a form the connector defines. | [Integrations API](/guides/surfaces/integrations#values-and-secrets) | Both are empty. Keep your settings in your own system. |
| A role that Hydda One grants when an administrator saves the settings. | [Roles](/guides/roles) | An administrator assigns the role to your integration's application. |
