POST
/
api
/
v1
/
documents
curl --location --request POST 'https://api.superagent.sh/api/v1/documents' \
--header 'Content-Type: application/json' \
--header 'Autorization: Bearer <token>' \
--data-raw '{
    "name": "My document",
    "type": "PDF",
    "url": "https://digitalassets.tesla.com/tesla-contents/image/upload/IR/TSLA-Q1-2023-Update", 
    "authorization": null,
    "splitter": null
}'
{
  "success": true,
  "data": {
    "id": "clhnyae1t00016i2ixo0027c5",
    "userId": "clhj28u1300006ig02ptpm1sh",
    "user": {},
    "type": "PDF",
    "url": "https://digitalassets.tesla.com/tesla-contents/image/upload/IR/TSLA-Q1-2023-Update",
    "createdAt": "2023-05-14T21:50:59.349000+00:00",
    "updatedAt": "2023-05-14T21:50:59.349000+00:00",
    "index": null,
    "Agent": null
  }
}

Body

name
string
A name for the document.
type
string
The document type. Options: TXT, PDF, YOUTUBE, CSV or URL.
url
string
A publicly available URL for the document.
from_page
number
The first page to ingest.
to_page
string
The last page to ingest.
authorization
object
Any authorization/authentication needed to access the document
splitter
object
The desired text splitter for the document, defaults to CharacterTextSplitter.
metadata
object
Any key values necessary to ingest the document.

Response

success
boolean
Indicates whether the call was successful.
data
object
A document object.
curl --location --request POST 'https://api.superagent.sh/api/v1/documents' \
--header 'Content-Type: application/json' \
--header 'Autorization: Bearer <token>' \
--data-raw '{
    "name": "My document",
    "type": "PDF",
    "url": "https://digitalassets.tesla.com/tesla-contents/image/upload/IR/TSLA-Q1-2023-Update", 
    "authorization": null,
    "splitter": null
}'
{
  "success": true,
  "data": {
    "id": "clhnyae1t00016i2ixo0027c5",
    "userId": "clhj28u1300006ig02ptpm1sh",
    "user": {},
    "type": "PDF",
    "url": "https://digitalassets.tesla.com/tesla-contents/image/upload/IR/TSLA-Q1-2023-Update",
    "createdAt": "2023-05-14T21:50:59.349000+00:00",
    "updatedAt": "2023-05-14T21:50:59.349000+00:00",
    "index": null,
    "Agent": null
  }
}