2
document
Interitio edited this page 2025-06-18 23:44:51 +10:00

Document

Represents a saved document, i.e. and image with a seal and optionally some stamps. Will usually be associated with an Event, and event documents should generally be queried through the Event routes. However, Document also supports CRUD operations separately for storing arbitrary non-event documents.

Fields

field type required description
document_id integer - UID for this document
document_data string yes Image data encoded in Base64
seal integer yes Seal integer
created_at timestamp - When this document was created. Automatically set on creation.
metadata string? no Optional arbitrary associated metadata.
stamps [Stamp] no List of stamps attached to this document.

Routes

  • POST /documents
    • Create and return a Document.
    • Stamps may be added to the document by passing a list of Stamps in the stamps field.
      • These stamps should not include document_id, as this will be automatically added.
  • GET /documents
    • Get all Documents matching the given parameters. If no parameters are given, returns all documents.
    • Supported filter parameters:
      • document_id
      • seal
      • created_before
      • created_after
      • metadata
      • stamp_type - Filter documents by whether they have the given stamp type.
  • GET /documents/{document_id}
    • Returns a Document with the given document_id.
  • PATCH /documents/{document_id}
    • Updates the given Document.
    • Supports updating document_data, seal, metadata, and stamps.
    • If stamps is provided, it must be a list of creation arguments for Stamps. These will replace the existing document stamps.
    • To update individual stamps, use /documents/{document_id}/stamps
    • Returns the updated Document.
  • DELETE /documents/{document_id}
    • Delete the given document, and all associated Stamps.
    • Does not delete the associated Event if one exists.
    • Returns the deleted Document.
  • * /documents/{document_id}/stamps
    • Inherits all /stamps routes with document_id set.