# Connections

A connection lets the assistant read another service you use and work in it when you allow it. You can connect any HTTP API with a key or OAuth.

Web version: https://www.svanja.com/docs/connections/

Your client work doesn't only happen in email. Invoices sit in an invoicing tool, and projects live in another app. A connection lets the assistant read data from those services and, when you allow it, make changes there. Once you connect a service, you can ask about its data in chat, or set up a rule that runs when the service sends an event.

You manage connections on the [Connections](https://app.svanja.com/connections) page, which also holds your website sign-ins and paired machines.

![The Connections page with Your connections (0 of 3 connections in use), Website sign-ins with open pages and sign-ins, and Pair your own machine](https://www.svanja.com/images/docs/connections/page.webp "Your connections are at the top, website sign-ins and paired machines below.")

## What can I connect?

Right now, you connect services through **Custom API**. It works with any service that has an HTTP API, which is a way for programs to talk to each other over the web. You'll need the API's address along with a key or an OAuth sign-in from the service. You can find both in the API's documentation.

The **Add a connection** list also shows other services marked "Not set up on this server yet". You can't connect those yet.

## What may the assistant do through a connection?

You tell Svanja which requests the assistant may make. The method of each request decides what the assistant may do with it:

| Request                                                     | What the assistant does                             |
| ----------------------------------------------------------- | --------------------------------------------------- |
| A **GET** request, which only reads                         | Runs it without asking                              |
| Another method with **Changes affect only me** ticked       | Runs it without asking                              |
| Another method without that tick, which changes shared data | Asks first, unless your request or a rule allows it |

Shared data is anything other people can see, like an invoice sent to a client. If you don't set this for a request, GET and HEAD requests count as reads, and everything else asks first.

## Connect a Custom API

1. Open [Connections](https://app.svanja.com/connections).
2. Choose **Connect a service**.
3. Under **Custom API**, choose **Connect Custom API**.
4. Fill in **Name** and **Base address**. The base address is the start that all the API's addresses share, like `https://api.example.com/v2`.
5. Under **How the assistant signs in**, pick the method and paste the key or token.
6. Under **Requests the assistant may make**, fill in **Name**, **Method** and **Path**, tick **Changes affect only me** if the request only changes your own data, and choose **Add request**. Repeat for each request.
7. Under **Request for the connection check**, pick a read request.
8. Choose **Connect**.

![The top of the Connections page with the Connect a service button and the empty Your connections table](https://www.svanja.com/images/docs/connections/custom-1.webp "Open Connections and choose Connect a service.")
![The Add a connection list with GitHub, Dropbox, Google Drive, OneDrive and SharePoint, Asana, Jira Cloud, Notion and Slack, each marked Not set up on this server yet](https://www.svanja.com/images/docs/connections/custom-2.webp "The Add a connection list opens below. Services marked Not set up on this server yet can't be connected.")
![Custom API at the end of the list with the Connect Custom API button](https://www.svanja.com/images/docs/connections/custom-3.webp "Under Custom API at the end of the list, choose Connect Custom API.")
![The Custom API form, The API, with the name Invoicing and the base address https://invoices.example.com/api/v1](https://www.svanja.com/images/docs/connections/custom-4.webp "Fill in Name and Base address.")
![How the assistant signs in set to API key in a header, with the header name X-API-Key and a hidden API key](https://www.svanja.com/images/docs/connections/custom-5.webp "Pick how the assistant signs in and paste the key. It is stored encrypted.")
![Requests the assistant may make with a request named List invoices, method GET, path /invoices and the query fields status and month, above the Add request button](https://www.svanja.com/images/docs/connections/custom-6.webp "Fill in one request and choose Add request. GET requests count as reads.")
![The added request List invoices, GET /invoices, Reads, and Request for the connection check set to List invoices](https://www.svanja.com/images/docs/connections/custom-7.webp "Under Request for the connection check, pick a read request.")
![The end of the Custom API form with Requests as JSON, Inputs for that request and the Connect button](https://www.svanja.com/images/docs/connections/custom-8.webp "Choose Connect. Svanja runs the check request once before saving.")

Svanja runs the check request once to make sure the connection works, then opens the connection page. Your key is stored encrypted and is never shown again. If the API has an OpenAPI document, you can paste it into **OpenAPI document (optional)** instead of entering the requests by hand.

On the Team plan, you can also choose who has access: **Only me**, or **The whole team** so it's available for everyone's tasks and team rules. Only team admins can add team connections.

## Link a connection to a Space

A Space holds one client's notes and files (see [Spaces](https://www.svanja.com/docs/spaces/)). If a connection belongs to a single client, link it to their Space so their work stays together.

1. Open the connection from [Connections](https://app.svanja.com/connections).
2. Under **What the assistant can read**, pick the Space next to the source.
3. Choose **Save changes**.

Turn on **Read only** if you want the assistant to read data through this connection without ever changing anything.

## How many connections can I have?

The Free plan allows 3 connections, and your connected mailbox counts as one of them. The page shows how many are in use, like "0 of 3 connections in use". Pro and Team plans have no limit.

## Check or remove a connection

Each connection shows when it was last checked, and **Check again** tests it immediately. If the sign-in stops working, the connection page prompts you to reconnect, and any tasks that need it will wait. For a Custom API, you can enter new credentials under **Advanced: test this connection** in **Change credentials or requests**.

**Used by** lists the rules and recent tasks that use the connection. **Recent activity** shows what the assistant read or did through it.

**Disconnect** stops the assistant from reading or making changes through the connection. Any files and notes already in Svanja stay where they are, and rules that use the connection will wait until you reconnect.

## Start a rule from a webhook

A webhook is a message a service sends when something happens, like an invoice getting paid. Each Custom API connection has its own webhook address.

1. Open the connection and go to **Advanced: test this connection**.
2. Copy the **Webhook address** into the other service.
3. Choose **Show signing secret** and set it up in the other service.

The service signs each message with that secret using an HMAC SHA-256 of the message body in the `X-Svanja-Signature` header. Once that's set up, create a [rule](https://www.svanja.com/docs/rules/) with **Connected service**, **Custom API**, and **Webhook received**.

## Website sign-ins and your own machine

Some sites don't have an API. The assistant can still work on them in its own browser once you sign in. Under **Website sign-ins**, choose **Sign in to a site**, sign in on the page, and hand it back to the assistant. Svanja keeps the session active, but never stores your password. The Free plan includes 1 sign-in.

**Pair your own machine** lets tasks use folders and a browser on your own computer. Both are explained in [The computer and its browser](https://www.svanja.com/docs/computer-and-browser/).

## Related pages

- [Rules](https://www.svanja.com/docs/rules/)
- [What the assistant may do](https://www.svanja.com/docs/what-the-assistant-may-do/)
- [Credits and prices](https://www.svanja.com/docs/credits-and-prices/)
