Ingest URI (Basic)

Content: Ingest URI (Basic)

User Intent

"I want to ingest a document, web page, or file from a URL into Graphlit"

Operation

  • SDK Method: graphlit.ingestUri()

  • GraphQL: ingestUri mutation

  • Entity Type: Content

  • Common Use Cases: PDF ingestion, web page extraction, audio/video transcription, image processing

TypeScript (Canonical)

import { Graphlit } from 'graphlit-client';
import { ContentState, ContentTypes, FileTypes } from 'graphlit-client/dist/generated/graphql-types';

const graphlit = new Graphlit();

// Basic ingestion (asynchronous - returns immediately)
const response = await graphlit.ingestUri(
  'https://example.com/document.pdf'
);

const contentId = response.ingestUri.id;
console.log(`Content ingestion started: ${contentId}`);

// Synchronous ingestion (waits for completion)
const syncResponse = await graphlit.ingestUri(
  'https://example.com/document.pdf',
  undefined, // workflow (optional)
  undefined, // collections (optional)
  true       // isSynchronous
);

const completedContentId = syncResponse.ingestUri.id;
console.log(`Content ingested and processed: ${completedContentId}`);

// Retrieve the ingested content
const content = await graphlit.getContent(completedContentId);
console.log(`Content name: ${content.content.name}`);
console.log(`Content type: ${content.content.type}`);

Synchronous ingestion (snake_case method names)

response = await graphlit.ingestUri( uri="https://example.com/document.pdf", is_synchronous=True )

content_id = response.ingest_uri.id if response.ingest_uri else None

Parameters

Required

  • uri (string): URL of the content to ingest

    • Supports: HTTP/HTTPS URLs

    • File types: PDF, DOCX, images, audio, video, web pages, etc.

Optional

  • workflow (EntityReferenceInput): Workflow ID for custom extraction/preparation

  • collections (EntityReferenceInput[]): Collections to assign content to

  • isSynchronous (boolean): Wait for ingestion to complete (default: false)

  • correlationId (string): For tracking ingestion in production systems

Response

Variations

1. Asynchronous Ingestion with Polling (Production Pattern)

For high-volume ingestion, use asynchronous mode and poll for completion:

2. Ingestion with Collections

Organize content during ingestion:

3. Ingestion with Custom Workflow

Apply extraction or preparation during ingestion:

Common Issues

Issue: Error: Failed to download content from URI Solution: Ensure the URL is publicly accessible or provide authentication via workflow configuration.

Issue: Content state is ERROR Solution: Check content.error for details. Common causes:

  • Unsupported file format

  • File too large (check project limits)

  • Corrupt file

  • Network timeout

Issue: Synchronous ingestion timing out Solution: For large files (>100MB), use asynchronous mode and poll for completion instead.

Production Example

Server-side ingestion with all options:

Conditional workflow application:

Last updated

Was this helpful?