Skip to main content
POST
/
v1beta
/
namespaces
/
{namespace}
/
documents
JavaScript
import Jetti from 'jetti';

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

const response = await client.beta.namespaces.documents.upsert('namespace', {
  documents: [
    {
      id: 'doc_2024_10k',
      title: 'Annual Report 2024',
      publish_date: '2024-03-15',
      content: 'UNITED STATES SECURITIES AND EXCHANGE COMMISSION...',
    },
    {
      id: 'doc_2024_q3',
      title: 'Quarterly Report Q3 2024',
      publish_date: '2024-11-14',
      content: 'For the quarterly period ended September 30, 2024...',
    },
  ],
});

console.log(response.documents_upserted);
{
  "documents_upserted": 2
}

Path Parameters

namespace
string
required

ID of the namespace to upsert documents to.

Body

application/json

Request to upsert documents to a namespace.

documents
Document · object[]
required

Array of documents to upsert.

Response

Documents upserted successfully.

Response after upserting documents.

documents_upserted
integer
required

Number of documents successfully upserted.