GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — sdk-js/packages/epilot-sdk-v2/docs/file.md at main · epilot-dev/sdk-js

Expand file tree

/

file.md

Copy path
More file actions
More file actions

Latest commit

 

History

History
History
2921 lines (2445 loc) · 64.1 KB
/

file.md

Copy path

File metadata and controls

2921 lines (2445 loc) · 64.1 KB
Raw
Copy raw file
Download raw file
Outline
Edit and raw actions

File API

  • Base URL: https://file.sls.epilot.io
  • Full API Docs: https://docs.epilot.io/api/file

Usage

import { epilot } from '@epilot/sdk'

epilot.authorize(() => '<token>')
const { data } = await epilot.file.uploadFileV2(...)

Tree-shakeable import

import { getClient, authorize } from '@epilot/sdk/file'

const fileClient = getClient()
authorize(fileClient, () => '<token>')
const { data } = await fileClient.uploadFileV2(...)

Operations

File

  • uploadFileV2
  • saveFileV2
  • getFile
  • deleteFile
  • downloadFile
  • downloadS3File
  • downloadFiles
  • createZipJob
  • getZipJob
  • getFileSummary
  • getFileSummaryFeedback
  • putFileSummaryFeedback
  • createFileSummaryJob
  • getCurrentFileSummaryJob
  • getFileSummaryJob
  • generateFileSummary
  • createFileAttributeSuggestionJob
  • getLatestFileAttributeSuggestions
  • getFileAttributeSuggestionJob
  • updateFileAttributeSuggestionStatus
  • getFileText
  • validateFile
  • verifyCustomDownloadUrl
  • uploadFilePublic

Meter Reading Suggestions

  • listMeterReadingSuggestions
  • createMeterReadingSuggestionJob
  • updateMeterReadingSuggestionStatus

Preview

  • previewFile
  • previewS3File
  • previewS3FileGet
  • previewPublicFile

Session

  • getSession
  • deleteSession

Public Links

  • generatePublicLink
  • listPublicLinksForFile
  • accessPublicLink
  • revokePublicLink

File Collections

  • getUserSchemaFileCollections
  • createUserSchemaFileCollection
  • updateUserSchemaFileCollection
  • deleteUserSchemaFileCollection
  • getFilesInCollection
  • getGlobalFileCollections

Schemas

  • EntityId
  • EntitySlug
  • ActivityId
  • FileEntityId
  • FileAttributes
  • FileType
  • FileSummaryJobStatus
  • FileSummaryJob
  • FileSummary
  • FileSummaryFeedback
  • FileSummaryFeedbackResponse
  • PutFileSummaryFeedbackRequest
  • FileAttributeSuggestionJobStatus
  • FileAttributeSuggestion
  • FileAttributeSuggestionsPayload
  • FileAttributeSuggestionJob
  • CreateFileAttributeSuggestionJobRequest
  • UpdateFileAttributeSuggestionStatusRequest
  • FileAttributeSuggestionError
  • MeterReadingSuggestionError
  • CreateMeterReadingSuggestionJobRequest
  • UpdateMeterReadingSuggestionStatusRequest
  • MeterReadingSuggestion
  • MeterReadingSuggestedAlternative
  • MeterReadingSuggestionJob
  • FileTextStatus
  • FileValidationRequest
  • FileValidationFileReference
  • FileValidation
  • FileValidationFile
  • FileValidationObservation
  • FileValidationJudgement
  • FileValidationFacts
  • FileValidationRuleResult
  • FileValidationConditionResult
  • FileText
  • FileTextReady
  • FileTextNotReady
  • FileTextUnsupported
  • CustomDownloadUrl
  • CustomDownloadUrlAuth
  • FileEntity
  • CommonSaveFilePayload
  • SaveS3FilePayload
  • SaveFileFromSourceURLPayload
  • SaveCustomFilePayload
  • SaveFilePayload
  • SaveFilePayloadV2
  • BatchSaveFileVersionPayload
  • UploadFilePayload
  • FileUpload
  • DownloadFilesPayload
  • CreateZipJobPayload
  • ZipJob
  • VerifyCustomDownloadUrlPayload
  • S3Reference
  • S3Ref
  • FileItem
  • FileRelationItem
  • PublicLink
  • BaseEntityOwner
  • BaseEntityAcl
  • ErrorObject
  • FileCollectionId
  • FileCollectionItem
  • FileCollectionAttributes
  • FileCollectionCreateRequest

uploadFileV2

Create pre-signed S3 URL to upload a file to keep temporarily (one week).

POST /v2/files/upload

const { data } = await client.uploadFileV2(
  {
    file_entity_id: 'example',
  },
  {
    filename: 'document.pdf',
    mime_type: 'application/pdf',
    index_tag: '2f6a377c8e78',
    metadata: {
      color: 'blue'
    }
  },
)
Response
{
  "s3ref": {
    "bucket": "epilot-prod-user-content",
    "key": "123/temp/4d689aeb-1497-4410-a9fe-b36ca9ac4389/document.pdf"
  },
  "upload_url": "https://epilot-prod-user-content.s3.eu-central-1.amazonaws.com/123/temp/4d689aeb-1497-4410-a9fe-b36ca9ac4389/document.pdf?AWSParams=123",
  "public_url": "https://epilot-prod-user-content.s3.eu-central-1.amazonaws.com/123/4d689aeb-1497-4410-a9fe-b36ca9ac4389/document.pdf"
}

saveFileV2

Saves a permanent file entity. Updates an existing file entity when _id is passed.

POST /v2/files

const { data } = await client.saveFileV2(
  {
    activity_id: 'example',
    fill_activity: true,
    strict: true,
    async: true,
    delete_temp_file: true,
    version_only: true,
  },
  {
    _id: 'ef7d985c-2385-44f4-9c71-ae06a52264f8',
    file_entity_id: 'string',
    relations: [
      {
        entity_id: 'ef7d985c-2385-44f4-9c71-ae06a52264f8',
        _schema: 'contact',
        _tags: ['string']
      }
    ],
    _tags: ['tag1', 'tag2'],
    _purpose: ['8d396871-95a0-4c9d-bb4d-9eda9c35776c', 'da7cdf9a-01be-40c9-a29c-9a8f9f0de6f8'],
    _manifest: ['123e4567-e89b-12d3-a456-426614174000'],
    filename: 'document.pdf',
    type: 'document',
    mime_type: 'application/pdf',
    size_bytes: 1234,
    readable_size: '1.2 MB',
    etag: '9bb58f26192e4ba00f01e2e7b136bbd8',
    access_control: 'private',
    public_url: 'https://epilot-prod-user-content.s3.eu-central-1.amazonaws.com/123/4d689aeb-1497-4410-a9fe-b36ca9ac4389/document.pdf',
    custom_download_url: 'https://some-api-url.com/download?file_id=123',
    custom_download_url_auth: 'token',
    preview_summary_de: 'string',
    short_summary_de: 'string',
    preview_summary_en: 'string',
    short_summary_en: 'string',
    file_summary_execution_id: '3fa85f64-5717-4562-b3fc-2c963f66afa6',
    s3ref: {}
  },
)
Response
{
  "_title": "document.pdf",
  "_schema": "file",
  "_org": "123",
  "_id": "ef7d985c-2385-44f4-9c71-ae06a52264f8",
  "_tags": ["tag1", "tag2"],
  "_purpose": ["8d396871-95a0-4c9d-bb4d-9eda9c35776c", "da7cdf9a-01be-40c9-a29c-9a8f9f0de6f8"],
  "_manifest": ["123e4567-e89b-12d3-a456-426614174000"],
  "filename": "document.pdf",
  "type": "document",
  "mime_type": "application/pdf",
  "size_bytes": 1234,
  "readable_size": "1.2 MB",
  "etag": "9bb58f26192e4ba00f01e2e7b136bbd8",
  "access_control": "private",
  "public_url": "https://epilot-prod-user-content.s3.eu-central-1.amazonaws.com/123/4d689aeb-1497-4410-a9fe-b36ca9ac4389/document.pdf",
  "custom_download_url": "https://some-api-url.com/download?file_id=123",
  "custom_download_url_auth": "token",
  "preview_summary_de": "string",
  "short_summary_de": "string",
  "preview_summary_en": "string",
  "short_summary_en": "string",
  "file_summary_execution_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
  "source_url": "https://productengineer-content.s3.eu-west-1.amazonaws.com/product-engineer-checklist.pdf",
  "s3ref": {},
  "versions": [
    {
      "s3ref": {},
      "filename": "document.pdf",
      "size_bytes": 1234,
      "readable_size": "1.2 MB",
      "mime_type": "image/jpeg",
      "etag": "9bb58f26192e4ba00f01e2e7b136bbd8"
    }
  ],
  "_updated_at": "1970-01-01T00:00:00.000Z",
  "_created_at": "1970-01-01T00:00:00.000Z",
  "_acl": {
    "view": ["org:456"],
    "edit": ["org:456"],
    "delete": ["org:456"]
  },
  "_owners": [
    {
      "org_id": "123",
      "user_id": "123"
    }
  ],
  "__additional": {}
}

