Skip to main content
Extraction is part of the Ingest workflow. It loads source content and normalizes it into Markdown the rest of the pipeline can use. Use this page to choose the right extraction path. Use the interface-specific pages when you need every parameter, flag, request field, or response shape.

Source forms

Website scraping needs pip install "ragrails[url]" and a one-time rag.setup_url() or ragrails setup-url in the environment that runs the scraper. The browser can be chromium, firefox, or webkit.

Common shape

All extraction methods return normalized document objects. Downstream chunking only needs the text field, but the metadata keeps source context for retrieval and citations.

Scrape websites

Use scrape() for exact URLs or full-site crawls.
Always cap max_pages on a full crawl. Sites can be huge, and every page costs a fetch.
Dead-letter queue retry is SDK-first. REST returns errors and a dlq payload, but you resubmit failed URLs yourself. The CLI does not expose DLQ retry flags.

Stream website extraction

Use streaming when a crawl may take a while and the caller should see progress before the final result.
Streaming yields progress/page/error events and ends with a final event containing the same aggregate shape as scrape().

Parse documents

Use parse() for local files, folders, remote file URLs, path dictionaries with metadata, or raw bytes from uploads/object storage.
Use JSON /v1/ingest/docs for files reachable by the server process. Use multipart /v1/ingest/docs/upload when a client is uploading file bytes to the API.
File URLs must end in a supported extension such as .pdf, .md, .docx, or .xlsx; Ragrails checks the URL path before downloading.

Fetch REST APIs

Use fetch() for API responses. Each fetched page becomes a document, so paginated endpoints produce multiple documents.
Always set max_pages for paginated APIs. It stops pagination even if the upstream API keeps returning a next page.
The CLI covers common GET/header/query-param use. Use SDK or REST for JSON request bodies, cursor/offset pagination details, timeout control, or SDK batch apis=[...] ingestion.

Direct Markdown

If your content is already Markdown, skip extraction and pass it directly to the high-level ingest() workflow.

Ingest pipeline

Use ingest() when extraction should immediately continue into chunking, embedding, and vector storage. The high-level pipeline accepts the same source families: docs, urls, api, and markdown.
concurrency="parallel" runs independent extraction sources at the same time before chunking. Use serial when source order or upstream rate limits matter more than speed.
The CLI pipeline exposes common extraction flags. Use SDK or REST when you need full per-source extraction options such as URL max_pages, API pagination details, request bodies, or document metadata dictionaries.

Output shapes

Each extraction method returns a small summary plus normalized document outputs. outputs is the part you pass to chunk() or inspect before running the full pipeline.

Possible errors

Most stage-level failures are returned in the result errors list instead of raising immediately. REST validation and setup failures may return an exception envelope instead. See Errors for the shared shapes.

Next steps

  • Use Chunking to split extracted documents into searchable passages.
  • Use Ingest when you want extraction, chunking, embedding, and storage in one call.
  • Use Resilient Ingestion when large crawls or paginated APIs need retry strategy.