Skip to content

POST /v1/projects/{id}/attachments

Uploads a file and returns its Attachment once ready to download.

photon.projects.uploadAttachment(input: UploadAttachmentInput, options?: RequestOptions): Promise<UploadAttachmentOutput>
import { Photon } from "@photon-ai/api";

const photon = new Photon({
  headers: { Authorization: `Bearer ${process.env.PHOTON_API_TOKEN}` },
});
const result = await photon.projects.uploadAttachment({
  path: {
    id: "id",
  },
  headers: {
    "content-length": "18",
    "content-type": "text/plain",
    "idempotency-key": "idempotency-key",
  },
  body: new Blob(["Hello from Photon."], { type: "text/plain" }),
});
{
  "contentType": "string",
  "createdAt": "2026-01-01T00:00:00Z",
  "filename": "string",
  "id": "string",
  "metadata": {},
  "projectId": "string",
  "sizeBytes": 1,
  "updatedAt": "2026-01-01T00:00:00Z"
}

Parameters

idstringrequired
content-lengthstringrequired
content-typestringrequired
idempotency-keystringrequired

Reuse the same key and request for retries.

Returns

200 The attachment upload had already been committed. Attachment

contentTypestringrequired
createdAtstring (date-time)required
filenamestring
idstringrequired
metadataobject
projectIdstringrequired
sizeBytesintegerrequired
updatedAtstring (date-time)required

201 The attachment was uploaded and committed. Attachment

Headers: Location. The raw response carries these headers; see Raw responses.

contentTypestringrequired
createdAtstring (date-time)required
filenamestring
idstringrequired
metadataobject
projectIdstringrequired
sizeBytesintegerrequired
updatedAtstring (date-time)required