*MCP › Reference › CRM*

# Link a document to an opportunity

> Ties to the opportunity the quote, the order or the project that came out of it.

With `kind: "quote"` and `isPrimary: true`, that quote becomes the primary one and the others are demoted. `meta.created` distinguishes a new link from one that already existed, which is what a retry needs to know. Returns the full opportunity, the same projection as its GET. The link itself —`kind`, `linkedEntityId`, `created`— goes in `meta`.

TOOL `filmo_crm_opportunities_link` · `crm:write` · 120/min · May need an add-on

## Arguments

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `opportunityId` | string | Yes | Opportunity identifier. |
| `kind` | string | Yes | What is linked to the opportunity. `quote`, `order`, `project` |
| `quoteId` | string | No | Quote. Required with kind="quote". |
| `orderId` | string | No | Order. Required with kind="order". |
| `projectId` | string | No | Project. Required with kind="project". |
| `isPrimary` | boolean | No | Only with kind="quote": marks this quote as the primary one. |
| `idempotencyKey` | string | No | Idempotency key chosen by the client (a UUID is recommended). Repeating the same key with the same arguments within 24 h returns the stored response without executing again; with different arguments it responds 422. It is the safe way to retry after a network failure. |
| `ifMatch` | string | No | Optimistic locking: the meta.etag you got from the detail read of this resource (or "*"). If the resource changed since, the call fails with 412 precondition_failed before writing anything; read it again and retry. Omit it to write unconditionally. |

## Result

On success the result carries `structuredContent` with `data` and `meta`. These are the attributes of `data`.

| Name | Type | Description |
| --- | --- | --- |
| `opportunityId` | string |  |
| `identifier` | string |  |
| `name` | string |  |
| `status` | string |  `open`, `won`, `lost` |
| `amount` | string |  |
| `currency` | string |  |
| `pipelineId` | string |  |
| `pipelineName` | string |  |
| `stageId` | string |  |
| `stageName` | string |  |
| `stageType` | string |  `open`, `won`, `lost` |
| `effectiveProbability` | number |  |
| `weightedAmount` | string |  |
| `daysInStage` | integer |  |
| `expectedCloseDate` | string<date-time> |  |
| `contactName` | string |  |
| `companyName` | string |  |
| `ownerName` | string |  |
| `source` | string |  `inbound_email`, `website_form`, `referral`, `cold_outreach`, `event`, `social`, `existing_customer`, `partner`, `other` |
| `createdAt` | string<date-time> |  |
| `updatedAt` | string<date-time> |  |
| `description` | string |  |
| `version` | integer |  |
| `collaboratorStaffIds` | string[] |  |
| `quoteIds` | string[] |  |
| `stageHistory` | object[] |  |
| `stageHistory.fromStageId` | string |  |
| `stageHistory.toStageId` | string |  |
| `stageHistory.toStatus` | string |  |
| `stageHistory.daysInPrevStage` | integer |  |
| `stageHistory.movedAt` | string<date-time> |  |
| `stageHistory.note` | string |  |

*Call · filmo_crm_opportunities_link*

```json
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "filmo_crm_opportunities_link",
    "arguments": {
      "opportunityId": "oppo_8f2a1c",
      "kind": "quote"
    }
  }
}
```

*Result (generated from the schema)*

```json
{
  "structuredContent": {
    "data": {
      "opportunityId": "oppo_8f2a1c",
      "identifier": "<identifier>",
      "name": "Example",
      "status": "open",
      "amount": "1234.50",
      "currency": "EUR",
      "pipelineId": "pipe_8f2a1c",
      "pipelineName": "Example",
      "stageId": "stag_8f2a1c",
      "stageName": "Example",
      "stageType": "open",
      "effectiveProbability": 1,
      "weightedAmount": "1234.50",
      "daysInStage": 1,
      "expectedCloseDate": "2026-09-01T08:00:00Z",
      "contactName": "Example",
      "companyName": "Example",
      "ownerName": "Example",
      "source": "inbound_email",
      "createdAt": "2026-09-01T08:00:00Z",
      "updatedAt": "2026-09-01T08:00:00Z",
      "description": "<description>",
      "version": 1,
      "collaboratorStaffIds": [
        "coll_8f2a1c"
      ],
      "quoteIds": [
        "quot_8f2a1c"
      ],
      "stageHistory": [
        {
          "fromStageId": "from_8f2a1c",
          "toStageId": "tost_8f2a1c",
          "toStatus": "<toStatus>",
          "daysInPrevStage": 1,
          "movedAt": "2026-09-01T08:00:00Z",
          "note": "<note>"
        }
      ]
    },
    "meta": {
      "idempotencyKey": "<the key you sent, or the one the server generated>",
      "rateLimit": {
        "limit": 120,
        "remaining": 119,
        "reset": 42
      }
    }
  }
}
```

## The same operation by REST

This tool runs [`POST /api/v1/crm/opportunities/{opportunityId}/links`](https://docs.filmo.io/rest-api/endpoint-reference/crm/link-a-document-to-an-opportunity).

---

Canonical URL: https://docs.filmo.io/mcp/tools/crm/filmo-crm-opportunities-link  
Last updated: 2026-10-25