At a glance:
Use the /insert endpoint to add resources (URLs, files, text or JSON) to a collection for indexing and retrieval. Simply provide a collection_id, resource, and type.

Inserting resources is a core operation that enables you to populate a collection with the data you want to organize and query. By default, Wetrocloud API supports these types of resources:

ResourceParameterDescription
FilefileSupports various file types including .csv, .docx, .epub, .hwp, .ipynb, .jpeg, .jpg, .mbox, .md, .mp3, .mp4, .pdf, .png, .ppt, .pptm, .pptx.
TexttextPlain text content.
JSONjsonStructured data in JSON format.
WebwebWeb-based resources, such as websites.
YoutubeyoutubeYoutube videos with youtube URLs.
AudioaudioSupports various audio file types including .3ga, .8svx, .aac, .ac3, .aif, .aiff, .alac, .amr, .ape, .au, .dss, .flac, .flv, .m4a, .m4b, .m4p, .m4r, .mp3, .mpga, .ogg, .oga, .mogg, .opus, .qcp, .tta, .voc, .wav, .wma, .wv
To use the file type, all files must be provided as URLs. You can consider services like Amazon S3, Cloudinary, or similar platforms to host your files and provide their URLs to the API.

Once inserted, these resources are indexed for use in Retrieval-Augmented Generation (RAG) workflows.

When to Use the Insert Endpoint

Use the /v1/insert/ endpoint when you need to:

  • Add data to a specific collection identified by collection_id.
  • Prepare a dataset for RAG workflows.

How to Insert a Resource

To insert a resource into a collection, make a POST request to the /v1/insert/ endpoint with the required parameters in the body.

Required Parameters

ParameterTypeDescription
collection_idStringThe unique ID obtained from the /create endpoint.
resourceStringThe resource (e.g., a website).
typeStringThe type of resource to insert (e.g., web, file, text, json, youtube).

Request Example

curl --request POST \
  --url https://api.wetrocloud.com/v1/insert/ \
  --header 'Authorization: Token <api-key>' \
  --header 'Content-Type: application/json' \
  --data '{
    "collection_id": "<collection_id>",
    "resource": "https://medium.com/@AlexanderObregon/a-brief-history-of-artificial-intelligence-1656693721f9#:~:text=In%20this%20article%2C%20we%20explore,learning%20are%20breaking%20new%20ground.",
    "type": "web"
  }'

Successful Response

A successful response confirms the operation and tracks token usage.

Example Response

{
  "success": true,
  "tokens": 35
}
FieldDescription
successIndicates whether the resource was inserted successfully.
tokensNumber of tokens consumed during the operation.