Skip to main content
POST
/
v1
/
files
JavaScript
import Spitch from 'spitch';

const client = new Spitch();

const file = await client.files.upload({ file: fs.createReadStream('path/to/file') });

console.log(file.file_id);
{
  "file_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
  "status": "uploading",
  "original_name": "<string>",
  "size_bytes": 123,
  "content_type": "<string>",
  "category": "<string>",
  "created_at": "2023-11-07T05:31:56Z",
  "uploaded_by": "<string>"
}

Body

multipart/form-data
file
file
required

Response

Successful Response

description of a file. Attributes: file_id: unique identifier for the file. status: status of the file, processing or ready original_name: original name of the file. If the file was uploaded via API

file_id
string<uuid>
required
status
enum<string>
required
Available options:
uploading,
ready
original_name
string | null
required
size_bytes
integer | null
required
content_type
string | null
required
category
string | null
required
created_at
string<date-time>
required
uploaded_by
string | null
I