> ## Documentation Index
> Fetch the complete documentation index at: https://help.statisfy.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Integration settings

> Read and change the settings of Salesforce, HubSpot, Gainsight, Zendesk, Freshdesk, Jira, Linear, Rocketlane, Slack, and Microsoft Teams with the Statisfy API, and read the health and runs of each sync.

The Statisfy API reads and changes the settings pages of these integrations: Salesforce, HubSpot, Gainsight, Zendesk, Freshdesk, Jira, Linear, Rocketlane, Slack, and Microsoft Teams. It also reads the health of each sync and starts runs, as **Integrations > View monitoring** does in the app. The same operations are tools on the [Statisfy MCP server](https://help.statisfy.com/mcp/overview.md).

* **You connect each integration in Statisfy's app.** The API never takes or returns a token or a credential, and it doesn't connect an integration.
* **`integrations:read` reads.** It covers every `GET` on this page, every `POST .../connection/test`, and Slack's channel check (`POST .../validate`).
* **`integrations:write` changes.** It covers every other `POST`, and every `PATCH`, `PUT`, and `DELETE`. A preview or a sample that returns the vendor's data needs `integrations:write` too, because that data can hold emails and other personal data.
* **A key that acts for a person gets either scope only when that person is an admin.** See [Authentication](https://help.statisfy.com/rest-api/authentication.md#scopes).

Paths are relative to `https://api.statisfy.com`.

## The usual flow

1. Find what an integration has: call `GET /v1/integrations/{key}`. Its `supports` lists the parts of `/v1/integrations/{key}` that it has, such as `config` and `preview`.
2. Test the connection: call `POST /v1/integrations/{key}/connection/test`. A failed test returns `success` `false` with the reason. For Freshdesk, the reason is fixed text: Freshdesk's reply is never returned.
3. Read the lookups, such as projects, fields, or statuses. These calls go to the vendor.
4. Try a draft config with the integration's preview. A preview writes nothing.
5. Save the config with `PATCH .../config`. Send `expected_version`, the `version` you read.
6. Set the schedule: with the integration's own `PUT .../schedule` where it has one, else with the monitoring row's `PUT .../schedule`.
7. Start a run, then read it with `GET /v1/integrations/{key}/runs/{run_id}`.

How a save works:

* **A save against a config that changed is a `409`.** If the config changed since you read it, Statisfy returns `409` with the code `conflict` and writes nothing. Read it again and retry. When you leave out `expected_version`, Statisfy uses the version that the call reads.
* **`version` is `0` when the config was never saved.** You then get the defaults, as the app shows them.
* **A change that sends no setting saves nothing** for Salesforce, HubSpot, Gainsight, Zendesk, Freshdesk, and Jira. You get the config as it is, and no new version. A stale `expected_version` is still a `409`. For Linear and Rocketlane, a change with no setting saves a new version.
* **A save runs the app's checks.** A refusal is a `422` with the app's text.

How a run starts:

* **`202` with `status` `scheduled`:** the run starts now.
* **`200` with `status` `already_running`:** a run is in flight. Nothing starts, and you get that run.
* **`409`:** the run can't start now. For example, your CRM hasn't synced yet, which every integration that isn't a CRM waits for. A `409` that comes with `Retry-After` means a cooldown: retry after that many seconds.

A Slack channel read is different: it returns `202`, or `409` while a read of that channel is in flight.

Jira, Linear, and Rocketlane have their own `POST .../runs`. Salesforce, HubSpot, and Gainsight start a run with the monitoring row's Run now, such as `POST /v1/integrations/monitoring/SALESFORCE/delta/runs`. For them, `POST /v1/integrations/{key}/runs` is a `404` that names this path. See [Health and runs](#health-and-runs).

## Shared endpoints

Every integration has these. `{key}` is the integration key, such as `jira` or `salesforce`. For Slack, the key here is `stella_slack`.

| Endpoint | What it does |
| - | - |
| `GET /v1/integrations` | Lists every app your workspace can connect, with whether it's connected, its last run, and `supports` |
| `GET /v1/integrations/{key}` | Gets one integration's status and `supports` |
| `GET /v1/integrations/{key}/connections` | Lists the connected accounts and their status |
| `POST /v1/integrations/{key}/connection/test` | Tests the stored connection, for Zendesk, Freshdesk, Jira, Linear, Rocketlane, and Gainsight. Slack has its own: see its section |
| `GET /v1/integrations/{key}/schedule` | Gets when each subtype runs |
| `GET /v1/integrations/{key}/runs` | Lists the latest runs, newest first, of every subtype or of one (`subtype`) |
| `GET /v1/integrations/{key}/runs/{run_id}` | Gets one run: its status, when it started and ended, and its status text |

## Salesforce

| Endpoint | What it does |
| - | - |
| `GET /v1/integrations/salesforce/config` | Gets every setting of the Salesforce settings page, by top-level key |
| `PATCH /v1/integrations/salesforce/config` | Changes the top-level settings in `changes` |
| `POST /v1/integrations/salesforce/preview/account-filter` | Runs a SOQL `WHERE` clause on Account: whether it's valid, how many accounts it returns, a few of them, and the overlap with `overlap_filters` |
| `POST /v1/integrations/salesforce/preview/case-filter` | Runs a SOQL `WHERE` clause on Case: whether it's valid, how many cases it returns, and a few of them |
| `POST /v1/integrations/salesforce/preview/chatter` | Returns samples of the Chatter posts the settings would sync (author and an excerpt), and a count up to 500 |
| `POST /v1/integrations/salesforce/preview/aggregation` | Runs an aggregation on a few sample accounts and returns the value each would get |
| `GET /v1/integrations/salesforce/schedule` | Gets when each Salesforce sync runs |
| `PUT /v1/integrations/salesforce/schedule` | Sets the schedule of the subtypes you send |
| `POST /v1/integrations/salesforce/cdc/objects` | Selects Account, Contact, and Opportunity for Change Data Capture in your Salesforce org |
| `GET /v1/integrations/salesforce/objects` | Lists the objects of your Salesforce org |
| `GET /v1/integrations/salesforce/objects/{object_name}/fields` | Lists one object's fields, with their type, and for lookups the objects they point to |

* **`PATCH .../config` takes `changes`: each top-level setting with its whole new value.** A key you leave out stays as it is. `null` removes a key. A key that isn't a setting, and isn't saved already, is a `422`.
* **`validate_with_api` `true` also checks the filters and fields against Salesforce** before the save. When Salesforce doesn't answer that check, the call returns `502` and saves nothing. A filter that Salesforce refuses is a `422`.
* **Send `expected_version`.** If the config changed since you read it, the call returns `409` before it calls Salesforce.
* **When the config was never saved, `version` is `0` and `source` is `code`.** Statisfy's built-in config runs then.
* **An Other filter is saved as the app saves it.** Send `type` `Other` with a `label`. `GET .../config` then returns the key that the label became.
* **When you save an Other account filter, Statisfy schedules its monthly run** if no schedule is set. If the config is saved but the run can't be scheduled, the call returns `500` that names the saved version: set the schedule with `PUT .../schedule` (subtype `inert`).
* **The schedule has limits.** The full sync (`default`) runs daily to monthly. `delta`, `case`, `email`, and `einstein_meeting` run every 2, 4, 6, or 12 hours, or daily. `delta` keeps `hourly` only if it already runs hourly. `inert` (Other accounts) runs twice a month or monthly. A cadence outside its limit is a `422`. A change that turns `delta` on or off against your workspace's setting is a `409`.
* **`POST .../cdc/objects` changes your Salesforce org.** It doesn't turn on real-time sync in Statisfy: that is `cdc_enabled`, which you set with `PATCH .../config`. It needs the native Salesforce connection, else it's a `409`. Objects that Salesforce refuses come back in `failed`.
* **A change that streams one more object in real time (`cdc_enabled` or `cdc_objects`) needs that object selected in your org first** (`POST .../cdc/objects`), else it's a `409`. It's also a `409` when the connected Salesforce user can't read the org's Change Data Capture settings. For both calls, a used-up Salesforce API limit is a `429`, and a Salesforce that doesn't answer is a `502`.
* **A preview that Salesforce refuses or can't answer returns `is_valid` `false`** with a fixed message.
* **Salesforce Direct (`salesforce_native`) uses these `/v1/integrations/salesforce/...` paths** for its config, previews, and Change Data Capture.
* **A string in a request body is at most 20,000 characters.** A longer one is a `422`.

## HubSpot

| Endpoint | What it does |
| - | - |
| `GET /v1/integrations/hubspot/config` | Gets every setting of the HubSpot settings page, by top-level key |
| `PATCH /v1/integrations/hubspot/config` | Changes the top-level settings in `changes` |
| `POST /v1/integrations/hubspot/preview/account-filter` | Searches companies with the filter groups: whether they're valid, how many companies they return, and a few of them |
| `POST /v1/integrations/hubspot/preview/aggregation` | Runs an aggregation on a few sample companies and returns the value each would get |
| `GET /v1/integrations/hubspot/schedule` | Gets the schedule of the Other accounts sync (`inert`) |
| `PUT /v1/integrations/hubspot/schedule` | Sets the schedule of the Other accounts sync |
| `GET /v1/integrations/hubspot/objects/{object_name}/fields` | Lists one object's properties |

* **`PATCH .../config` works as Salesforce's does.** Send `changes`, and each key gets its whole new value.
* **`GET /v1/integrations/hubspot/objects` is a `404`.** HubSpot has no object list: use the fields of an object.
* **`PUT .../schedule` sets only the Other accounts sync.** It takes `semimonthly` or `monthly`, and any other cadence is a `422`. An entry with `enabled` `false` clears the schedule.
* **The full sync's schedule is on the monitoring row.** Use `PUT /v1/integrations/monitoring/HUBSPOT/default/schedule`.
* **A filter that HubSpot can't run comes back with `is_valid` `false`** and HubSpot's reason.
* **A preview takes at most 5 filter groups of 6 filters each.** More is a `422`, and HubSpot isn't called.
* **An Other filter is saved as Salesforce's is.** `GET .../config` returns the key that its `label` became.

## Gainsight

| Endpoint | What it does |
| - | - |
| `GET /v1/integrations/gainsight/config` | Gets every setting of the Gainsight settings page, by top-level key |
| `PATCH /v1/integrations/gainsight/config` | Changes the top-level settings in `changes` |
| `GET /v1/integrations/gainsight/activity/reporting-categories` | Lists the `ReportingCategory` values of a sample of activities, and Statisfy's default activity type for each |
| `GET /v1/integrations/gainsight/schedule` | Gets when each Gainsight subtype runs, in the schedule's shared cadence names |
| `PUT /v1/integrations/gainsight/schedule` | Sets the schedule of the subtypes you send |
| `GET /v1/integrations/gainsight/subtypes` | Lists each subtype that the config turns on, with its newest run |
| `GET /v1/integrations/gainsight/objects` | Lists the Gainsight objects |
| `GET /v1/integrations/gainsight/objects/{object_name}/fields` | Lists one object's fields |

* **The config keys are `common` and the subtype numbers.** `4` is accounts, `11` product usage, `13` surveys, and `14` activity. `null` removes a key, which turns that subtype off. Another key that isn't saved already is a `422`.
* **The schedule takes the cadences that the settings page offers, in the shared names.** `default` and `survey_activity`: `daily` or `weekly`. `activity`: `hourly`, `two_hours`, `four_hours`, `six_hours`, `twelve_hours`, or `daily`. `product_usage`: `daily`, `weekly`, or `monthly`. Weekly takes `day`, `hour`, `minute`, and `timezone`. Another value is a `422` and saves nothing.
* **`GET .../schedule` shows the saved cadence, or the default where none is saved.** `default` and `survey_activity` run `daily`, `activity` `four_hours`, and `product_usage` `weekly`. The list is empty when Gainsight isn't connected. `enabled` `false` puts a subtype back on its default.
* **The reporting categories come from a sample of 1,000 activities.** Statisfy keeps the answer for an hour. The call returns `409` when Gainsight isn't connected.
* **Gainsight's connection test is `POST /v1/integrations/gainsight/connection/test`** (see [the shared endpoints](#shared-endpoints)). It never returns the key or the Gainsight host.

## Zendesk

| Endpoint | What it does |
| - | - |
| `POST /v1/integrations/zendesk/connection/test` | Tests the stored connection |
| `GET /v1/integrations/zendesk/config` | Gets how a ticket finds its account: the methods, in order |
| `PATCH /v1/integrations/zendesk/config` | Sets the methods |
| `GET /v1/integrations/zendesk/fields` | Lists the paths a method can read: the standard ones, then your own ticket, organization, and user fields |
| `POST /v1/integrations/zendesk/sample-tickets` | Returns the most recently updated tickets, each as the record the methods read |
| `POST /v1/integrations/zendesk/preview` | Tries a draft config on the sample tickets and says which account each would go to |

* **One config serves both Zendesk connections.** `POST /v1/integrations/zendesk_native/connection/test` tests the other one.
* **At version `0`, the built-in matching runs.** `customer_resolution` then shows the recommended order to start from.
* **`PATCH .../config` takes up to 10 methods.** Each is `payload_field`, `email_domain`, or `contact_email`, with a column under `ticket.*`, `requester.*`, or `organization.*`. A column takes only letters, digits, and `_`. A `payload_field` needs `custom_field_key`. Anything else is a `422`.
* **`null` saves the recommended order, and `[]` turns every method off.** With no method, a ticket goes to its requester's email. Either one, on a config that was never saved, turns off the built-in matching.
* **New tickets use a change at once.** A ticket that already has an account keeps it.
* **The sample and the preview take up to 25 tickets.** `sample_size` is 20 by default. The sample returns Zendesk data, requester emails included. The preview calls nothing. It doesn't run a method whose value is a list of more than 20 items, or that goes past 100 lookups: its error is `TooManyValues`. A ticket where a method was not run has no winner and doesn't count in `match_rate`, because ingest runs that method first. A warning counts these tickets. A list of email domains is one lookup and has no item limit. A draft that the save refuses, such as more than 10 methods, is a `422`.

## Freshdesk

| Endpoint | What it does |
| - | - |
| `POST /v1/integrations/freshdesk/connection/test` | Tests the stored connection |
| `GET /v1/integrations/freshdesk/config` | Gets how a ticket finds its account: the resolver chain, in order |
| `PATCH /v1/integrations/freshdesk/config` | Sets the resolver chain |
| `GET /v1/integrations/freshdesk/company-fields` | Lists each company field, with the path a `payload_field` resolver reads (`suggested_column`) |
| `POST /v1/integrations/freshdesk/sample-tickets` | Returns recent tickets, whole, with their company and requester |
| `POST /v1/integrations/freshdesk/preview` | Tries a draft chain on the sample tickets and says which account each would go to |

* **At version `0`, the default chain runs.** It tries the company's CRM account ID, then its domains, then the requester's email domain.
* **`GET .../company-fields` calls Freshdesk.** It returns `502` when Freshdesk refuses or doesn't answer.
* **A failed connection test returns fixed text.** Freshdesk's reply is never returned.
* **`PATCH .../config` takes up to 10 resolvers.** Only `payload_field` and `email_domain` read a dotted path, such as `company.domains`. Every other type reads one top-level ticket key, and a dotted column is a `422`.
* **`null` saves the default chain as a new version, and `[]` matches no ticket.**
* **The sample takes up to 20 tickets** (`sample_size`, 5 by default). It leaves out tickets with no company and counts them in `warnings`. It returns Freshdesk data, requester emails included.
* **The preview calls nothing.** It doesn't run a step whose value is a list of more than 20 items, or that goes past 100 account lookups: its error is `TooManyValues`. A list of email domains is one lookup and has no item limit.

## Jira

| Endpoint | What it does |
| - | - |
| `POST /v1/integrations/jira/connection/test` | Tests the stored connection |
| `GET /v1/integrations/jira/config` | Gets which projects sync, each project's rules, the default field mappings, and the issue-link setting |
| `PATCH /v1/integrations/jira/config` | Changes the settings you send |
| `GET /v1/integrations/jira/projects` | Lists every project, with its type (`software`, `business`, or `service_desk`) |
| `GET /v1/integrations/jira/projects/{project_key}/issue-types` | Lists a project's issue types |
| `GET /v1/integrations/jira/fields` | Lists every system and custom Jira field |
| `GET /v1/integrations/jira/site-url` | Gets the site that Jira reports, for `site_base_url` |
| `POST /v1/integrations/jira/sample-issues` | Returns the most recently updated issues of a project |
| `POST /v1/integrations/jira/preview` | Tries a draft config on recent issues of one project and says which account each would go to |
| `POST /v1/integrations/jira/runs` | Pulls one saved project now |

* **Jira Service Management projects use the `jira` key.** They share Jira's connection and config. Jira's runs, last run, and schedule report the subtype `jira` or `jira_servicedesk`, and the `default` subtype filter still matches them.
* **The lookups call Jira.** They return `502` when Jira refuses or doesn't answer. `GET .../site-url` returns `null` when Jira can't report the site.
* **A project that gets its first active rule starts a 30-day first sync.** So does a task project that has no Statisfy project yet. The save's `sync` says which syncs started and which didn't. A save also locks each mapped field, so it's read-only in the app.
* **When you turn `sync_issue_link` on, Statisfy creates the `JIRA Link` task field.**
* **The sample takes up to 25 issues** (5 by default) and up to 50 issue types. **The preview takes up to 25 issues** (10 by default). A preview project with no active rule in the draft is a `422`.
* **`POST .../runs` pulls one project in `project_keys` that has an active rule.** Another project is a `404`. By default it pulls the issues updated in the last 30 days. Send `start_date` and `end_date` together (`YYYY-MM-DD`), at most 366 days apart.

## Linear

| Endpoint | What it does |
| - | - |
| `POST /v1/integrations/linear/connection/test` | Tests the stored connection |
| `GET /v1/integrations/linear/config` | Gets which projects sync, how each issue finds its account, the field mappings, and the status overrides |
| `PATCH /v1/integrations/linear/config` | Changes the settings you send |
| `GET /v1/integrations/linear/projects` | Lists every project the connection can see |
| `GET /v1/integrations/linear/projects/{project_id}/workflow-states` | Lists the workflow states of a project's teams |
| `GET /v1/integrations/linear/fields` | Lists the issue field paths, each with a value from a recent issue |
| `POST /v1/integrations/linear/preview` | Tries a draft config on recent issues and says which account each would go to |
| `POST /v1/integrations/linear/runs` | Pulls from Linear now |

* **At version `0`, you get the defaults, and nothing syncs.**
* **The lookups call Linear.** They return `409` when Linear isn't connected, and `502` when Linear refuses or doesn't answer.
* **`PATCH .../config` changes only the settings you send, and `null` resets one.** Each mapped Statisfy field becomes read-only in the app. A project has at most one active rule.
* **The preview takes up to 25 issues** (10 by default). It returns Linear issue data.
* **`POST .../runs` pulls the saved projects, or one `project_id`.** A `project_id` that isn't in the config is a `404`. With no saved config, the call returns `422`. Send `start_date` and `end_date` together (`YYYY-MM-DD`), at most 366 days apart.

## Rocketlane

| Endpoint | What it does |
| - | - |
| `POST /v1/integrations/rocketlane/connection/test` | Tests the stored connection |
| `GET /v1/integrations/rocketlane/config` | Gets how each project finds its account, which project and task fields sync, and how each status maps |
| `PATCH /v1/integrations/rocketlane/config` | Changes the settings you send |
| `GET /v1/integrations/rocketlane/projects` | Lists up to 5,000 projects, with their customer |
| `GET /v1/integrations/rocketlane/project-fields` | Lists the field paths of a recent project, each with its value |
| `GET /v1/integrations/rocketlane/catalogue` | Lists the project and task statuses and the fields that can sync |
| `POST /v1/integrations/rocketlane/preview` | Tries a draft config and says which account each project would go to |
| `POST /v1/integrations/rocketlane/runs` | Pulls from Rocketlane now |

* **At version `0`, you get the defaults.** They match the project's `customer.companyName` to the account name, as the app does.
* **The lookups call Rocketlane.** They return `502` when Rocketlane refuses or doesn't answer. In `GET .../projects`, `truncated` is `true` when the list stops before the last project.
* **`PATCH .../config` changes only the settings you send, and `null` resets one to its default.** Each save also writes the Statisfy statuses from Rocketlane's current statuses, with the groups you send in `project_status_groups` and `task_status_groups`.
* **Once saved, the config decides.** A project that no rule covers gets no account.
* **Some values are refused.** Only the `rocketlane_field` and `email_domain` resolver types read a dotted path, such as `customer.companyName`. `rocketlane_field` needs `custom_field_key`. A resolver that can't be built, or a status `option_value` that the catalogue doesn't list, is a `422`. Two Rocketlane statuses with the same name are a `409`.
* **A field ID that Rocketlane no longer lists is dropped.** The answer's `warnings` says so.
* **The preview returns Rocketlane project data.** `scope` `sample` tries up to 20 projects (5 by default). `scope` `all` tries every project and returns counts.
* **`POST .../runs` pulls the projects and tasks changed between `start_date` and `end_date`** (both included), or everything with `bootstrap`. Send both dates, at most 366 days apart. It returns `409` when your CRM hasn't synced yet.

## Slack

| Endpoint | What it does |
| - | - |
| `GET /v1/integrations/slack/workspaces` | Lists each installed Slack workspace, the default, and the name and avatar Statisfy posts under |
| `PUT /v1/integrations/slack/workspaces/default` | Makes a workspace the default |
| `PATCH /v1/integrations/slack/workspaces/{workspace_id}/bot-identity` | Sets the name and avatar Statisfy posts under in one workspace |
| `POST /v1/integrations/slack/connection/test` | Asks Slack who Statisfy's bot is, in one workspace or the default |
| `GET /v1/integrations/stella_slack/channels` | Lists the channels Statisfy is in |
| `PATCH /v1/integrations/slack/channels/{channel_id}` | Sets a channel's account, whether Statisfy reads it, and whether Stella answers in it |
| `GET /v1/integrations/slack/channels/{channel_id}/refresh` | Gets whether a read of the channel is in flight |
| `POST /v1/integrations/slack/channels/{channel_id}/refresh` | Reads the channel's messages again, as a run |
| `POST /v1/integrations/slack/conversations/backfill` | Reads a conversation that Statisfy missed, as a run |
| `POST /v1/integrations/slack/channels/{channel_id}/validate` | Checks that Statisfy's bot can read the channel |
| `POST /v1/integrations/slack/channels/{channel_id}/archive` | Hides the channel in Statisfy, and the bot leaves it |
| `POST /v1/integrations/slack/channels/{channel_id}/unarchive` | Shows the channel in Statisfy again |
| `GET /v1/integrations/slack/auto-join` | Gets the auto-join rule |
| `PUT /v1/integrations/slack/auto-join` | Saves the auto-join rule |
| `POST /v1/integrations/slack/auto-join/preview` | Shows what the next run would join and link for a draft rule |
| `GET /v1/integrations/slack/auto-join/refresh` | Gets the last read of the channel lists |
| `POST /v1/integrations/slack/auto-join/refresh` | Reads the public channel list of each workspace again, as a run |

* **The connection test and the channel check write nothing.** A workspace that isn't installed for your Statisfy workspace returns `success` `false`.
* **The bot's name is at most 80 characters.** The avatar must be an image on Statisfy's CDN, which you upload in the app. Another URL is a `422`. Slack shows them only when `can_customize_sender` is `true`.
* **A channel change changes nothing in Slack.** An account that doesn't exist is a `422`.
* **A channel read has limits.** While a read of the channel is in flight, a new one is a `409`. In the 15 minutes after the last completed read, it's a `409` with `Retry-After`. You can retry a failed read at once. A read that can't be queued is a `503` with `Retry-After`. A read of a channel whose Slack workspace is no longer installed is a `409`. Two reads of one channel at the same time start one: the other is a `409`.
* **A backfill takes a message link or a channel ID.** A message link reads that message's thread and the 9 threads after it. A channel ID reads the last `days` days (1 to 365, 180 by default) and keeps the 10 newest threads.
* **Archive makes the bot leave the channel in Slack.** The channel stays in Slack, and what Statisfy read stays. Unarchive doesn't bring the bot back: invite it in Slack.
* **The auto-join rule has four parts.** Send all of them, with `null` or `[]` for a part you don't use. It takes up to 20 prefixes and 20 suffixes, each 3 to 80 characters. A rule runs at the next hourly Slack run. The preview returns `409` when Slack isn't connected.
* **A read of the channel lists joins nothing.** In the 10 minutes after a completed read, it's a `409` with `Retry-After`. It's also a `409` until your first CRM sync completes, and when Slack isn't connected.

## Microsoft Teams

| Endpoint | What it does |
| - | - |
| `GET /v1/integrations/microsoft_teams/teams` | Lists every team in your Microsoft organization, and whether Statisfy is in it |
| `POST /v1/integrations/microsoft_teams/teams/{team_id}/install` | Adds Statisfy to a team, and queues the read of its channels and members |
| `DELETE /v1/integrations/microsoft_teams/teams/{team_id}/install` | Removes Statisfy from a team |
| `POST /v1/integrations/microsoft_teams/teams/{team_id}/refresh` | Reads the team's channels, members, and recent messages again, as a run |
| `GET /v1/integrations/microsoft_teams/channels` | Lists the channels Statisfy is in |
| `GET /v1/integrations/microsoft_teams/channel-rule` | Gets which channels Statisfy reads |
| `PUT /v1/integrations/microsoft_teams/channel-rule` | Saves the channel rule and applies it to every channel now |
| `PATCH /v1/integrations/microsoft_teams/channels/{channel_id}` | Sets a channel's account, whether Statisfy reads it, and whether Stella answers in it |

* **A Global Administrator approves Statisfy in the app.** A call to Teams returns `409` when Teams isn't connected, and `422` when your organization withdrew its approval.
* **`team_id` is a GUID.** Another value is a `422`. A Teams policy that blocks custom apps is a `422` with the fix. When Statisfy is in the team but the read of its channels wasn't queued, the call returns `503`: repeat it.
* **When you remove Statisfy from a team, the read of its channels stops at once.** What Statisfy read stays.
* **One Teams run goes at a time, for all teams.** While one is in flight, a refresh returns `200` `already_running`. In the 15 minutes after a completed run, it's a `409` with `Retry-After`. `days` is 1 to 90 (30 by default).
* **The channel rule resets the changes made to single channels.** Send both `prefix` and `suffix`, each at most 100 characters. An empty value is no rule. Teams doesn't need to be connected.
* **Stella can't answer in a group chat.** A channel change that turns it on there is a `422`.
* **Microsoft's errors come back as `502` or `503`.** A `502` means Microsoft failed. A `503` means Microsoft throttles Statisfy, with `Retry-After` when Microsoft sends one. A `500` means Statisfy's own Microsoft sign-in failed.
* **A refresh of a team that Statisfy isn't in is a `409`.** So is a refresh after Microsoft refused the connection.

## Health and runs

These endpoints are the app's **Integrations > View monitoring** page. `{source}` and `{subtype}` are a row's values from `GET /v1/integrations/monitoring`, such as `SALESFORCE` and `delta`.

| Endpoint | What it does |
| - | - |
| `GET /v1/integrations/monitoring` | Returns one row per source and subtype your workspace syncs, with its health and schedule |
| `GET /v1/integrations/sync-issues` | Lists the records of one `entity_type` that Statisfy couldn't write back to your CRM |
| `GET /v1/integrations/monitoring/{source}/{subtype}/runs` | Lists a row's latest runs, newest first |
| `PUT /v1/integrations/monitoring/{source}/{subtype}/schedule` | Saves your workspace's own schedule for a row |
| `DELETE /v1/integrations/monitoring/{source}/{subtype}/schedule` | Deletes your workspace's own schedule for a row |
| `GET /v1/integrations/monitoring/{source}/{subtype}/trigger-schema` | Gets the parameters that Run now takes for a row |
| `POST /v1/integrations/monitoring/{source}/{subtype}/runs` | Starts a row's run now, as Run now does |

* **A row's `status` covers its last 5 runs.** It is `healthy`, `degraded`, `failed`, `never_ran`, or `disabled`. `stale_status` says when the row stopped or fell behind its schedule. `schedule.layer` says where the cadence comes from: your workspace (`db`), the integration (`hardcoded`), or Statisfy's default (`default`). It is `none` when no layer sets a cadence.
* **`entity_type` is `account`, `opportunity`, `contact`, `project_task`, or `activity`.** `total` counts every page. Error messages are masked. You retry a failed write in the app.
* **A row's runs take `limit`, 1 to 100** (10 by default).
* **`PUT .../schedule` takes one entry, with the row's `subtype`.** Another subtype, or a cadence the source doesn't take, is a `422` and saves nothing. `enabled` `false` removes your schedule, and the row goes back to its default cadence. `DELETE` does the same.
* **Run now takes `start_time`, `end_time`, and `platform_specific_data`.** `start_time` is in the last 365 days, and a time without a zone is UTC. Give both times a zone, or neither: a mix is a `422`. With `end_time`, the window is at most 365 days. An unknown parameter, or a window for a row whose trigger schema says `accepts_time_window` `false`, is a `422`.
* **Run now returns `409` in three cases.** Your CRM hasn't synced yet, or the row isn't a scheduled integration, or the row's last run completed less than 15 minutes ago. The last case comes with `Retry-After`.
* **A source and subtype that the monitoring table doesn't list are a `404`** on every row endpoint.

## Errors

These meanings are special to integrations. For the error shape and the other codes, see [Errors](https://help.statisfy.com/rest-api/requests.md#errors).

| Status | Code | Meaning for integrations |
| - | - | - |
| `409` | `conflict` | The config changed since you read it: read it again. Or the integration isn't connected, a CRM session expired (reconnect it in the app), your CRM hasn't synced yet, or a cooldown applies (with `Retry-After`). |
| `422` | `validation_failed` | The app's checks refused the change. For Teams, your organization withdrew its approval. |
| `429` | `rate_limited` | The CRM's API limit is used up. Salesforce's limit covers a rolling 24 hours, so there is no `Retry-After`. |
| `502` | `upstream_failed` | The vendor refused the call or didn't answer. Check the connection in the app, then retry. |
| `500` | `internal_error` | A CRM call failed in Statisfy, or a saved config no longer reads. Contact support. |
| `503` | `upstream_failed` | Statisfy couldn't start or queue the run. Retry after `Retry-After`. For Teams, Microsoft throttles Statisfy. For Slack, Slack still limits the rate after a retry, and there is no `Retry-After`. |


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.