getFile

Get a file entity by id

GET /v2/files/{id}

const { data } = await client.getFile({
  id: '123e4567-e89b-12d3-a456-426614174000',
  source_url: true,
  strict: true,
  async: true,
})
Response
{
  "_title": "document.pdf",
  "_schema": "file",
  "_org": "123",
  "_id": "ef7d985c-2385-44f4-9c71-ae06a52264f8",
  "_tags": ["tag1", "tag2"],
  "_purpose": ["8d396871-95a0-4c9d-bb4d-9eda9c35776c", "da7cdf9a-01be-40c9-a29c-9a8f9f0de6f8"],
  "_manifest": ["123e4567-e89b-12d3-a456-426614174000"],
  "filename": "document.pdf",
  "type": "document",
  "mime_type": "application/pdf",
  "size_bytes": 1234,
  "readable_size": "1.2 MB",
  "etag": "9bb58f26192e4ba00f01e2e7b136bbd8",
  "access_control": "private",
  "public_url": "https://epilot-prod-user-content.s3.eu-central-1.amazonaws.com/123/4d689aeb-1497-4410-a9fe-b36ca9ac4389/document.pdf",
  "custom_download_url": "https://some-api-url.com/download?file_id=123",
  "custom_download_url_auth": "token",
  "preview_summary_de": "string",
  "short_summary_de": "string",
  "preview_summary_en": "string",
  "short_summary_en": "string",
  "file_summary_execution_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
  "source_url": "https://productengineer-content.s3.eu-west-1.amazonaws.com/product-engineer-checklist.pdf",
  "s3ref": {},
  "versions": [
    {
      "s3ref": {},
      "filename": "document.pdf",
      "size_bytes": 1234,
      "readable_size": "1.2 MB",
      "mime_type": "image/jpeg",
      "etag": "9bb58f26192e4ba00f01e2e7b136bbd8"
    }
  ],
  "_updated_at": "1970-01-01T00:00:00.000Z",
  "_created_at": "1970-01-01T00:00:00.000Z",
  "_acl": {
    "view": ["org:456"],
    "edit": ["org:456"],
    "delete": ["org:456"]
  },
  "_owners": [
    {
      "org_id": "123",
      "user_id": "123"
    }
  ],
  "__additional": {}
}

deleteFile

Delete a file entity by id

DELETE /v2/files/{id}

const { data } = await client.deleteFile({
  id: '123e4567-e89b-12d3-a456-426614174000',
  purge: true,
  activity_id: 'example',
  strict: true,
})
Response
{
  "_title": "document.pdf",
  "_schema": "file",
  "_org": "123",
  "_id": "ef7d985c-2385-44f4-9c71-ae06a52264f8",
  "_tags": ["tag1", "tag2"],
  "_purpose": ["8d396871-95a0-4c9d-bb4d-9eda9c35776c", "da7cdf9a-01be-40c9-a29c-9a8f9f0de6f8"],
  "_manifest": ["123e4567-e89b-12d3-a456-426614174000"],
  "filename": "document.pdf",
  "type": "document",
  "mime_type": "application/pdf",
  "size_bytes": 1234,
  "readable_size": "1.2 MB",
  "etag": "9bb58f26192e4ba00f01e2e7b136bbd8",
  "access_control": "private",
  "public_url": "https://epilot-prod-user-content.s3.eu-central-1.amazonaws.com/123/4d689aeb-1497-4410-a9fe-b36ca9ac4389/document.pdf",
  "custom_download_url": "https://some-api-url.com/download?file_id=123",
  "custom_download_url_auth": "token",
  "preview_summary_de": "string",
  "short_summary_de": "string",
  "preview_summary_en": "string",
  "short_summary_en": "string",
  "file_summary_execution_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
  "source_url": "https://productengineer-content.s3.eu-west-1.amazonaws.com/product-engineer-checklist.pdf",
  "s3ref": {},
  "versions": [
    {
      "s3ref": {},
      "filename": "document.pdf",
      "size_bytes": 1234,
      "readable_size": "1.2 MB",
      "mime_type": "image/jpeg",
      "etag": "9bb58f26192e4ba00f01e2e7b136bbd8"
    }
  ],
  "_updated_at": "1970-01-01T00:00:00.000Z",
  "_created_at": "1970-01-01T00:00:00.000Z",
  "_acl": {
    "view": ["org:456"],
    "edit": ["org:456"],
    "delete": ["org:456"]
  },
  "_owners": [
    {
      "org_id": "123",
      "user_id": "123"
    }
  ],
  "__additional": {}
}

downloadFile

Generate a pre-signed download URL for a file.

GET /v1/files/{id}/download

const { data } = await client.downloadFile({
  id: '123e4567-e89b-12d3-a456-426614174000',
  version: 1,
  attachment: true,
  x-track: 'example',
})
Response
{
  "download_url": "https://epilot-prod-user-content.s3.eu-central-1.amazonaws.com/123/temp/4d689aeb-1497-4410-a9fe-b36ca9ac4389/document.pdf?AWSParams=123"
}

downloadS3File

Generate a pre-signed download URL for a file using its S3 reference.

POST /v1/files:downloadS3

const { data } = await client.downloadS3File({
  s3_key: 'example',
  s3_bucket: 'example',
  attachment: true,
})
Response
{
  "download_url": "https://epilot-prod-user-content.s3.eu-central-1.amazonaws.com/123/temp/4d689aeb-1497-4410-a9fe-b36ca9ac4389/document.pdf?AWSParams=123"
}

downloadFiles

Bulk generate pre-signed download URLs for multiple files in a single request.

POST /v1/files:downloadFiles

const { data } = await client.downloadFiles(
  null,
  [
    {
      id: 'ef7d985c-2385-44f4-9c71-ae06a52264f8',
      version: 0
    }
  ],
)
Response
[
  {
    "download_url": "https://epilot-prod-user-content.s3.eu-central-1.amazonaws.com/123/temp/4d689aeb-1497-4410-a9fe-b36ca9ac4389/document.pdf?AWSParams=123",
    "file_entity_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6"
  }
]

createZipJob

Create a background job to ZIP multiple files and send a download link via email.

POST /v1/files:zipJob

const { data } = await client.createZipJob(
  null,
  {},
)

getZipJob

Get the status of a ZIP job

GET /v1/files:zipJob/{job_id}

const { data } = await client.getZipJob({
  job_id: 'example',
})
Response
{
  "job_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
  "status": "completed",
  "progress": {
    "total_files": 100,
    "downloaded_files": 75,
    "failed_files": 2
  },
  "result": {
    "file_entity_id": "ef7d985c-2385-44f4-9c71-ae06a52264f8",
    "download_url": "https://epilot-prod-user-content.s3.eu-central-1.amazonaws.com/123/files.zip?X-Amz-...",
    "expires_at": "2024-01-02T12:00:00Z",
    "zip_size_bytes": 104857600
  },
  "error": "Failed to download file: access denied",
  "created_at": "2024-01-01T12:00:00Z",
  "created_by": "10234",
  "org_id": "123",
  "updated_at": "2024-01-01T12:05:00Z"
}

