# List (https://docs.capy.ai/api-reference/attachments/list)

`GET https://api.capy.ai/api/v1/threads/{threadId}/attachments`

## Authorization

Send an API key as a bearer token: `Authorization: Bearer $CAPY_API_KEY`. See https://docs.capy.ai/api-reference/authentication.md.

## Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `threadId` | path | string | yes |  |
| `after` | query | string | no |  |
| `before` | query | string | no |  |
| `limit` | query | string | no |  |

## Responses

- `200` ThreadAttachmentPage: `ThreadAttachmentPageEncoded`
- `401` capy/Unauthorized: `capy_UnauthorizedEncoded`
- `403` capy/Forbidden: `capy_ForbiddenEncoded \| capy_ForbiddenEncoded`
- `404` capy/ThreadNotFound: `capy_ThreadNotFoundEncoded`
- `429` capy/RateLimited: `capy_RateLimitedEncoded`

## Example

```bash
curl -X GET "https://api.capy.ai/api/v1/threads/{threadId}/attachments" \
  -H "Authorization: Bearer $CAPY_API_KEY"
```

## Referenced schemas

```json
{
  "ThreadAttachmentPageEncoded": {
    "type": "object",
    "properties": {
      "items": {
        "type": "array",
        "items": {
          "$ref": "#/components/schemas/ThreadAttachmentEncoded"
        }
      },
      "cursor": {
        "anyOf": [
          {
            "type": "string",
            "allOf": [
              {
                "minLength": 26
              },
              {
                "maxLength": 26
              }
            ]
          },
          {
            "type": "null"
          }
        ],
        "description": "Opaque exclusive event-ID cursor for after, the same cursor the messages list returns. Null when no newer events remain."
      },
      "beforeCursor": {
        "anyOf": [
          {
            "type": "string",
            "allOf": [
              {
                "minLength": 26
              },
              {
                "maxLength": 26
              }
            ]
          },
          {
            "type": "null"
          }
        ],
        "description": "Opaque exclusive event-ID cursor for before. Null when no older events remain."
      }
    },
    "required": [
      "items",
      "cursor",
      "beforeCursor"
    ],
    "additionalProperties": false
  },
  "ThreadAttachmentEncoded": {
    "type": "object",
    "properties": {
      "id": {
        "type": "string",
        "description": "The file's id, the same `file.fileId` a message's `attachments` carry. Pass it to the download endpoint."
      },
      "name": {
        "type": "string"
      },
      "mediaType": {
        "type": "string"
      },
      "sizeBytes": {
        "anyOf": [
          {
            "type": "number"
          },
          {
            "type": "string",
            "enum": [
              "Infinity",
              "-Infinity",
              "NaN"
            ]
          }
        ]
      },
      "title": {
        "type": "string",
        "description": "The caption the agent gave the file when it delivered it."
      },
      "messageId": {
        "type": "string",
        "description": "The `id` of the transcript message that carries the file. One file the agent delivered in two messages is listed once per message."
      },
      "source": {
        "type": "string",
        "enum": [
          "user",
          "assistant"
        ],
        "description": "`user` for a file a person or integration attached to a message, `assistant` for a file the agent delivered."
      },
      "createdAt": {
        "type": "string"
      }
    },
    "required": [
      "id",
      "name",
      "mediaType",
      "sizeBytes",
      "messageId",
      "source",
      "createdAt"
    ],
    "additionalProperties": false
  },
  "capy_UnauthorizedEncoded": {
    "type": "object",
    "properties": {
      "_tag": {
        "type": "string",
        "enum": [
          "capy/Unauthorized"
        ]
      }
    },
    "required": [
      "_tag"
    ],
    "additionalProperties": false
  },
  "capy_ForbiddenEncoded": {
    "type": "object",
    "properties": {
      "_tag": {
        "type": "string",
        "enum": [
          "capy/Forbidden"
        ]
      }
    },
    "required": [
      "_tag"
    ],
    "additionalProperties": false
  },
  "capy_ThreadNotFoundEncoded": {
    "type": "object",
    "properties": {
      "_tag": {
        "type": "string",
        "enum": [
          "capy/ThreadNotFound"
        ]
      },
      "threadId": {
        "type": "string"
      }
    },
    "required": [
      "_tag",
      "threadId"
    ],
    "additionalProperties": false
  },
  "capy_RateLimitedEncoded": {
    "type": "object",
    "properties": {
      "_tag": {
        "type": "string",
        "enum": [
          "capy/RateLimited"
        ]
      },
      "retryAfterSeconds": {
        "type": "integer"
      }
    },
    "required": [
      "_tag",
      "retryAfterSeconds"
    ],
    "additionalProperties": false
  }
}
```

Full document: https://docs.capy.ai/openapi.json