---
title: "Create an attachment and associate it with a segment"
method: POST
path: "/v1/assets/{asset_id}/segments/{segment_id}/attachments/"
---

# Create an attachment and associate it with a segment

`POST /v1/assets/{asset_id}/segments/{segment_id}/attachments/`

## Request

- Base URL: `https://app.iconik.io/API/files`
- URL: `https://app.iconik.io/API/files/v1/assets/{asset_id}/segments/{segment_id}/attachments/`
- Auth: none declared. Required headers: `App-ID`, `Auth-Token`
- TypeScript: <https://skmtc.dev/iconik/apis/iconik-files/docs/v1/assets/:asset_id/segments/:segment_id/attachments/post.ts> (a function with typed inputs; its response is checked against the schema)

Required roles:
 - can_write_segments

## Path parameters

- `asset_id` string, required
- `segment_id` string, required

## Query parameters

- `use_google_resumable_upload` boolean

## Headers

- `App-ID` string, required
- `Auth-Token` string, required

## Request body

- AttachmentCreateSchema
  - `asset_id` string, uuid, nullable
  - `content_type` string
  - `date_created` string, date-time
  - `date_modified` string, date-time
  - `filename` string
  - `format` string, nullable
  - `id` string, uuid
  - `name` string
  - `segment_id` string, uuid
  - `size` integer, nullable
  - `status` 'OPEN' | 'GROWING' | 'AWAITED' | 'CLOSED' | 'FAILED' | 'ARCHIVED' | 'MISSING' | 'REDISCOVERED' | 'DELETED'
  - `storage_id` string, uuid
  - `storage_method` string
  - `upload_credentials` object
  - `upload_headers` object
  - `upload_method` string
  - `upload_url` string
  - `url` string

## Response `201`

Returns the attachment that was created for this segment

- AttachmentCreateSchema
  - `asset_id` string, uuid, nullable
  - `content_type` string
  - `date_created` string, date-time
  - `date_modified` string, date-time
  - `filename` string
  - `format` string, nullable
  - `id` string, uuid
  - `name` string
  - `segment_id` string, uuid
  - `size` integer, nullable
  - `status` 'OPEN' | 'GROWING' | 'AWAITED' | 'CLOSED' | 'FAILED' | 'ARCHIVED' | 'MISSING' | 'REDISCOVERED' | 'DELETED'
  - `storage_id` string, uuid
  - `storage_method` string
  - `upload_credentials` object
  - `upload_headers` object
  - `upload_method` string
  - `upload_url` string
  - `url` string

## Other responses

- `400`: Bad request, or the segment is not a comment
- `401`: Token is invalid
- `403`: Not allowed to change another user's comment
- `404`: Segment doesn't exist for this asset
- `default`: Error response

---

[API](https://skmtc.dev/iconik/apis/iconik-files.md) - [All operations](https://skmtc.dev/iconik/apis/iconik-files/llms.txt) - [OpenAPI document](https://skmtc.dev/iconik/apis/iconik-files/revisions/ed57d13791a2?raw)
