Skip to content

Documents

Text and file ingestion, listing, removal and full base export.

Updated on Aug 10, 2026

Two input paths: plain text in JSON, or file in multipart/form-data. In both cases indexing is synchronous — extraction, chunking (512 tokens with 50 overlap, adjustable) and embedding happen on the call, and the response already confirms chunks and embed_tokens. The document appears in searches immediately.

POSThttps://api.hinow.ai/v1/rag/documentsBearer

Indexes text into the base.

Parâmetros

  • rag_idstring· bodyobrigatório

    The target base.

  • textstring· bodyobrigatório

    The content.

  • filenamestring· body

    Name/origin displayed in searches. Default `document.txt`.

  • document_idstring· body

    Resending with the same id replaces the document (idempotent).

  • metadataobject· body

    Free-form pairs, returned in searches.

  • chunk_sizeinteger· body

    Tokens per chunk. Default 512.

  • chunk_overlapinteger· body

    Overlap between chunks. Default 50.

Respostas

200Document indexed
{
  "document_id": "7bfee913effd4d40bac1c80a3daff25f",
  "chunks": 1,
  "embed_tokens": 21
}
POSThttps://api.hinow.ai/v1/rag/documents/uploadBearer

Sends a file (multipart/form-data). PDF, DOCX, PPTX, XLSX, HTML, Markdown and any text — see the formats table on the RAG page.

Parâmetros

  • filefile· bodyobrigatório

    Up to 25 MB.

  • rag_idstring· bodyobrigatório
  • document_idstring· body

    Idempotent replacement, like text.

Respostas

200File extracted and indexed
{
  "document_id": "ef01480c509642298911297df854885f",
  "chunks": 1,
  "embed_tokens": 18
}
415Legacy format (.doc/.xls) — convert first
422File corrupted or unreadable

Chunk size is the decision that weighs most

Short chunks hit the paragraph but lose surrounding context; long chunks bring context and dilute similarity. The default 512 tokens works well for documentation and policies; for pure FAQ, prefer question and answer pairs.

GEThttps://api.hinow.ai/v1/rag/documentsBearer

Lists the base's documents.

Parâmetros

  • rag_idstring· queryobrigatório

Respostas

200Documents with chunk count
{
  "documents": [
    {
      "document_id": "ef01480c...",
      "source": "garantia.pdf",
      "chunk_count": 1,
      "metadata": { "filename": "garantia.pdf", ... }
    }
  ]
}
DELETEhttps://api.hinow.ai/v1/rag/documents/{document_id}Bearer

Removes a document. It goes to trash and can be restored for 15 days.

Parâmetros

  • document_idstring· pathobrigatório
  • rag_idstring· queryobrigatório

Respostas

200Removed (with copy in trash)
{
  "document_id": "56ef03f5...",
  "deleted": true,
  "trashed": true
}
404Document outside the scope/base provided
GEThttps://api.hinow.ai/v1/rag/documents/exportBearer

Exports the entire base with the full text of each document — backup and migration.

Parâmetros

  • rag_idstring· queryobrigatório

Respostas

200All documents with full text
{
  "rag_id": "1d9cf4ae...",
  "count": 7,
  "documents": [
    { "document_id": "...", "source": "trocas.docx", "text": "...", "metadata": {...} }
  ]
}

Example

# texto puro
curl -s https://api.hinow.ai/v1/rag/documents \
  -H "Authorization: Bearer hi_SUA_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "rag_id": "1d9cf4ae05f64a9faf987981b22cdeae",
    "text": "O cancelamento pode ser feito a qualquer momento no painel, sem multa.",
    "filename": "cancelamento.txt"
  }'

# arquivo
curl -s https://api.hinow.ai/v1/rag/documents/upload \
  -H "Authorization: Bearer hi_SUA_API_KEY" \
  -F "file=@precos.xlsx" \
  -F "rag_id=1d9cf4ae05f64a9faf987981b22cdeae"