File API

Upload a new file to the system. Supports various file formats including PDF, DOC, DOCX, PPT, PPTX, JPG, PNG, EML, HTML, SRT, CSV, XLS, and XLSX.

File uploads do not accept team parameters. When you attach a file to a Knowledge Graph, the file inherits the team scope of that Knowledge Graph.

post/v1/files

Request

  • Base URL
    https://api.writer.com
  • URL
    https://api.writer.com/v1/files
  • Auth
    HTTP bearer

Query parameters

graphIdstring uuid

The unique identifier of the Knowledge Graph to associate the uploaded file with.

Note: The response from the upload endpoint does not include the graphId field, but the association will be visible when you retrieve the file using the file retrieval endpoint.

Headers

Content-Dispositionstring required

The disposition type of the file, typically used to indicate the form-data name. Use attachment with the filename parameter to specify the name of the file, for example: attachment; filename=example.pdf.

Content-Typestring required

The MIME type of the file being uploaded. Supports txt, doc, docx, ppt, pptx, jpg, png, eml, html, pdf, srt, csv, xls, xlsx, mp3, and mp4 file extensions.

Content-Lengthinteger required

The size of the file in bytes.

Request body text/plain

string binary required

Response

idstring required

A unique identifier of the file.

created_atstring date-time required

The timestamp when the file was uploaded.

namestring required

The name of the file.

graph_idsstring[] required

A list of Knowledge Graph IDs that the file is associated with.

If you provided a graphId during upload, the file is associated with that Knowledge Graph. However, the graph_ids field in the upload response is an empty list. The association will be visible in the graph_ids list when you retrieve the file using the file retrieval endpoint.

statusstring required

The processing status of the file.

Changes

    • info

      added the new optional query request parameter graphId

    • breaking

      removed the media type application/octet-stream from the request body

    • breaking

      removed the media type audio/mpeg from the request body

    • breaking

      removed the media type video/mp4 from the request body

    • info

      added the media type message/rfc822 to the request body