---
title: "Update an Attachment"
method: POST
path: "/attachments/{attachment_id}"
tags: ["Targeting Attachments"]
---

# Update an Attachment

`POST /attachments/{attachment_id}`

## Request

- Base URL: `https://api.mediamath.com/api/v3.0`
- URL: `https://api.mediamath.com/api/v3.0/attachments/{attachment_id}`
- Auth: OAuth 2
  - Authorization code: `https://auth.mediamath.com/authorize`
  - Token URL: `https://auth.mediamath.com/oauth/token` scopes: `offline_access`, `manage:services`
- TypeScript: <https://skmtc.dev/mediamath/apis/campaigns-api/docs/attachments/:attachment_id/post.ts> (a function with typed inputs; its response is checked against the schema)

Update an attachment by ID

## Path parameters

- `attachment_id` integer, required

## Request body

- AttachmentUpdate
  - `target_id` number
  - `version` number, required
  - `strategy_id` number
  - `restriction` 'INCLUDE' | 'EXCLUDE'
  - `operator` 'OR' | 'AND'
  - `or_better` boolean

## Response `200`

Attachment response

- object
  - `data` AttachmentBase
    - `id` integer, required
    - `entity_type` string, required
    - `target_id` number, required
    - `strategy_id` number, required
    - `restriction` 'INCLUDE' | 'EXCLUDE', required
    - `operator` 'OR' | 'AND', required
    - `created_on` string, required
    - `updated_on` string, required
    - `version` number, required
    - `or_better` boolean
  - `meta` SingleMetadata
    - `status` string, required

## Other responses

- `400`: Error response
- `401`: Error response
- `403`: Error response
- `404`: Error response
- `409`: Error response

---

[API](https://skmtc.dev/mediamath/apis/campaigns-api.md) - [All operations](https://skmtc.dev/mediamath/apis/campaigns-api/llms.txt) - [OpenAPI document](https://skmtc.dev/mediamath/apis/campaigns-api/revisions/408743891def?raw)
