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

# Link Activities to an Opportunity

> Manually links activities to an opportunity. Repeated links are idempotent. Email ids are per-mailbox Gmail thread ids; identical mailbox copies are linked too. An explicit manual link clears a previous unlink block.



## OpenAPI

````yaml https://api.monaco.com/openapi.json post /v1/opportunities/{opportunity_id}/activities
openapi: 3.2.1
info:
  title: Monaco Public API
  description: Public API for Monaco
  version: 1.0.0
servers:
  - url: https://api.monaco.com
security: []
paths:
  /v1/opportunities/{opportunity_id}/activities:
    post:
      tags:
        - Opportunities
      summary: Link Activities to an Opportunity
      description: >-
        Manually links activities to an opportunity. Repeated links are
        idempotent. Email ids are per-mailbox Gmail thread ids; identical
        mailbox copies are linked too. An explicit manual link clears a previous
        unlink block.
      operationId: link_activity_to_opportunity
      parameters:
        - name: opportunity_id
          in: path
          required: true
          schema:
            type: string
            format: uuid
            title: Opportunity Id
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ActivityOpportunityLinksRequest'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: >-
                  #/components/schemas/PublicItemResponse_list_ActivityOpportunityLinkResponse__
        4XX:
          description: Client error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PublicErrorResponse'
components:
  schemas:
    ActivityOpportunityLinksRequest:
      properties:
        activities:
          items:
            $ref: '#/components/schemas/ActivityOpportunityLinkRequest'
          type: array
          maxItems: 100
          minItems: 1
          title: Activities
      additionalProperties: false
      type: object
      required:
        - activities
      title: ActivityOpportunityLinksRequest
    PublicItemResponse_list_ActivityOpportunityLinkResponse__:
      properties:
        data:
          items:
            $ref: '#/components/schemas/ActivityOpportunityLinkResponse'
          type: array
          title: Data
        meta:
          $ref: '#/components/schemas/ResponseMeta'
      type: object
      required:
        - data
      title: PublicItemResponse[list[ActivityOpportunityLinkResponse]]
    PublicErrorResponse:
      properties:
        error:
          $ref: '#/components/schemas/ErrorDetail'
      type: object
      required:
        - error
      title: PublicErrorResponse
    ActivityOpportunityLinkRequest:
      properties:
        channel:
          $ref: '#/components/schemas/ActivityChannel'
        activity_id:
          type: string
          minLength: 1
          title: Activity Id
          description: >-
            Activity id within its channel. Email ids are per-mailbox Gmail
            thread ids.
      additionalProperties: false
      type: object
      required:
        - channel
        - activity_id
      title: ActivityOpportunityLinkRequest
    ActivityOpportunityLinkResponse:
      properties:
        channel:
          $ref: '#/components/schemas/ActivityChannel'
        activity_id:
          type: string
          minLength: 1
          title: Activity Id
          description: >-
            Activity id within its channel. Email ids are per-mailbox Gmail
            thread ids.
        basis:
          $ref: '#/components/schemas/ActivityOpportunityLinkBasis'
          default: EXPLICIT_LINK
        id:
          anyOf:
            - type: string
              format: uuid
            - type: 'null'
          title: Id
        opportunity_id:
          type: string
          format: uuid
          title: Opportunity Id
        source:
          anyOf:
            - $ref: '#/components/schemas/ActivityOpportunityLinkSource'
            - type: 'null'
        reason:
          anyOf:
            - type: string
            - type: 'null'
          title: Reason
        confidence:
          anyOf:
            - type: number
            - type: 'null'
          title: Confidence
        created_by_user_id:
          anyOf:
            - type: string
              format: uuid
            - type: 'null'
          title: Created By User Id
        created_at:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Created At
        updated_at:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Updated At
      type: object
      required:
        - channel
        - activity_id
        - id
        - opportunity_id
        - source
        - reason
        - confidence
        - created_by_user_id
        - created_at
        - updated_at
      title: ActivityOpportunityLinkResponse
    ResponseMeta:
      properties:
        timestamp:
          type: string
          format: date-time
          title: Timestamp
          description: Server timestamp of the response
      type: object
      title: ResponseMeta
    ErrorDetail:
      properties:
        code:
          type: string
          title: Code
          description: Machine-readable error code
          examples:
            - not_found
        message:
          type: string
          title: Message
          description: Human-readable error message
          examples:
            - Resource not found
        data:
          anyOf:
            - additionalProperties:
                anyOf:
                  - type: string
                  - type: integer
              type: object
            - type: 'null'
          title: Data
          description: >-
            Details for some codes: `field_too_long` carries `field`, `limit`
            and `actual`, plus `unit` (`items` or `bytes`) when the limit isn't
            in characters; `too_many_custom_fields` carries `entity_type` and
            `limit`
      type: object
      required:
        - code
        - message
      title: ErrorDetail
    ActivityChannel:
      type: string
      enum:
        - email
        - meeting
        - linkedin
        - slack
      title: ActivityChannel
      description: Channel of an activity the activity-opportunity linker evaluates.
    ActivityOpportunityLinkBasis:
      type: string
      enum:
        - EXPLICIT_LINK
        - CONTACT
        - ACCOUNT
      title: ActivityOpportunityLinkBasis
    ActivityOpportunityLinkSource:
      type: string
      enum:
        - ai
        - manual
        - system
      title: ActivityOpportunityLinkSource
      description: Who created an activity-opportunity link.

````

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