---
title: analyticsAnnotationUpdate - GraphQL Admin
description: >-
  Updates an existing [analytics
  annotation](https://shopify.dev/docs/api/admin-graphql/latest/objects/AnalyticsAnnotation).

  Only the fields provided in the `input` argument are modified; omitted fields
  remain unchanged.

  Setting `endedAt` to `null` makes the annotation open-ended.


  An app can update only annotations that it created. If an app attempts to
  update an annotation that it

  didn't create, then the mutation returns a `NOT_FOUND` error.


  Use
  [`analyticsAnnotationCreate`](https://shopify.dev/docs/api/admin-graphql/latest/mutations/analyticsAnnotationCreate)

  to create a new annotation, or

  [`analyticsAnnotationDelete`](https://shopify.dev/docs/api/admin-graphql/latest/mutations/analyticsAnnotationDelete)

  to remove it.


  If provided, the `type` field must specify a supported type for app-created
  annotations. Refer to the list of

  [supported
  types](https://shopify.dev/docs/api/shopifyql/latest/syntax/annotate#annotation-categories-and-types).
api_version: 2026-10
source_url:
  html: >-
    https://shopify.dev/docs/api/admin-graphql/latest/mutations/analyticsAnnotationUpdate
  md: >-
    https://shopify.dev/docs/api/admin-graphql/latest/mutations/analyticsAnnotationUpdate.md
api_name: admin
api_type: graphql
type: mutation
---

# analytics​Annotation​Update

mutation

Requires Requires `write_analytics_annotations` access scope.

Updates an existing [analytics annotation](https://shopify.dev/docs/api/admin-graphql/latest/objects/AnalyticsAnnotation). Only the fields provided in the `input` argument are modified; omitted fields remain unchanged. Setting `endedAt` to `null` makes the annotation open-ended.

An app can update only annotations that it created. If an app attempts to update an annotation that it didn't create, then the mutation returns a `NOT_FOUND` error.

Use [`analyticsAnnotationCreate`](https://shopify.dev/docs/api/admin-graphql/latest/mutations/analyticsAnnotationCreate) to create a new annotation, or [`analyticsAnnotationDelete`](https://shopify.dev/docs/api/admin-graphql/latest/mutations/analyticsAnnotationDelete) to remove it.

If provided, the `type` field must specify a supported type for app-created annotations. Refer to the list of [supported types](https://shopify.dev/docs/api/shopifyql/latest/syntax/annotate#annotation-categories-and-types).

## Arguments

* id

  [ID!](https://shopify.dev/docs/api/admin-graphql/latest/scalars/ID)

  required

  The ID of the analytics annotation to update.

* input

  [Analytics​Annotation​Update​Input!](https://shopify.dev/docs/api/admin-graphql/latest/input-objects/AnalyticsAnnotationUpdateInput)

  required

  The input fields for updating the analytics annotation.

***

## Analytics​Annotation​Update​Payload returns

* analytics​Annotation

  [Analytics​Annotation](https://shopify.dev/docs/api/admin-graphql/latest/objects/AnalyticsAnnotation)

  The updated analytics annotation.

* user​Errors

  [\[Analytics​Annotation​Update​User​Error!\]!](https://shopify.dev/docs/api/admin-graphql/latest/objects/AnalyticsAnnotationUpdateUserError)

  non-null

  The list of errors that occurred from executing the mutation.

***

## Examples

* ### Update an analytics annotation

  #### Description

  Update an app-authored annotation created by the same app.

  #### Query

  ```graphql
  mutation analyticsAnnotationUpdate($id: ID!, $input: AnalyticsAnnotationUpdateInput!) {
    analyticsAnnotationUpdate(id: $id, input: $input) {
      analyticsAnnotation {
        id
        type
        title
        startedAt
        endedAt
        description
        createdByApp {
          id
          title
        }
      }
      userErrors {
        field
        message
        code
      }
    }
  }
  ```

  #### Variables

  ```json
  {
    "id": "gid://shopify/AnalyticsAnnotation/1234567890",
    "input": {
      "type": "campaign",
      "title": "Brightleaf Campaigns BFCM 12-email cadence",
      "startedAt": "2026-11-28T00:00:00Z",
      "endedAt": "2026-12-01T00:00:00Z",
      "description": "Sent to lapsed-90-day segment; $96 RPR target"
    }
  }
  ```

  #### cURL

  ```bash
  curl -X POST \
  https://your-development-store.myshopify.com/admin/api/2026-10/graphql.json \
  -H 'Content-Type: application/json' \
  -H 'X-Shopify-Access-Token: {access_token}' \
  -d '{
  "query": "mutation analyticsAnnotationUpdate($id: ID!, $input: AnalyticsAnnotationUpdateInput!) { analyticsAnnotationUpdate(id: $id, input: $input) { analyticsAnnotation { id type title startedAt endedAt description createdByApp { id title } } userErrors { field message code } } }",
   "variables": {
      "id": "gid://shopify/AnalyticsAnnotation/1234567890",
      "input": {
        "type": "campaign",
        "title": "Brightleaf Campaigns BFCM 12-email cadence",
        "startedAt": "2026-11-28T00:00:00Z",
        "endedAt": "2026-12-01T00:00:00Z",
        "description": "Sent to lapsed-90-day segment; $96 RPR target"
      }
    }
  }'
  ```

  #### React Router

  ```javascript
  import { authenticate } from "../shopify.server";

  export const loader = async ({request}) => {
    const { admin } = await authenticate.admin(request);
    const response = await admin.graphql(
      `#graphql
    mutation analyticsAnnotationUpdate($id: ID!, $input: AnalyticsAnnotationUpdateInput!) {
      analyticsAnnotationUpdate(id: $id, input: $input) {
        analyticsAnnotation {
          id
          type
          title
          startedAt
          endedAt
          description
          createdByApp {
            id
            title
          }
        }
        userErrors {
          field
          message
          code
        }
      }
    }`,
    {
      variables: {
          "id": "gid://shopify/AnalyticsAnnotation/1234567890",
          "input": {
              "type": "campaign",
              "title": "Brightleaf Campaigns BFCM 12-email cadence",
              "startedAt": "2026-11-28T00:00:00Z",
              "endedAt": "2026-12-01T00:00:00Z",
              "description": "Sent to lapsed-90-day segment; $96 RPR target"
          }
      },
    },
    );
    const json = await response.json();
    return json.data;
  }
  ```

  #### Ruby

  ```ruby
  session = ShopifyAPI::Auth::Session.new(
    shop: "your-development-store.myshopify.com",
    access_token: access_token
  )
  client = ShopifyAPI::Clients::Graphql::Admin.new(
    session: session
  )

  query = <<~QUERY
    mutation analyticsAnnotationUpdate($id: ID!, $input: AnalyticsAnnotationUpdateInput!) {
      analyticsAnnotationUpdate(id: $id, input: $input) {
        analyticsAnnotation {
          id
          type
          title
          startedAt
          endedAt
          description
          createdByApp {
            id
            title
          }
        }
        userErrors {
          field
          message
          code
        }
      }
    }
  QUERY

  variables = {
    "id": "gid://shopify/AnalyticsAnnotation/1234567890",
    "input": {
      "type": "campaign",
      "title": "Brightleaf Campaigns BFCM 12-email cadence",
      "startedAt": "2026-11-28T00:00:00Z",
      "endedAt": "2026-12-01T00:00:00Z",
      "description": "Sent to lapsed-90-day segment; $96 RPR target"
    }
  }

  response = client.query(query: query, variables: variables)
  ```

  #### Node.js

  ```javascript
  const client = new shopify.clients.Graphql({session});
  const data = await client.query({
    data: {
      "query": `mutation analyticsAnnotationUpdate($id: ID!, $input: AnalyticsAnnotationUpdateInput!) {
        analyticsAnnotationUpdate(id: $id, input: $input) {
          analyticsAnnotation {
            id
            type
            title
            startedAt
            endedAt
            description
            createdByApp {
              id
              title
            }
          }
          userErrors {
            field
            message
            code
          }
        }
      }`,
      "variables": {
          "id": "gid://shopify/AnalyticsAnnotation/1234567890",
          "input": {
              "type": "campaign",
              "title": "Brightleaf Campaigns BFCM 12-email cadence",
              "startedAt": "2026-11-28T00:00:00Z",
              "endedAt": "2026-12-01T00:00:00Z",
              "description": "Sent to lapsed-90-day segment; $96 RPR target"
          }
      },
    },
  });
  ```

  #### Shopify CLI

  ```bash
  shopify app execute \
  --query \
  'mutation analyticsAnnotationUpdate($id: ID!, $input: AnalyticsAnnotationUpdateInput!) {
    analyticsAnnotationUpdate(id: $id, input: $input) {
      analyticsAnnotation {
        id
        type
        title
        startedAt
        endedAt
        description
        createdByApp {
          id
          title
        }
      }
      userErrors {
        field
        message
        code
      }
    }
  }' \
  --variables \
  '{
    "id": "gid://shopify/AnalyticsAnnotation/1234567890",
    "input": {
      "type": "campaign",
      "title": "Brightleaf Campaigns BFCM 12-email cadence",
      "startedAt": "2026-11-28T00:00:00Z",
      "endedAt": "2026-12-01T00:00:00Z",
      "description": "Sent to lapsed-90-day segment; $96 RPR target"
    }
  }'
  ```

  #### Direct API Access

  ```javascript
  const response = await fetch('shopify:admin/api/2026-10/graphql.json', {
    method: 'POST',
    body: JSON.stringify({
      query: `
        mutation analyticsAnnotationUpdate($id: ID!, $input: AnalyticsAnnotationUpdateInput!) {
          analyticsAnnotationUpdate(id: $id, input: $input) {
            analyticsAnnotation {
              id
              type
              title
              startedAt
              endedAt
              description
              createdByApp {
                id
                title
              }
            }
            userErrors {
              field
              message
              code
            }
          }
        }
      `,
      variables: {
          "id": "gid://shopify/AnalyticsAnnotation/1234567890",
          "input": {
              "type": "campaign",
              "title": "Brightleaf Campaigns BFCM 12-email cadence",
              "startedAt": "2026-11-28T00:00:00Z",
              "endedAt": "2026-12-01T00:00:00Z",
              "description": "Sent to lapsed-90-day segment; $96 RPR target"
          }
      },
    }),
  });

  const { data } = await response.json();
  console.log(data);
  ```

  #### Response

  ```json
  {
    "analyticsAnnotationUpdate": {
      "analyticsAnnotation": {
        "id": "gid://shopify/AnalyticsAnnotation/1234567890",
        "type": "campaign",
        "title": "Brightleaf Campaigns BFCM 12-email cadence",
        "startedAt": "2026-11-28T00:00:00Z",
        "endedAt": "2026-12-01T00:00:00Z",
        "description": "Sent to lapsed-90-day segment; $96 RPR target",
        "createdByApp": {
          "id": "gid://shopify/App/123456",
          "title": "Brightleaf Campaigns"
        }
      },
      "userErrors": []
    }
  }
  ```

* ### analyticsAnnotationUpdate reference
