Snapchat Ads API: 415 Unsupported Media Type on PATCH

Your POST works, your PATCH to the same campaign returns 415, and the obvious reading is that the endpoint does not exist. It exists. Snapchat's PATCH speaks JSON Patch, and only under one content type.

Start free →

Made with Hermoso

Pausing a campaign or changing an ad squad's budget through the Snapchat Marketing API looks like a plain JSON update. Send it that way and Snapchat answers 415. We hit this ourselves: our pause and budget changes on Snapchat failed every time until the request format was fixed.

The exact error

A PATCH to a campaign, ad squad, ad or creative with Content-Type: application/json and an object body returns HTTP 415 Unsupported Media Type.

What it means

Snapchat's API patterns page says the PATCH endpoints "allow partial updates using JSON Patch (RFC 6902)" and that "The Content-Type header must be application/json-patch+json." A plain JSON object is not a JSON Patch document, so Snapchat rejects the media type before it reads the body.

The rules from the same page:

  • Supported operations: replace, add, remove and test. "The move and copy operations are not supported."
  • PATCH "is supported for the entities Creative, Ad, Ad Squad and Campaign."

Why it happens

  • Your HTTP client sends application/json by default.
  • Your body is an object like a POST body, not an array of operations.
  • You read the 415 next to a working POST as "this endpoint does not exist" and went looking for a different path. The path was right all along; only the format was wrong.
  • You switched to PUT to get around the 415. That clears the 415 and fails differently: a PUT that echoes back the object you read carries fields that appear on reads but in no create example, such as enable_targeting_expansion and auto_expansion_options, and Snapchat rejects them.

How to fix it

  1. Set the header Content-Type: application/json-patch+json on the PATCH request.
  2. Send an array of operations, for example [{"op": "replace", "path": "/status", "value": "PAUSED"}] to pause.
  3. Use only replace, add, remove and test, and only on campaigns, ad squads, ads and creatives.
  4. Use test to guard a change, so the patch fails if the current value is not what you expect.
  5. Read the entity back after the patch to confirm the change and that nothing else moved.

How Hermoso handles it

Hermoso sends every Snapchat status and budget change as a JSON Patch with the right content type, in both directions, including pausing. JSON Patch also settles the question a PUT cannot: whether an update replaces the whole object or merges into it. We verified a budget change live where the budget moved and the geos, demographics, bid strategy, optimisation goal and status read back byte-identical afterwards.

Changes are reported from a read-back of the entity, not from what was sent. Hermoso also renews Snapchat's access token on its own, since Snapchat's expires after an hour. See the Snapchat Ads channel. Hermoso works with Snapchat Ads.

Related

Every platform error we have documented is on the error reference. For app reviews and access levels, see how to get API access.

Sources

Frequently asked questions

Why does Snapchat's Marketing API return 415 on PATCH?

Snapchat's PATCH endpoints use JSON Patch (RFC 6902) and require Content-Type application/json-patch+json. A plain JSON body is rejected.

Which operations does Snapchat PATCH support?

replace, add, remove and test. move and copy are not supported.

Which Snapchat entities support PATCH?

Creative, Ad, Ad Squad and Campaign.

Skip the error hunting: connect your accounts to Hermoso free, no card.

Start free →   See pricing