# Sync a single co-sell referral with the partner / CRM

`POST https://api.suger.cloud/org/{orgId}/cosell/referral/{referralId}/sync`

Trigger a one-way sync for a specific referral. Controlled by `direction`:
- OUTBOUND: CRM -> Fours -> Partner (push local changes to the cloud partner)
- INBOUND (default): Partner -> Fours -> CRM (pull partner-side updates into Fours and CRM)

This is the primary way to push a Fours-side edit to the partner after calling UpdateCosellReferral, and to refresh Fours with the partner's latest stage/status for an inbound referral.

Side effect: for AWS / Azure / GCP, calls the partner API (AWS ACE / Azure Partner Center / GCP) and writes back to Fours DB + linked CRM record (Salesforce / HubSpot / Dynamics 365).

A SUGER referral has no external partner system, so there is nothing to push to a partner here — the partner's copy is kept in step by Fours itself. On a SUGER referral this synchronizes the linked CRM record and accepts `direction=OUTBOUND` only; `direction=INBOUND` returns an error.

Use this when: user wants to "submit", "push", "refresh", or "sync" one referral.

## Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `orgId` | path | string | yes | Organization ID |
| `referralId` | path | string | yes | Cosell Referral ID |
| `direction` | query | string | no | Sync direction: INBOUND or OUTBOUND (default INBOUND) |

## Responses

### 200 — OK

Content-Type: `application/json` · Schema: `OperationExecutionDetails`

**`OperationExecutionDetails`** fields:

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `newWorkflowStarted` | boolean | no |  |
| `referralId` | string | no | ReferralID is the created referral's id, set by the SUGER co-sell create so the caller can chain follow-up calls (e.g. InviteCosellPartners) onto the new engagement without re-querying. Empty elsewhere. |
| `runID` | string | no |  |
| `slackMirrorWarning` | string | no | SlackMirrorWarning is a non-blocking advisory set when a SUGER co-sell console message was saved but could not be mirrored to the partner's Slack channel (no workspace connected, no channel mapped, bot not in the channel, or a transient post failure). Empty when the message mirrored or Slack is not involved. The console surfaces it as a warning toast; the message is always persisted regardless (best-effort mirror). |
| `status` | string | no |  |
| `workflowID` | string | no |  |

### 400 — Bad request error

Content-Type: `application/json` · Schema: `ErrorResponse`

**`ErrorResponse`** fields:

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `code` | ErrorCode | no |  |
| `info` | object | no |  |
| `message` | string | no |  |

### 404 — Referral not found

Content-Type: `application/json` · Schema: `ErrorResponse`

**`ErrorResponse`** fields:

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `code` | ErrorCode | no |  |
| `info` | object | no |  |
| `message` | string | no |  |

### 500 — Internal server error

Content-Type: `application/json` · Schema: `ErrorResponse`

**`ErrorResponse`** fields:

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `code` | ErrorCode | no |  |
| `info` | object | no |  |
| `message` | string | no |  |

## Example

_Generated from this operation's schema. Values are placeholders — substitute your own ids, and set `SUGER_TOKEN` to a bearer token from the [OAuth client-credentials exchange](https://doc.fours.com/settings/oauth-app/)._

### Request

```bash
curl -X POST 'https://api.suger.cloud/org/{orgId}/cosell/referral/{referralId}/sync' \
  -H "Authorization: Bearer $SUGER_TOKEN"
```

### Response — 200

```json
{
  "newWorkflowStarted": true,
  "referralId": "01H0000000000000000000",
  "runID": "01H0000000000000000000",
  "slackMirrorWarning": "string",
  "status": "string",
  "workflowID": "01H0000000000000000000"
}
```

### Error — 400

```json
{
  "code": "InternalServerError",
  "message": "string"
}
```

---

API reference: https://doc.fours.com/api/
