Getting `invalid id` on `cartLinesUpdate` storefront mutation

Here’s my code,

mutation mutateCart {
  cartLinesUpdate(
    cartId: "gid://shopify/Cart/Z2NwLXVzLWNlbnRyYWwxOjAxSkpLSFhZU05RODAxWEg1VlBIODA0OVIw"
    lines: [{id: "gid://shopify/CartLine/8d9cf56b-3645-4ebb-82be-ceaa78d2b428", quantity: 3}]
  ) {
    cart {
      id
    }
    userErrors {
      code
      field
      message
    }
  }
}

I obtained line id using,

query getCart {
  cart(
    id: "gid://shopify/Cart/Z2NwLXVzLWNlbnRyYWwxOjAxSkpLSFhZU05RODAxWEg1VlBIODA0OVIw?key=1564244d987c0d134602122a8afbc9b1"
  ) {
    lines(first: 250) {
      edges {
        node {
          id
          quantity
          merchandise {
            __typename
            ... on ProductVariant {
              id
              product {
                id
              }
            }
          }
        }
      }
    }
  }
}

What am I doing wrong here?

Pardon the late reply. Try adding the cart secret to the cartId in your mutateCart query. Also ensure your token has the correct access scopes. You may need to enable the Storefront API in your dev dashboard settings especially if using custom apps.