getFileSummary

Get summary text for a file entity together with the current summary job status when available.

GET /v1/files/{id}/summary

const { data } = await client.getFileSummary({
  id: '123e4567-e89b-12d3-a456-426614174000',
})
Response
{
  "status": "queued",
  "job_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
  "feedback_available": true,
  "preview_summary_de": "string",
  "short_summary_de": "string",
  "preview_summary_en": "string",
  "short_summary_en": "string"
}

getFileSummaryFeedback

Get file summary feedback

GET /v1/files/{id}/summary/feedback

const { data } = await client.getFileSummaryFeedback({
  id: '123e4567-e89b-12d3-a456-426614174000',
})
Response
{
  "feedback": {
    "rating": "up",
    "comment": "string",
    "user_id": "string",
    "submitted_at": "1970-01-01T00:00:00.000Z"
  }
}

putFileSummaryFeedback

Submit file summary feedback

PUT /v1/files/{id}/summary/feedback

const { data } = await client.putFileSummaryFeedback(
  {
    id: '123e4567-e89b-12d3-a456-426614174000',
  },
  {
    rating: 'up',
    comment: 'string'
  },
)
Response
{
  "feedback": {
    "rating": "up",
    "comment": "string",
    "user_id": "string",
    "submitted_at": "1970-01-01T00:00:00.000Z"
  }
}

createFileSummaryJob

Create or return the current AI summary job for a file entity.

POST /v1/files/{id}/summary-jobs

const { data } = await client.createFileSummaryJob({
  id: '123e4567-e89b-12d3-a456-426614174000',
})

getCurrentFileSummaryJob

Get the latest AI summary job for the file entity's current source.

GET /v1/files/{id}/summary-jobs/current

const { data } = await client.getCurrentFileSummaryJob({
  id: '123e4567-e89b-12d3-a456-426614174000',
})
Response
{
  "job_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
  "file_id": "ef7d985c-2385-44f4-9c71-ae06a52264f8",
  "status": "queued",
  "error": "string",
  "created_at": "1970-01-01T00:00:00.000Z",
  "updated_at": "1970-01-01T00:00:00.000Z",
  "completed_at": "1970-01-01T00:00:00.000Z"
}

getFileSummaryJob

Get an AI summary job by id.

GET /v1/files/{id}/summary-jobs/{job_id}

const { data } = await client.getFileSummaryJob({
  id: '123e4567-e89b-12d3-a456-426614174000',
  job_id: 'example',
})
Response
{
  "job_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
  "file_id": "ef7d985c-2385-44f4-9c71-ae06a52264f8",
  "status": "queued",
  "error": "string",
  "created_at": "1970-01-01T00:00:00.000Z",
  "updated_at": "1970-01-01T00:00:00.000Z",
  "completed_at": "1970-01-01T00:00:00.000Z"
}

generateFileSummary

Compatibility alias for creating or returning the current AI summary job for a file entity.

POST /v1/files/{id}/summary:generate

const { data } = await client.generateFileSummary({
  id: '123e4567-e89b-12d3-a456-426614174000',
})

createFileAttributeSuggestionJob

