Files

Update file metadata or replace its file

Changed on

Update mutable fields of a file (document).

Updatable fields:

  • title: Update the document title
  • tags: Replace ALL tags for the document (both manual and auto-assigned)
  • external_metadata: Create or update external source metadata
  • file: Replace the original file and re-ingest the document

Tag replacement behavior:

  • Providing a tags array replaces ALL existing tags (manual and auto-assigned)
  • To remove all tags, send [0] (sentinel value for multipart format)
  • Omitting tags field leaves tags unchanged
  • New tags are marked as manually assigned (auto_assigned=False)

External metadata behavior:

  • When creating for the first time, external_id is required
  • When updating existing metadata, external_id is optional (existing value is preserved)
  • Fields in additional_metadata are merged (not replaced) with existing values
  • external_id cannot be changed on a document imported from a datasource: the sync matches its documents on it, so a rename would detach the document from its source. doc_type and additional_metadata stay editable

File replacement behavior:

  • The document keeps its id, title, manually assigned tags, content types, attribute values and external metadata. Only the file and everything derived from it (text, chunks, embeddings, auto-assigned tags, summaries) are rebuilt.
  • Any supported file type is accepted, including one that differs from the current file — the processing statuses are re-derived from the new file.
  • Replacing the file additionally requires an owner or editor role in the document's workspace, and is not available in workspaces configured for synced documents.
  • The storage quota is checked on the size difference, not the full new size.
  • file can be combined with title, tags and external_metadata in the same request: the metadata changes apply immediately, the file is queued.
  • The response reflects the document as it still is: filename, extension, size, total_pages, status, signature, summaries and content describe the previous file until re-ingestion begins. The document keeps serving its previous content — search, extracts and download stay consistent — and leaves the search index only once processing actually starts.
  • pending_reprocess is set to update on the response and on subsequent reads, and is the only signal that the queued file has not been processed yet: status still reports the previous run's outcome (typically Embedded) until the pipeline picks the document up. Poll until pending_reprocess is null and status is terminal — treating a terminal status alone as completion reports success against the previous file.
  • Sending a new file while one is already queued replaces the queued file, and a file replacement supersedes any other reprocessing already queued for the document: the most recent request is always the one that goes live.
  • Once re-ingestion starts, a document whose new file needs rendering has no rendered PDF until conversion completes. download?purpose=rendered_pdf serves the original during that window, as it does for any file still being converted, so a viewer can receive a non-PDF body. Gate the viewer on status rather than on the download succeeding.
  • The request is applied in full or not at all: tags are validated before the file is queued, so an invalid tag id rejects the whole request without staging anything.

Public datasets: editing a public-dataset file requires the instance-admin MANAGE_PUBLIC_DATASET permission. A workspace-scoped API key with read access (company opted in via allow_access_to_public_datasets) can see a public-dataset file but is refused permission to edit it — public datasets are read-only.

patch/api/v3/files/{id}

Request

  • Base URL
    https://api.lighton.ai
  • URL
    https://api.lighton.ai/api/v3/files/{id}
  • Auth
    HTTP bearer

Path parameters

idinteger required

A unique integer value identifying this Document.

Request body application/x-www-form-urlencoded

filestring uri

New original file. The document is re-ingested from the new content. Any supported file type is accepted, including one that differs from the current file. Until re-ingestion starts the document still serves its previous content.

titlestring

Updated title for the document.

tagsinteger[]

List of tag IDs to replace ALL existing tags (both manual and auto-assigned). To remove all tags when using multipart format, send [0] as the sentinel value.

Response

File updated successfully

idinteger required
filenamestring required

Filename of the document

titlestring nullable
extensionstring required

File extension of the document

status'pending' | 'pending_conversion' | 'converting' | 'parsing' | 'parsing_failed' | 'embedding' | 'embedding_failed' | 'embedded' | 'parsed' | 'fail' | 'updating'
  • pending - Pending
  • pending_conversion - Pending Conversion
  • converting - Converting
  • parsing - Parsing
  • parsing_failed - Parsing Failed
  • embedding - Embedding
  • embedding_failed - Embedding Failed
  • embedded - Embedded
  • parsed - Parsed
  • fail - Fail
  • updating - Updating
status_vision'pending' | 'processing' | 'embedded' | 'fail' | '-'
  • pending - Pending
  • processing - Processing
  • embedded - Embedded
  • fail - Fail
  • - - Not available
created_atstring date-time required

Creation date of the resource

updated_atstring date-time required
total_pagesinteger required

Total number of pages

sizeinteger nullable

Size of the file in bytes.

upload_session_uuidstring uuid nullable required

Upload session UUID associated with this document

signaturestring nullable required

TLSH hash for duplicate detection.

contentstring nullable

Deprecated — use pages[] instead. Full text content of the document, derived from per-page text, as a single flat string. Only included when include_content=true query parameter is provided. Will be removed in a future release.

status_detailstring nullable

Detailed error information. Only present when document processing has failed.

parserstring nullable

Parser/ingestion pipeline used for document processing (e.g., 'v2.1', 'v3.0').

Changes

    • breaking

      added subschema #2 to the response property oneOf list for the response status

    • info

      added the new optional request property (media type: multipart/form-data)

    • info

      added the new optional request property (media type: application/x-www-form-urlencoded)

    • info

      added the media type application/json for the response with the status

    • info

      added the media type application/json for the response with the status

    • info

      added the media type application/json for the response with the status

    • info

      added the non-success response with the status

    • info

      added the non-success response with the status

    • info

      added the non-success response with the status

    • info

      removed from the response property allOf list for the response status

    • info

      added the required property to the response with the status

    • info

      added the required property to the response with the status