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

# Update an Activity

> Edit an activity's content (type/subject/body/contact_id) and deal link.

deal_id changes route through rpc_link_activity_to_deal (account validation +
backfill + last_activity_at bump); everything else is a direct column PATCH.

Partial edit of an activity's content and its deal link. Only fields present in the request body are touched: an explicit `null` clears a column (e.g. unlinking a contact), an omitted field is left untouched entirely. At least one field must be present, or the request fails with `422`.

System-generated activities are read-only: stage-change/audit rows (any `type` outside `note`/`call`/`meeting`/`email`/`task`) and provider-synced rows (any `source` outside `manual`/`import` — e.g. `calendar`, `gmail`, `outlook`, `slack`, `teams` from a connected Pipedream integration) can't be edited, and this endpoint returns `403`. A `null` `source` is treated as user-created.

`deal_id` is handled specially: a change routes through the same validated RPC as [Link an activity to a deal](/api-reference/activities/link-deal) (so the account-match check, account backfill, and `deals.last_activity_at` bump all still apply), not a raw column write. If the activity is already linked to a different deal, it's unlinked first and then relinked to the new one. Every other field (`type`, `summary` → `subject`, `body`, `contact_id`) is a direct PostgREST column patch.

<Note>The response is just `{"id": "<activity_id>"}` — **not** the updated row. Re-`GET` the activity if you need the fresh state back.</Note>

### Auth

Requires a CRM manage [scope](/authentication#scopes) and an active organization on the token. Any `*:manage` scope qualifies — in practice `contacts:manage`, `deals:manage`, `companies:manage`, or `activities:manage`.

### Response

| Field | Type            | Description        |
| ----- | --------------- | ------------------ |
| `id`  | `string` (uuid) | The activity's id. |

### Errors

| Status                     | Cause                                                                                                                                                                                                                    |
| -------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `403 Forbidden`            | Activity is system-generated (non-user `type` or `source`) and can't be edited.                                                                                                                                          |
| `404 Not Found`            | Activity doesn't exist in this org; or, if `deal_id` is being changed, the new deal doesn't exist.                                                                                                                       |
| `409 Conflict`             | Only reachable under a race: the router always unlinks the activity's current deal before relinking to the new one, so the RPC's "already linked to a different deal" check should not normally fire from this endpoint. |
| `422 Unprocessable Entity` | No fields present in the body; or the new deal's account conflicts with the activity's account.                                                                                                                          |


## OpenAPI

````yaml PATCH /activities/{activity_id}
openapi: 3.1.0
info:
  title: anycrm-api
  version: 0.0.1
servers: []
security: []
tags:
  - name: Customer Intelligence
    description: >-
      Company research and ICP-fit scoring — create a research run, track its
      progress, and read back scored companies as leads.
  - name: Outreach
    description: >-
      The cold-email management console — domains, mailboxes, and campaigns — as
      a thin control plane over the SalesForge stack.
  - name: AnyCard
    description: >-
      Authenticated CRUD for AnyCard, the org's digital business-card /
      lead-capture product.
  - name: AnyCard Events
    description: >-
      Event-attribution analytics for AnyCard — which captured leads converted,
      broken down by source, owner, and deal.
  - name: AnyCard Share Links
    description: >-
      Unauthenticated endpoints reached by anyone who scans a QR code or opens a
      shared AnyCard link.
  - name: AI
    description: >-
      A streaming (SSE) AI chat endpoint with account-commit actions it can take
      on the caller's behalf.
  - name: Analytics Assistant
    description: >-
      The natural-language analytics assistant — a guarded text-to-SQL loop
      (SSE) that answers ad-hoc questions over the org's CRM data as a
      least-privilege, read-only database role.
  - name: Account Readiness
    description: >-
      Account Readiness Profiles — AI-scored signals on whether an account is
      ready for outreach or expansion, computed via a Temporal workflow.
  - name: Integrations
    description: >-
      Pipedream Connect — issuing connect tokens and managing the org's
      connected third-party accounts.
  - name: Feedback
    description: >-
      User-submitted platform feedback (bug reports, feature requests) — global,
      not scoped to one organization.
  - name: Public Media
    description: >-
      Unauthenticated image reads for publicly-embeddable assets (card photos,
      inline email images) — allowlisted by key shape; everything else in the
      storage bucket stays private.
  - name: Service Health
    description: Service liveness.
paths:
  /activities/{activity_id}:
    patch:
      tags:
        - Activities
      summary: Update Activity
      description: >-
        Edit an activity's content (type/subject/body/contact_id) and deal link.


        deal_id changes route through rpc_link_activity_to_deal (account
        validation +

        backfill + last_activity_at bump); everything else is a direct column
        PATCH.
      operationId: update_activity_activities__activity_id__patch
      parameters:
        - name: activity_id
          in: path
          required: true
          schema:
            type: string
            description: The activity's id to update.
            title: Activity Id
          description: The activity's id to update.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ActivityUpdateBody'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Update Activity Activities  Activity Id  Patch
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - HTTPBearer: []
components:
  schemas:
    ActivityUpdateBody:
      properties:
        type:
          anyOf:
            - type: string
            - type: 'null'
          title: Type
          description: New activity type; omit to leave unchanged.
        summary:
          anyOf:
            - type: string
            - type: 'null'
          title: Summary
          description: >-
            New subject line; omit to leave unchanged, maps to the subject
            column.
        body:
          anyOf:
            - type: string
            - type: 'null'
          title: Body
          description: New body text; omit to leave unchanged.
        contact_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Contact Id
          description: New contact link, or null to clear it; omit to leave unchanged.
        deal_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Deal Id
          description: >-
            New deal link, or null to unlink; omit to leave unchanged, routed
            through the link-deal RPC.
      type: object
      title: ActivityUpdateBody
      description: >-
        Partial edit of an activity's content and associations.


        Only fields present in the request are patched — an explicit ``null``
        clears

        the column (e.g. unlinking a deal/contact), while an omitted field is
        left

        untouched.
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
  securitySchemes:
    HTTPBearer:
      type: http
      scheme: bearer

````