Start an auto-fill job that reads the file's extracted text and suggests values for the related entity's attributes. Requires entity:view on the file and on the related entity. Returns 404 with `err

POST /v1/files/{id}/attribute-suggestion-jobs

const { data } = await client.createFileAttributeSuggestionJob(
  {
    id: '123e4567-e89b-12d3-a456-426614174000',
  },
  {
    entity_slug: 'opportunity',
    entity_id: '3fa85f64-5717-4562-b3fc-2c963f66afa6'
  },
)

getLatestFileAttributeSuggestions

Get the most recent attribute suggestion job of any status for the file and the given entity. Returns 404 with error_code: no_file_attribute_suggestions_job when auto-fill has not run yet.

GET /v1/files/{id}/attribute-suggestion-jobs/latest

const { data } = await client.getLatestFileAttributeSuggestions({
  id: '123e4567-e89b-12d3-a456-426614174000',
  entity_id: 'example',
})
Response
{
  "jobId": "string",
  "jobStatus": {
    "status": "INITIATED",
    "progress": 0,
    "error": "string"
  },
  "payload": {
    "file_id": "string",
    "entity_id": "string",
    "entity_slug": "string",
    "generated_by": "string",
    "generated_at": 0,
    "suggestions": [
      {
        "attribute_name": "string",
        "attribute_label": "string",
        "attribute_type": "date",
        "suggested_value": "string",
        "confidence": "high",
        "source_page": 0,
        "evidence": "string",
        "status": "suggested",
        "status_updated_by": "string",
        "status_updated_at": 0,
        "discard_reason": "string",
        "is_copied": true,
        "copied_by": "string",
        "copied_at": 0,
        "suggestion_type": "new_value"
      }
    ]
  },
  "createdAt": 0,
  "updatedAt": 0
}

getFileAttributeSuggestionJob

Get an attribute suggestion job of the file. Poll until jobStatus.status is COMPLETED or FAILED.

GET /v1/files/{id}/attribute-suggestion-jobs/{job_id}

const { data } = await client.getFileAttributeSuggestionJob({
  id: '123e4567-e89b-12d3-a456-426614174000',
  job_id: 'example',
})
Response
{
  "jobId": "string",
  "jobStatus": {
    "status": "INITIATED",
    "progress": 0,
    "error": "string"
  },
  "payload": {
    "file_id": "string",
    "entity_id": "string",
    "entity_slug": "string",
    "generated_by": "string",
    "generated_at": 0,
    "suggestions": [
      {
        "attribute_name": "string",
        "attribute_label": "string",
        "attribute_type": "date",
        "suggested_value": "string",
        "confidence": "high",
        "source_page": 0,
        "evidence": "string",
        "status": "suggested",
        "status_updated_by": "string",
        "status_updated_at": 0,
        "discard_reason": "string",
        "is_copied": true,
        "copied_by": "string",
        "copied_at": 0,
        "suggestion_type": "new_value"
      }
    ]
  },
  "createdAt": 0,
  "updatedAt": 0
}

updateFileAttributeSuggestionStatus

Record that suggestions were accepted, discarded or copied. Only the suggestion entries named in the request change; unknown attribute names are ignored. Applying a value to the entity stays with the

PATCH /v1/files/{id}/attribute-suggestion-jobs/{job_id}

const { data } = await client.updateFileAttributeSuggestionStatus(
  {
    id: '123e4567-e89b-12d3-a456-426614174000',
    job_id: 'example',
  },
  {
    suggestionStatusUpdates: [
      {},
      {}
    ]
  },
)
Response
{
  "jobId": "string",
  "jobStatus": {
    "status": "INITIATED",
    "progress": 0,
    "error": "string"
  },
  "payload": {
    "file_id": "string",
    "entity_id": "string",
    "entity_slug": "string",
    "generated_by": "string",
    "generated_at": 0,
    "suggestions": [
      {
        "attribute_name": "string",
        "attribute_label": "string",
        "attribute_type": "date",
        "suggested_value": "string",
        "confidence": "high",
        "source_page": 0,
        "evidence": "string",
        "status": "suggested",
        "status_updated_by": "string",
        "status_updated_at": 0,
        "discard_reason": "string",
        "is_copied": true,
        "copied_by": "string",
        "copied_at": 0,
        "suggestion_type": "new_value"
      }
    ]
  },
  "createdAt": 0,
  "updatedAt": 0
}

listMeterReadingSuggestions

List the meter reading suggestion jobs of a meter, newest first: one job per photo attached to the meter. Requires entity:view on the meter.

GET /v1/files:meterReadingSuggestions

const { data } = await client.listMeterReadingSuggestions({
  meter_id: 'example',
  schema: 'example',
})
Response
{
  "results": [
    {
      "meter_id": "string",
      "file_id": "string",
      "schema": "string",
      "file_name": "string",
      "status": "PENDING",
      "error": "string",
      "read_at": "1970-01-01T00:00:00.000Z",
      "read_at_source": "exif",
      "is_meter_photo": true,
      "meter_number_on_image": "string",
      "meter_number_mismatch": true,
      "suggestions": [
        {
          "suggestion_id": "string",
          "counter_id": "string",
          "value": 0,
          "value_raw": "string",
          "confidence": "high",
          "verbatim_span": "string",
          "evidence": "string",
          "warnings": ["below_last_reading"],
          "status": "pending",
          "decided_at": "1970-01-01T00:00:00.000Z",
          "decided_by": "string",
          "last_value": 0,
          "last_read_at": "1970-01-01T00:00:00.000Z",
          "suggested_alternative": {
            "value": 0,
            "value_raw": "string",
            "reason": "decimal_shift"
          },
          "photo_attached": true
        }
      ],
      "created_at": "1970-01-01T00:00:00.000Z",
      "updated_at": "1970-01-01T00:00:00.000Z"
    }
  ]
}

createMeterReadingSuggestionJob

Start (or re-run) reading suggestions for one photo of a meter. Resets any previous job of the same meter and file. Requires entity:edit on the meter and entity:view on the file. The file must be

POST /v1/files:meterReadingSuggestions

const { data } = await client.createMeterReadingSuggestionJob(
  null,
  {
    meter_id: 'string',
    file_id: 'string',
    schema: 'meter'
  },
)

updateMeterReadingSuggestionStatus

Record that a suggestion was accepted or dismissed. Saving the reading itself stays with the caller. Requires entity:edit on the meter.

PATCH /v1/files:meterReadingSuggestions/{meter_id}/{file_id}/{suggestion_id}

const { data } = await client.updateMeterReadingSuggestionStatus(
  {
    meter_id: 'example',
    file_id: 'example',
    suggestion_id: 'example',
  },
  {
    status: 'accepted'
  },
)
Response
{
  "meter_id": "string",
  "file_id": "string",
  "schema": "string",
  "file_name": "string",
  "status": "PENDING",
  "error": "string",
  "read_at": "1970-01-01T00:00:00.000Z",
  "read_at_source": "exif",
  "is_meter_photo": true,
  "meter_number_on_image": "string",
  "meter_number_mismatch": true,
  "suggestions": [
    {
      "suggestion_id": "string",
      "counter_id": "string",
      "value": 0,
      "value_raw": "string",
      "confidence": "high",
      "verbatim_span": "string",
      "evidence": "string",
      "warnings": ["below_last_reading"],
      "status": "pending",
      "decided_at": "1970-01-01T00:00:00.000Z",
      "decided_by": "string",
      "last_value": 0,
      "last_read_at": "1970-01-01T00:00:00.000Z",
      "suggested_alternative": {
        "value": 0,
        "value_raw": "string",
        "reason": "decimal_shift"
      },
      "photo_attached": true
    }
  ],
  "created_at": "1970-01-01T00:00:00.000Z",
  "updated_at": "1970-01-01T00:00:00.000Z"
}

getFileText

Get the plain-text representation of a file entity. Returns status not_ready while text is being prepared and unsupported when text is unavailable for the file or organization.

GET /v1/files/{id}/text

const { data } = await client.getFileText({
  id: '123e4567-e89b-12d3-a456-426614174000',
})
Response
{
  "status": "ready",
  "text": "string",
  "truncated": true,
  "total_chars": 0
}

validateFile

Validate an uploaded file against one or more document validation rules (validation-rules-api rules with input_type: document).

POST /v1/files/validations

const { data } = await client.validateFile(
  null,
  {
    file: {
      entity_id: 'ef7d985c-2385-44f4-9c71-ae06a52264f8'
    },
    rule_ids: ['string']
  },
)
Response
{
  "id": "string",
  "status": "completed",
  "file": {
    "entity_id": "ef7d985c-2385-44f4-9c71-ae06a52264f8",
    "s3ref": {},
    "filename": "string",
    "mime_type": "string",
    "size_bytes": 0
  },
  "observation": {
    "facts": {
      "mime_type": "string",
      "size_bytes": 0,
      "page_count": 0,
      "longer_edge_px": 0,
      "is_blank": true,
      "is_password_protected": true
    },
    "judgements": {},
    "document_type": {
      "slug": "string",
      "confidence": 0
    }
  },
  "results": [
    {
      "rule_id": "string",
      "rule_title": "string",
      "level": "basic",
      "is_valid": true,
      "failed_parts": ["string"],
      "warnings": ["string"],
      "conditions": [
        {
          "id": "string",
          "operator": "string",
          "outcome": "pass",
          "blocking": true,
          "message": "string",
          "evidence": "string",
          "explanation": "string"
        }
      ]
    }
  ],
  "created_at": "1970-01-01T00:00:00.000Z"
}

previewFile

Generate a thumbnail preview for a file entity.

GET /v1/files/{id}/preview

const { data } = await client.previewFile({
  id: '123e4567-e89b-12d3-a456-426614174000',
  version: 1,
  w: 1,
  h: 1,
})

previewS3File

Generate a thumbnail preview from an S3 reference.

POST /v1/files:previewS3

const { data } = await client.previewS3File(
  {
    w: 1,
    h: 1,
  },
  {},
)

previewS3FileGet

Get a thumbnail preview from an S3 reference using query parameters.

GET /v1/files:previewS3

const { data } = await client.previewS3FileGet({
  key: 'example',
  bucket: 'example',
  w: 1,
  h: 1,
})

previewPublicFile

Generate a thumbnail preview for a public file entity.

GET /v1/files/public/{id}/preview

const { data } = await client.previewPublicFile({
  id: '123e4567-e89b-12d3-a456-426614174000',
  version: 1,
  w: 1,
  h: 1,
  keep_original: true,
  org_id: 'example',
})

getSession

Start a browser session by converting a Bearer token into a server-side cookie.

GET /v1/files/session

const { data } = await client.getSession()

deleteSession

End a browser session by deleting the token cookie.

DELETE /v1/files/session

const { data } = await client.deleteSession()

generatePublicLink

Generate a public link to share a private file externally.

POST /v1/files/{id}/public/links

const { data } = await client.generatePublicLink({
  id: '123e4567-e89b-12d3-a456-426614174000',
})
Response
"string"

listPublicLinksForFile

Fetches all public links previously generated for a file

GET /v1/files/{id}/public/links

const { data } = await client.listPublicLinksForFile({
  id: '123e4567-e89b-12d3-a456-426614174000',
})
Response
{
  "results": [
    {
      "id": "3ef5c6d9-818d-45e6-8efb-b1de59079a1c",
      "link": "https://file.sls.epilot.io/v1/files/public/links/3ef5c6d9-818d-45e6-8efb-b1de59079a1c",
      "last_accessed_at": "string"
    }
  ]
}

accessPublicLink

Access a file via its public link.

GET /v1/files/public/links/{id}/{filename}

const { data } = await client.accessPublicLink({
  id: '123e4567-e89b-12d3-a456-426614174000',
  filename: 'example',
  hash: 'example',
})

revokePublicLink

Revokes a given public link by ID

DELETE /v1/files/public/links/{id}

const { data } = await client.revokePublicLink({
  id: '123e4567-e89b-12d3-a456-426614174000',
})

verifyCustomDownloadUrl

Verify that a custom download URL is valid and has not expired.

POST /v1/files/download:verify

const { data } = await client.verifyCustomDownloadUrl(
  null,
  {
    custom_download_url: 'https://some-api-url.com?file_id=123&expires_at=1699273500029&signature=abcdefg'
  },
)
Response
{
  "valid": true
}

uploadFilePublic

Create a pre-signed S3 URL for uploading a file without authentication.

POST /v1/files/public/upload

const { data } = await client.uploadFilePublic(
  null,
  {
    filename: 'document.pdf',
    mime_type: 'application/pdf',
    index_tag: '2f6a377c8e78',
    metadata: {
      color: 'blue'
    }
  },
)
Response
{
  "s3ref": {
    "bucket": "epilot-prod-user-content",
    "key": "123/temp/4d689aeb-1497-4410-a9fe-b36ca9ac4389/document.pdf"
  },
  "upload_url": "https://epilot-prod-user-content.s3.eu-central-1.amazonaws.com/123/temp/4d689aeb-1497-4410-a9fe-b36ca9ac4389/document.pdf?AWSParams=123",
  "error": "File entity not found"
}

getUserSchemaFileCollections

Get all file collections for the current user within a specific schema.

GET /v1/{slug}/collections

const { data } = await client.getUserSchemaFileCollections({
  slug: 'example',
})
Response
[
  {
    "slug": "_system_files_collection_3fa85f64-5717-4562-b3fc-2c963f66afa6_10234:documents",
    "name": "Documents",
    "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
    "parents": ["_system_files_collection_3fa85f64-5717-4562-b3fc-2c963f66afa6_10234"],
    "starred": false,
    "order": 0,
    "enabled_locations": ["string"],
    "enabled_purposes": ["9eefcb98-93cf-4c5b-a040-f1d26d57c177", "5c544c09-a691-43ed-a7fa-0a8b44b5b161"],
    "created_at": "2024-01-01T12:00:00Z",
    "updated_at": "2024-01-02T12:00:00Z"
  }
]

createUserSchemaFileCollection

Create a new file collection for the current user within a specific schema.

POST /v1/{slug}/collections

const { data } = await client.createUserSchemaFileCollection(
  {
    slug: 'example',
  },
  {
    name: 'string',
    parents: ['string'],
    starred: false,
    enabled_locations: ['string'],
    enabled_purposes: ['string']
  },
)
Response
{
  "slug": "_system_files_collection_3fa85f64-5717-4562-b3fc-2c963f66afa6_10234:documents",
  "name": "Documents",
  "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
  "parents": ["_system_files_collection_3fa85f64-5717-4562-b3fc-2c963f66afa6_10234"],
  "starred": false,
  "order": 0,
  "enabled_locations": ["string"],
  "enabled_purposes": ["9eefcb98-93cf-4c5b-a040-f1d26d57c177", "5c544c09-a691-43ed-a7fa-0a8b44b5b161"],
  "created_at": "2024-01-01T12:00:00Z",
  "updated_at": "2024-01-02T12:00:00Z"
}

updateUserSchemaFileCollection

Update an existing file collection.

PUT /v1/{slug}/collections/{collectionSlug}

const { data } = await client.updateUserSchemaFileCollection(
  {
    slug: 'example',
    collectionSlug: 'example',
  },
  {
    name: 'string',
    parents: ['string'],
    starred: false,
    enabled_locations: ['string'],
    enabled_purposes: ['string']
  },
)
Response
{
  "slug": "_system_files_collection_3fa85f64-5717-4562-b3fc-2c963f66afa6_10234:documents",
  "name": "Documents",
  "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
  "parents": ["_system_files_collection_3fa85f64-5717-4562-b3fc-2c963f66afa6_10234"],
  "starred": false,
  "order": 0,
  "enabled_locations": ["string"],
  "enabled_purposes": ["9eefcb98-93cf-4c5b-a040-f1d26d57c177", "5c544c09-a691-43ed-a7fa-0a8b44b5b161"],
  "created_at": "2024-01-01T12:00:00Z",
  "updated_at": "2024-01-02T12:00:00Z"
}

deleteUserSchemaFileCollection

Delete a file collection.

DELETE /v1/{slug}/collections/{collectionSlug}

const { data } = await client.deleteUserSchemaFileCollection({
  slug: 'example',
  collectionSlug: 'example',
})

getFilesInCollection

Get all files within a specific collection for an entity.

GET /v1/entity/{id}/collections/{collectionSlug}/files

const { data } = await client.getFilesInCollection({
  id: '123e4567-e89b-12d3-a456-426614174000',
  collectionSlug: 'example',
})
Response
[
  {
    "_title": "document.pdf",
    "_schema": "file",
    "_org": "123",
    "_id": "ef7d985c-2385-44f4-9c71-ae06a52264f8",
    "_tags": ["tag1", "tag2"],
    "_purpose": ["8d396871-95a0-4c9d-bb4d-9eda9c35776c", "da7cdf9a-01be-40c9-a29c-9a8f9f0de6f8"],
    "_manifest": ["123e4567-e89b-12d3-a456-426614174000"],
    "filename": "document.pdf",
    "type": "document",
    "mime_type": "application/pdf",
    "size_bytes": 1234,
    "readable_size": "1.2 MB",
    "etag": "9bb58f26192e4ba00f01e2e7b136bbd8",
    "access_control": "private",
    "public_url": "https://epilot-prod-user-content.s3.eu-central-1.amazonaws.com/123/4d689aeb-1497-4410-a9fe-b36ca9ac4389/document.pdf",
    "custom_download_url": "https://some-api-url.com/download?file_id=123",
    "custom_download_url_auth": "token",
    "preview_summary_de": "string",
    "short_summary_de": "string",
    "preview_summary_en": "string",
    "short_summary_en": "string",
    "file_summary_execution_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
    "source_url": "https://productengineer-content.s3.eu-west-1.amazonaws.com/product-engineer-checklist.pdf",
    "s3ref": {},
    "versions": [
      {
        "s3ref": {},
        "filename": "document.pdf",
        "size_bytes": 1234,
        "readable_size": "1.2 MB",
        "mime_type": "image/jpeg",
        "etag": "9bb58f26192e4ba00f01e2e7b136bbd8"
      }
    ],
    "_updated_at": "1970-01-01T00:00:00.000Z",
    "_created_at": "1970-01-01T00:00:00.000Z",
    "_acl": {
      "view": ["org:456"],
      "edit": ["org:456"],
      "delete": ["org:456"]
    },
    "_owners": [
      {
        "org_id": "123",
        "user_id": "123"
      }
    ],
    "__additional": {}
  }
]

getGlobalFileCollections

Get all global file collections for a specific schema.

GET /v1/collections/{schemaSlug}

const { data } = await client.getGlobalFileCollections({
  schemaSlug: 'example',
})
Response
[
  {
    "slug": "_system_files_collection_3fa85f64-5717-4562-b3fc-2c963f66afa6_10234:documents",
    "name": "Documents",
    "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
    "parents": ["_system_files_collection_3fa85f64-5717-4562-b3fc-2c963f66afa6_10234"],
    "starred": false,
    "order": 0,
    "enabled_locations": ["string"],
    "enabled_purposes": ["9eefcb98-93cf-4c5b-a040-f1d26d57c177", "5c544c09-a691-43ed-a7fa-0a8b44b5b161"],
    "created_at": "2024-01-01T12:00:00Z",
    "updated_at": "2024-01-02T12:00:00Z"
  }
]

Schemas

EntityId

type EntityId = string

EntitySlug

URL-friendly identifier for the entity schema

type EntitySlug = string

ActivityId

See https://github.com/ulid/spec

type ActivityId = string // ulid

FileEntityId

type FileEntityId = string | string // uuid

FileAttributes

type FileAttributes = {
  _tags?: string[]
  _purpose?: string[]
  _manifest?: string // uuid[]
  filename?: string
  type?: "document" | "document_template" | "text" | "image" | "video" | "audio" | "spreadsheet" | "presentation" | "font" | "archive" | "application" | "unknown"
  mime_type?: string
  size_bytes?: number
  readable_size?: string
  etag?: string
  access_control?: "private" | "public-read"
  public_url?: string // url
  custom_download_url?: string // uri
  custom_download_url_auth?: "presigned" | "token"
  preview_summary_de?: string
  short_summary_de?: string
  preview_summary_en?: string
  short_summary_en?: string
  file_summary_execution_id?: string // uuid
}

FileType

type FileType = "document" | "document_template" | "text" | "image" | "video" | "audio" | "spreadsheet" | "presentation" | "font" | "archive" | "application" | "unknown"

FileSummaryJobStatus

Current state of a file summary job.

type FileSummaryJobStatus = "queued" | "waiting_for_extraction" | "processing" | "completed" | "failed" | "unsupported" | "stale"

FileSummaryJob

type FileSummaryJob = {
  job_id: string // uuid
  file_id: string | string // uuid
  status: "queued" | "waiting_for_extraction" | "processing" | "completed" | "failed" | "unsupported" | "stale"
  error?: string
  created_at: string // date-time
  updated_at: string // date-time
  completed_at?: string // date-time
}

FileSummary

type FileSummary = {
  status?: "queued" | "waiting_for_extraction" | "processing" | "completed" | "failed" | "unsupported" | "stale"
  job_id?: string // uuid
  feedback_available?: boolean
  preview_summary_de?: string
  short_summary_de?: string
  preview_summary_en?: string
  short_summary_en?: string
}

FileSummaryFeedback

type FileSummaryFeedback = {
  rating: "up" | "down"
  comment?: string
  user_id: string
  submitted_at: string // date-time
}

FileSummaryFeedbackResponse

type FileSummaryFeedbackResponse = {
  feedback: {
    rating: "up" | "down"
    comment?: string
    user_id: string
    submitted_at: string // date-time
  }
}

PutFileSummaryFeedbackRequest

type PutFileSummaryFeedbackRequest = {
  rating: "up" | "down"
  comment?: string
}

FileAttributeSuggestionJobStatus

type FileAttributeSuggestionJobStatus = {
  status: "INITIATED" | "IN_PROGRESS" | "COMPLETED" | "FAILED"
  progress: number
  error?: string
}

FileAttributeSuggestion

type FileAttributeSuggestion = {
  attribute_name?: string
  attribute_label?: string
  attribute_type?: "date" | "number" | "boolean" | "select" | "string"
  suggested_value?: string | number | boolean
  confidence?: "high" | "medium" | "low"
  source_page?: number
  evidence?: string
  status?: "suggested" | "accepted" | "discarded"
  status_updated_by?: string
  status_updated_at?: number
  discard_reason?: string
  is_copied?: boolean
  copied_by?: string
  copied_at?: number
  suggestion_type?: "new_value" | "update"
}

FileAttributeSuggestionsPayload

type FileAttributeSuggestionsPayload = {
  file_id: string
  entity_id: string
  entity_slug: string
  generated_by?: string
  generated_at?: number
  suggestions: Array<{
    attribute_name?: string
    attribute_label?: string
    attribute_type?: "date" | "number" | "boolean" | "select" | "string"
    suggested_value?: string | number | boolean
    confidence?: "high" | "medium" | "low"
    source_page?: number
    evidence?: string
    status?: "suggested" | "accepted" | "discarded"
    status_updated_by?: string
    status_updated_at?: number
    discard_reason?: string
    is_copied?: boolean
    copied_by?: string
    copied_at?: number
    suggestion_type?: "new_value" | "update"
  }>
}

FileAttributeSuggestionJob

type FileAttributeSuggestionJob = {
  jobId: string
  jobStatus: {
    status: "INITIATED" | "IN_PROGRESS" | "COMPLETED" | "FAILED"
    progress: number
    error?: string
  }
  payload: {
    file_id: string
    entity_id: string
    entity_slug: string
    generated_by?: string
    generated_at?: number
    suggestions: Array<{
      attribute_name?: { ... }
      attribute_label?: { ... }
      attribute_type?: { ... }
      suggested_value?: { ... }
      confidence?: { ... }
      source_page?: { ... }
      evidence?: { ... }
      status?: { ... }
      status_updated_by?: { ... }
      status_updated_at?: { ... }
      discard_reason?: { ... }
      is_copied?: { ... }
      copied_by?: { ... }
      copied_at?: { ... }
      suggestion_type?: { ... }
    }>
  }
  createdAt: number
  updatedAt: number
}

CreateFileAttributeSuggestionJobRequest

type CreateFileAttributeSuggestionJobRequest = {
  entity_slug: string
  entity_id: string // uuid
}

UpdateFileAttributeSuggestionStatusRequest

type UpdateFileAttributeSuggestionStatusRequest = {
  suggestionStatusUpdates: unknown | unknown[]
}

FileAttributeSuggestionError

type FileAttributeSuggestionError = {
  status?: number
  error?: string
  error_code?: "entity_or_schema_unavailable" | "file_not_extracted" | "extraction_unsupported" | "extraction_failed" | "extraction_status_unavailable" | "processing_enqueue_failed" | "no_file_attribute_suggestions_job" | "job_not_found"
}

MeterReadingSuggestionError

type MeterReadingSuggestionError = {
  status?: number
  error?: string
  error_code?: "feature_disabled" | "file_not_found" | "not_an_image" | "schema_not_supported" | "file_not_attached" | "job_not_found" | "job_not_completed" | "suggestion_not_found" | "processing_enqueue_failed"
}

CreateMeterReadingSuggestionJobRequest

type CreateMeterReadingSuggestionJobRequest = {
  meter_id: string
  file_id: string
  schema?: string
}

UpdateMeterReadingSuggestionStatusRequest

type UpdateMeterReadingSuggestionStatusRequest = {
  status: "accepted" | "dismissed"
}

MeterReadingSuggestion

type MeterReadingSuggestion = {
  suggestion_id: string
  counter_id: string
  value: number
  value_raw: string
  confidence: "high" | "medium" | "low"
  verbatim_span: string
  evidence: string
  warnings: "below_last_reading" | "meter_number_mismatch" | "unusually_high" | "possible_decimal_shift" | "decimal_unverified"[]
  status: "pending" | "accepted" | "dismissed"
  decided_at: string // date-time
  decided_by: string
  last_value: number
  last_read_at: string // date-time
  suggested_alternative: {
    value: number
    value_raw: string
    reason: "decimal_shift" | "decimal_unverified"
  }
  photo_attached: boolean
}

MeterReadingSuggestedAlternative

Another reading to offer instead of value. decimal_shift: a decimal shift of value that is consistent with last_value (between it and twice it), offered when value itself is implausible and exactly one shift (×0.01, ×0.1 or ×10) fits. decimal_unverified: value / 10, offered when there

type MeterReadingSuggestedAlternative = {
  value: number
  value_raw: string
  reason: "decimal_shift" | "decimal_unverified"
}

MeterReadingSuggestionJob

type MeterReadingSuggestionJob = {
  meter_id: string
  file_id: string
  schema: string
  file_name: string
  status: "PENDING" | "IN_PROGRESS" | "COMPLETED" | "FAILED"
  error: string
  read_at: string // date-time
  read_at_source: "exif" | "none"
  is_meter_photo: boolean
  meter_number_on_image: string
  meter_number_mismatch: boolean
  suggestions: Array<{
    suggestion_id: string
    counter_id: string
    value: number
    value_raw: string
    confidence: "high" | "medium" | "low"
    verbatim_span: string
    evidence: string
    warnings: "below_last_reading" | "meter_number_mismatch" | "unusually_high" | "possible_decimal_shift" | "decimal_unverified"[]
    status: "pending" | "accepted" | "dismissed"
    decided_at: string // date-time
    decided_by: string
    last_value: number
    last_read_at: string // date-time
    suggested_alternative: {
      value: { ... }
      value_raw: { ... }
      reason: { ... }
    }
    photo_attached: boolean
  }>
  created_at: string // date-time
  updated_at: string // date-time
}

FileTextStatus

Availability of the plain-text representation for a file entity.

type FileTextStatus = "ready" | "not_ready" | "unsupported"

FileValidationRequest

type FileValidationRequest = {
  file: {
    entity_id: string | string // uuid
  } | {
    s3ref: unknown
  }
  rule_ids: string[]
}

FileValidationFileReference

The file to validate - a saved file entity, or an uploaded object not saved as an entity yet.

type FileValidationFileReference = {
  entity_id: string | string // uuid
} | {
  s3ref: unknown
}

FileValidation

type FileValidation = {
  id: string
  status: "completed" | "pending" | "failed" | "skipped"
  file: {
    entity_id?: string | string // uuid
    s3ref?: unknown
    filename?: string
    mime_type?: string
    size_bytes?: number
  }
  observation: {
    facts: {
      mime_type?: { ... }
      size_bytes?: { ... }
      page_count?: { ... }
      longer_edge_px?: { ... }
      is_blank?: { ... }
      is_password_protected?: { ... }
    }
    judgements?: Record<string, {
      result: { ... }
      confidence?: { ... }
      evidence?: { ... }
      explanation?: { ... }
    }>
    document_type?: {
      slug?: { ... }
      confidence?: { ... }
    }
  }
  results: Array<{
    rule_id: string
    rule_title?: string
    level: "basic" | "standard" | "advanced"
    is_valid: boolean
    failed_parts?: string[]
    warnings?: string[]
    conditions: Array<{
      id: { ... }
      operator: { ... }
      outcome: { ... }
      blocking: { ... }
      message: { ... }
      evidence?: { ... }
      explanation?: { ... }
    }>
  }>
  created_at: string // date-time
}

FileValidationFile

The file that was validated, with the identity facts collected from its content.

type FileValidationFile = {
  entity_id?: string | string // uuid
  s3ref?: unknown
  filename?: string
  mime_type?: string
  size_bytes?: number
}

FileValidationObservation

Everything observed about the file, as passed to the validation rules engine.

type FileValidationObservation = {
  facts: {
    mime_type?: string
    size_bytes?: number
    page_count?: number
    longer_edge_px?: number
    is_blank?: boolean
    is_password_protected?: boolean
  }
  judgements?: Record<string, {
    result: "pass" | "fail" | "uncertain"
    confidence?: number
    evidence?: string
    explanation?: string
  }>
  document_type?: {
    slug?: string
    confidence?: number
  }
}

FileValidationJudgement

type FileValidationJudgement = {
  result: "pass" | "fail" | "uncertain"
  confidence?: number
  evidence?: string
  explanation?: string
}

FileValidationFacts

Deterministic properties of the file. A property that is absent could not be determined (for example the resolution of an image the service cannot decode); conditions that need it are skipped rather than failed.

type FileValidationFacts = {
  mime_type?: string
  size_bytes?: number
  page_count?: number
  longer_edge_px?: number
  is_blank?: boolean
  is_password_protected?: boolean
}

FileValidationRuleResult

type FileValidationRuleResult = {
  rule_id: string
  rule_title?: string
  level: "basic" | "standard" | "advanced"
  is_valid: boolean
  failed_parts?: string[]
  warnings?: string[]
  conditions: Array<{
    id: string
    operator: string
    outcome: "pass" | "fail" | "uncertain" | "skipped"
    blocking: boolean
    message: string
    evidence?: string
    explanation?: string
  }>
}

FileValidationConditionResult

type FileValidationConditionResult = {
  id: string
  operator: string
  outcome: "pass" | "fail" | "uncertain" | "skipped"
  blocking: boolean
  message: string
  evidence?: string
  explanation?: string
}

FileText

type FileText = {
  status: "ready"
  text: string
  truncated: boolean
  total_chars: number
} | {
  status: "not_ready"
} | {
  status: "unsupported"
}

FileTextReady

type FileTextReady = {
  status: "ready"
  text: string
  truncated: boolean
  total_chars: number
}

FileTextNotReady

type FileTextNotReady = {
  status: "not_ready"
}

FileTextUnsupported

type FileTextUnsupported = {
  status: "unsupported"
}

CustomDownloadUrl

Custom external download url used for the file

type CustomDownloadUrl = string // uri

CustomDownloadUrlAuth

Authorization mode for the custom_download_url. presigned (the default) uses an HMAC-signed URL; token authorizes the download via the caller's bearer token, matched against the exact stored custom_download_url. In token mode the File API returns the unsigned custom_download_url (no expires_at/s

type CustomDownloadUrlAuth = "presigned" | "token"

FileEntity

type FileEntity = {
  _title: string
  _schema: "file"
  _org: string
  _id: string | string // uuid
  _tags?: string[]
  _purpose?: string[]
  _manifest?: string // uuid[]
  filename: string
  type: "document" | "document_template" | "text" | "image" | "video" | "audio" | "spreadsheet" | "presentation" | "font" | "archive" | "application" | "unknown"
  mime_type?: string
  size_bytes?: number
  readable_size?: string
  etag?: string
  access_control: "private" | "public-read"
  public_url?: string // url
  custom_download_url?: string // uri
  custom_download_url_auth?: "presigned" | "token"
  preview_summary_de?: string
  short_summary_de?: string
  preview_summary_en?: string
  short_summary_en?: string
  file_summary_execution_id?: string // uuid
  source_url?: string
  s3ref?: object
  versions: Array<{
    s3ref?: unknown
    filename?: string
    size_bytes?: number
    readable_size?: string
    mime_type?: string
    etag?: string
  }>
  _updated_at?: string // date-time
  _created_at?: string // date-time
  _acl?: {
    view?: string[]
    edit?: string[]
    delete?: string[]
  }
  _owners?: Array<{
    org_id: string
    user_id?: string
  }>
  __additional?: Record<string, unknown>
}

CommonSaveFilePayload

type CommonSaveFilePayload = {
  _id?: object
  file_entity_id?: string
  relations?: Array<{
    entity_id: string
    _schema?: string
    _tags?: string[]
  }>
}

SaveS3FilePayload

type SaveS3FilePayload = {
  _id?: object
  file_entity_id?: string
  relations?: Array<{
    entity_id: string
    _schema?: string
    _tags?: string[]
  }>
  _tags?: string[]
  _purpose?: string[]
  _manifest?: string // uuid[]
  filename?: string
  type?: "document" | "document_template" | "text" | "image" | "video" | "audio" | "spreadsheet" | "presentation" | "font" | "archive" | "application" | "unknown"
  mime_type?: string
  size_bytes?: number
  readable_size?: string
  etag?: string
  access_control?: "private" | "public-read"
  public_url?: string // url
  custom_download_url?: string // uri
  custom_download_url_auth?: "presigned" | "token"
  preview_summary_de?: string
  short_summary_de?: string
  preview_summary_en?: string
  short_summary_en?: string
  file_summary_execution_id?: string // uuid
  s3ref?: unknown
}

SaveFileFromSourceURLPayload

type SaveFileFromSourceURLPayload = {
  _id?: object
  file_entity_id?: string
  relations?: Array<{
    entity_id: string
    _schema?: string
    _tags?: string[]
  }>
  _tags?: string[]
  _purpose?: string[]
  _manifest?: string // uuid[]
  filename?: string
  type?: "document" | "document_template" | "text" | "image" | "video" | "audio" | "spreadsheet" | "presentation" | "font" | "archive" | "application" | "unknown"
  mime_type?: string
  size_bytes?: number
  readable_size?: string
  etag?: string
  access_control?: "private" | "public-read"
  public_url?: string // url
  custom_download_url?: string // uri
  custom_download_url_auth?: "presigned" | "token"
  preview_summary_de?: string
  short_summary_de?: string
  preview_summary_en?: string
  short_summary_en?: string
  file_summary_execution_id?: string // uuid
  source_url?: string // uri
}

SaveCustomFilePayload

type SaveCustomFilePayload = {
  _id?: object
  file_entity_id?: string
  relations?: Array<{
    entity_id: string
    _schema?: string
    _tags?: string[]
  }>
  _tags?: string[]
  _purpose?: string[]
  _manifest?: string // uuid[]
  filename?: string
  type?: "document" | "document_template" | "text" | "image" | "video" | "audio" | "spreadsheet" | "presentation" | "font" | "archive" | "application" | "unknown"
  mime_type?: string
  size_bytes?: number
  readable_size?: string
  etag?: string
  access_control?: "private" | "public-read"
  public_url?: string // url
  custom_download_url?: string // uri
  custom_download_url_auth?: "presigned" | "token"
  preview_summary_de?: string
  short_summary_de?: string
  preview_summary_en?: string
  short_summary_en?: string
  file_summary_execution_id?: string // uuid
}

SaveFilePayload

type SaveFilePayload = {
  _id?: object
  file_entity_id?: string
  relations?: Array<{
    entity_id: string
    _schema?: string
    _tags?: string[]
  }>
  _tags?: string[]
  _purpose?: string[]
  _manifest?: string // uuid[]
  filename?: string
  type?: "document" | "document_template" | "text" | "image" | "video" | "audio" | "spreadsheet" | "presentation" | "font" | "archive" | "application" | "unknown"
  mime_type?: string
  size_bytes?: number
  readable_size?: string
  etag?: string
  access_control?: "private" | "public-read"
  public_url?: string // url
  custom_download_url?: string // uri
  custom_download_url_auth?: "presigned" | "token"
  preview_summary_de?: string
  short_summary_de?: string
  preview_summary_en?: string
  short_summary_en?: string
  file_summary_execution_id?: string // uuid
  s3ref?: unknown
} | {
  _id?: object
  file_entity_id?: string
  relations?: Array<{
    entity_id: string
    _schema?: string
    _tags?: string[]
  }>
  _tags?: string[]
  _purpose?: string[]
  _manifest?: string // uuid[]
  filename?: string
  type?: "document" | "document_template" | "text" | "image" | "video" | "audio" | "spreadsheet" | "presentation" | "font" | "archive" | "application" | "unknown"
  mime_type?: string
  size_bytes?: number
  readable_size?: string
  etag?: string
  access_control?: "private" | "public-read"
  public_url?: string // url
  custom_download_url?: string // uri
  custom_download_url_auth?: "presigned" | "token"
  preview_summary_de?: string
  short_summary_de?: string
  preview_summary_en?: string
  short_summary_en?: string
  file_summary_execution_id?: string // uuid
  source_url?: string // uri
} | {
  _id?: object
  file_entity_id?: string
  relations?: Array<{
    entity_id: string
    _schema?: string
    _tags?: string[]
  }>
  _tags?: string[]
  _purpose?: string[]
  _manifest?: string // uuid[]
  filename?: string
  type?: "document" | "document_template" | "text" | "image" | "video" | "audio" | "spreadsheet" | "presentation" | "font" | "archive" | "application" | "unknown"
  mime_type?: string
  size_bytes?: number
  readable_size?: string
  etag?: string
  access_control?: "private" | "public-read"
  public_url?: string // url
  custom_download_url?: string // uri
  custom_download_url_auth?: "presigned" | "token"
  preview_summary_de?: string
  short_summary_de?: string
  preview_summary_en?: string
  short_summary_en?: string
  file_summary_execution_id?: string // uuid
}

SaveFilePayloadV2

type SaveFilePayloadV2 = {
  _id?: object
  file_entity_id?: string
  relations?: Array<{
    entity_id: string
    _schema?: string
    _tags?: string[]
  }>
  _tags?: string[]
  _purpose?: string[]
  _manifest?: string // uuid[]
  filename?: string
  type?: "document" | "document_template" | "text" | "image" | "video" | "audio" | "spreadsheet" | "presentation" | "font" | "archive" | "application" | "unknown"
  mime_type?: string
  size_bytes?: number
  readable_size?: string
  etag?: string
  access_control?: "private" | "public-read"
  public_url?: string // url
  custom_download_url?: string // uri
  custom_download_url_auth?: "presigned" | "token"
  preview_summary_de?: string
  short_summary_de?: string
  preview_summary_en?: string
  short_summary_en?: string
  file_summary_execution_id?: string // uuid
  s3ref?: unknown
} | {
  _id?: object
  file_entity_id?: string
  relations?: Array<{
    entity_id: string
    _schema?: string
    _tags?: string[]
  }>
  _tags?: string[]
  _purpose?: string[]
  _manifest?: string // uuid[]
  filename?: string
  type?: "document" | "document_template" | "text" | "image" | "video" | "audio" | "spreadsheet" | "presentation" | "font" | "archive" | "application" | "unknown"
  mime_type?: string
  size_bytes?: number
  readable_size?: string
  etag?: string
  access_control?: "private" | "public-read"
  public_url?: string // url
  custom_download_url?: string // uri
  custom_download_url_auth?: "presigned" | "token"
  preview_summary_de?: string
  short_summary_de?: string
  preview_summary_en?: string
  short_summary_en?: string
  file_summary_execution_id?: string // uuid
  source_url?: string // uri
} | {
  _id?: object
  file_entity_id?: string
  relations?: Array<{
    entity_id: string
    _schema?: string
    _tags?: string[]
  }>
  _tags?: string[]
  _purpose?: string[]
  _manifest?: string // uuid[]
  filename?: string
  type?: "document" | "document_template" | "text" | "image" | "video" | "audio" | "spreadsheet" | "presentation" | "font" | "archive" | "application" | "unknown"
  mime_type?: string
  size_bytes?: number
  readable_size?: string
  etag?: string
  access_control?: "private" | "public-read"
  public_url?: string // url
  custom_download_url?: string // uri
  custom_download_url_auth?: "presigned" | "token"
  preview_summary_de?: string
  short_summary_de?: string
  preview_summary_en?: string
  short_summary_en?: string
  file_summary_execution_id?: string // uuid
}

BatchSaveFileVersionPayload

Payload for batch version save. Only s3ref payloads are supported.

type BatchSaveFileVersionPayload = {
  _id?: object
  file_entity_id?: string
  filename?: string
  mime_type?: string
  access_control?: "private" | "public-read"
  s3ref: unknown
}

UploadFilePayload

type UploadFilePayload = {
  filename: string
  mime_type?: string
  index_tag?: string
  metadata?: Record<string, string>
}

FileUpload

type FileUpload = {
  s3ref?: object
  upload_url?: string // url
  public_url?: string // url
}

DownloadFilesPayload

type DownloadFilesPayload = Array<{
  id: string | string // uuid
  version?: number
}>

CreateZipJobPayload

Request payload to create a ZIP job for bulk file download. Provide either an explicit list of file_entity_ids (up to 1000) or an entity_query that resolves to file entities (up to 20000).

type CreateZipJobPayload = unknown | unknown

ZipJob

ZIP job status and result

type ZipJob = {
  job_id?: string // uuid
  status?: "queued" | "downloading" | "zipping" | "uploading" | "sending_notification" | "completed" | "failed"
  progress?: {
    total_files?: number
    downloaded_files?: number
    failed_files?: number
  }
  result?: {
    file_entity_id?: string // uuid
    download_url?: string // uri
    expires_at?: string // date-time
    zip_size_bytes?: number
  }
  error?: string
  created_at?: string // date-time
  created_by?: string
  org_id?: string
  updated_at?: string // date-time
}

VerifyCustomDownloadUrlPayload

type VerifyCustomDownloadUrlPayload = {
  custom_download_url: string
}

S3Reference

type S3Reference = {
  bucket: string
  key: string
}

S3Ref

type S3Ref = {
  bucket: string
  key: string
}

FileItem

type FileItem = {
  s3ref?: unknown
  filename?: string
  size_bytes?: number
  readable_size?: string
  mime_type?: string
  etag?: string
}

FileRelationItem

type FileRelationItem = {
  entity_id: string
  _schema?: string
  _tags?: string[]
}

PublicLink

type PublicLink = {
  id?: string
  link?: string
  last_accessed_at?: string
}

BaseEntityOwner

The user / organization owning this entity.

Note: Owner implicitly has access to the entity regardless of ACLs.

type BaseEntityOwner = {
  org_id: string
  user_id?: string
}

BaseEntityAcl

Access control list (ACL) for an entity. Defines sharing access to external orgs or users.

type BaseEntityAcl = {
  view?: string[]
  edit?: string[]
  delete?: string[]
}

ErrorObject

A generic error returned by the API

type ErrorObject = {
  status?: number
  error?: string
}

FileCollectionId

Generated uuid for a file collection

type FileCollectionId = string // uuid

FileCollectionItem

A file collection with identifiers and timestamps

type FileCollectionItem = {
  slug?: string
  name: string
  id?: string // uuid
  parents?: string[]
  starred?: boolean
  order?: number
  enabled_locations?: string[]
  enabled_purposes?: string[]
  created_at?: string // date-time
  updated_at?: string // date-time
}

FileCollectionAttributes

type FileCollectionAttributes = {
  name?: string
  parents?: string[]
  starred?: boolean
  enabled_locations?: string[]
  enabled_purposes?: string[]
}

FileCollectionCreateRequest

Request body for creating a file collection

type FileCollectionCreateRequest = {
  name: string
  parents?: string[]
  starred?: boolean
  enabled_locations?: string[]
  enabled_purposes?: string[]
}
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.