POST
/
documents
JavaScript
import Tractorbeam from 'tractorbeam';

const client = new Tractorbeam({
  apiToken: process.env['TRACTORBEAM_API_TOKEN'], // This is the default and can be omitted
});

async function main() {
  const document = await client.documents.create({ name: 'my_document.txt' });

  console.log(document.id);
}

main();
{
  "id": "doc_2yYISEvrO9LrLAOJjnw27",
  "name": "my_document.txt",
  "owner": "org_2nlswGH0pZ1V1OlHYAUwQG6TVBx",
  "file_type": "text/plain",
  "file_bytes": 1234,
  "created_at": "2024-01-01T00:00:00.000Z"
}

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Body

application/json

Response

201 - application/json

Document created successfully

The response is of type object.