Skip to main content
This page documents how to ingest content into your Graphor project using the SDK. Ingestion is asynchronous: each method returns a build_id immediately; you then use get build status to poll until processing completes and get the file_id for use in other API calls. Supported sources: local file, web page URL, GitHub repository, and YouTube video.

Async flow

  1. Call one of the ingest methods (ingest_file, ingest_url, ingest_github, ingest_youtube). The method returns a build_id.
  2. Call get_build_status(build_id) to poll. When the returned status is completed, use the file_id for ask, extract, list elements, delete, etc.

Available Methods

Get build status

client.sources.get_build_status(build_id)Poll status and optional elements for an async ingestion

Ingest file

client.sources.ingest_file()Upload a local file; processing runs in the background

Ingest URL

client.sources.ingest_url()Ingest a public web page by URL (async)

Ingest GitHub

client.sources.ingest_github()Ingest a public GitHub repository (async)

Ingest YouTube

client.sources.ingest_youtube()Ingest a public YouTube video (async)

Installation

Python 3.9 or higher is required.

Authentication

All SDK methods require authentication using an API key. You can provide your API key in two ways: Set the GRAPHOR_API_KEY environment variable:
Then initialize the client without any arguments:

Direct Initialization

Never hardcode API keys in your source code. Use environment variables or a secrets manager.
Learn how to create and manage API tokens in the API Tokens guide.

Get build status

Poll the status of an async ingestion (or reprocess). Use the build_id returned by any ingest method or by reprocess.

Method Signature

Return value

When the build has been persisted, the response includes success, status, file_id, file_name, and optionally paginated elements. Possible status values:
  • Completed — Build finished successfully; use file_id for subsequent calls.
  • Processing — Build is running; keep polling.
  • Pending — Request was received but the build has not started yet; keep polling.
  • Processing failed — Build failed; check error for details.
  • not_found — No history yet (build not started or invalid build_id).
Use file_id from a response where success is true for subsequent API calls. The response also reports how the build was processed:
  • enrichment — The enrichment option the build ran with: 'full' or 'none' (see Ingestion options).
  • indexing — The indexing option the build ran with: 'full' or 'none' (see Ingestion options).
  • searchable — Boolean. true only when the build completed, its chunks are indexed, and it is still the active build for the source. When false, ask, extract, and retrieve return nothing for this source.

Poll until complete

Ingest file

Upload a local file and schedule ingestion in the background. Returns a build_id; use Get build status to poll until the source is ready.

Method Signature

Returns SourceIngestFileResponse with .build_id.

Parameters

Partition methods

When provided, method controls how the document is parsed. If omitted, the system default is used.
For more details, see Reprocess source documentation.

Ingestion options

The optional enrichment and indexing parameters control which stages of the ingestion pipeline run after parsing. Both accept 'full' (default) or 'none'.
indexing: 'none' requires deployment support. The GET sources config endpoint exposes indexing_options; sending 'none' on a deployment that does not support it returns a 400 error.
To make a parse-only source searchable later without re-parsing it, use the Index build endpoint.

File requirements

Documents: PDF, DOC, DOCX, ODT, TXT, TEXT, MD, HTML, HTM · Presentations: PPT, PPTX · Spreadsheets: CSV, TSV, XLS, XLSX · Images: PNG, JPG, JPEG, TIFF, BMP, HEIC · Audio: MP3, WAV, M4A, OGG, FLAC · Video: MP4, MOV, AVI, MKV, WEBM
Maximum file size: 100 MB per file. The request must include a Content-Length so the server can enforce the limit.

Code examples

Ingest file and poll until ready

Ingest with partition method

Ingest with ingestion options

Skip LLM enrichment and indexing for a fast, parse-only ingestion (see Ingestion options).

Ingest from bytes / buffer

Batch ingest (returns build_ids)

Error handling

Ingest methods throw on invalid file type, missing Content-Length, size over 100 MB, or server errors. Use Get build status to detect processing failures (e.g. status.error).

Ingest URL

Ingest a web page by URL (async). Returns a build_id; use Get build status to poll until ready.

Method signature

Returns SourceIngestURLResponse with .build_id.

Parameters

URL Requirements

  • Public web pages
  • Pages that render primary content server-side and are reachable without interaction
  • The URL must be publicly reachable over HTTPS
  • Authentication-protected pages are not supported

Code Examples

Basic URL ingest

Ingest with crawling

Ingest GitHub

Ingest a public GitHub repository (async). Returns a build_id; use Get build status to poll until ready.

Method signature

Returns build_id (str).

Parameters

Repository Requirements

  • Public GitHub repositories
  • HTTPS URLs (https://github.com/...)
  • Only public repositories are supported
  • Private repository ingestion is not supported

Code Examples

Basic GitHub ingest

Ingest YouTube

Ingest a public YouTube video (async). Returns a build_id; use Get build status to poll until ready.

Method signature

Returns build_id (str).

Parameters

Video Requirements

  • Public YouTube video URLs (HTTPS)
  • Standard watch URLs (https://www.youtube.com/watch?v=VIDEO_ID)
  • The video must be publicly accessible
  • Private or access-restricted videos are not supported

Code Examples

Basic YouTube ingest

Advanced Configuration

Custom timeout

For large files or slow connections, increase the ingest request timeout. Use Get build status with a suitable poll interval for long-running processing.

Retry configuration

Configure automatic retries for transient errors on ingest or get_build_status:

Accessing raw response (Python only)

Using aiohttp for concurrency (Python only)

Error Reference

Next Steps

After ingesting, use Get build status to wait until processing completes, then:

Reprocess source

Reprocess a source with a different partition method

List sources

List all sources (optionally filter by file_ids)

Get elements

Retrieve parsed elements/chunks from a source

Delete source

Remove a source by file_id