TrustLayer documents API

The documents API from TrustLayer — 15 operation(s) for documents.

OpenAPI Specification

trustlayer-documents-api-openapi.yml Raw ↑
openapi: 3.0.0
info:
  title: TrustLayer Platform Auth documents API
  version: '1.0'
  contact:
    name: TrustLayer Support
    email: support@trustlayer.io
  termsOfService: https://trustlayer.io/terms-of-service
  externalDocs:
    description: OpenAPI specification
    url: /v1/platform-api.yaml
  description: '3rd-party API for the TrustLayer platform.


    **Deprecated.** Platform API v1 is deprecated as of 01 June 2026 and is

    scheduled for sunset (end-of-life) on 31 March 2027. It remains fully

    available until the sunset date but will not receive new features. Please

    migrate to Platform API v2 for new integrations.


    All v1 responses carry the standard deprecation response headers

    ([RFC 8594](https://www.rfc-editor.org/rfc/rfc8594)):


    ```http

    Deprecation: @1780272000

    Sunset: Wed, 31 Mar 2027 23:59:59 GMT

    Link: <https://developers.trustlayer.io/>; rel="deprecation", <https://developers.trustlayer.io/>; rel="sunset"

    ```


    `Deprecation: @1780272000` is the Unix timestamp for 2026-06-01T00:00:00Z;

    sunset (end-of-life) is 2027-03-31T23:59:59 GMT.'
  x-deprecated: true
  x-deprecation-date: '2026-06-01'
  x-sunset: '2027-03-31'
  license:
    name: Apache 2.0
    url: https://apache.org/licenses/LICENSE-2.0
servers:
- url: http://localhost:4000/v1
  description: Local
- url: https://api.trustlayer.io/v1
  description: Production
security:
- API Key: []
tags:
- name: documents
paths:
  /documents:
    get:
      summary: List documents
      tags:
      - documents
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    $ref: '#/components/schemas/response-status'
                  data:
                    type: array
                    items:
                      $ref: '#/components/schemas/document'
                  meta:
                    $ref: '#/components/schemas/collection-meta'
      operationId: get-documents
      deprecated: true
      parameters:
      - $ref: '#/components/parameters/filter'
      - $ref: '#/components/parameters/sort'
      - $ref: '#/components/parameters/page-number'
      - $ref: '#/components/parameters/page-size'
      - $ref: '#/components/parameters/include'
      description: 'Available filters:

        * `name`

        * `party`

        * `project`

        * `type`

        * `archived`

        * `reviewed`

        * `createdAt`

        * `updatedAt`

        * `reviewedAt`

        * `archivedAt`

        * `expirationDate`


        Available sort keys:

        * `name`

        * `createdAt`

        * `updatedAt`

        * `archivedAt`

        * `reviewedAt`

        * `expirationDate`


        Available include options:

        * `party`

        * `projects`

        * `reviewedBy`

        * `archivedBy`

        * `types`


        Pagination is enabled.'
    post:
      summary: Upload a document
      operationId: post-documents
      deprecated: true
      responses:
        '201':
          description: Created
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    $ref: '#/components/schemas/response-status'
                  data:
                    $ref: '#/components/schemas/document'
      requestBody:
        content:
          multipart/form-data:
            schema:
              type: object
              properties:
                document:
                  type: string
                  format: binary
                documentType:
                  type: string
                  x-stoplight:
                    id: 5m0jog13c31x8
                  description: Document type name or ID
              required:
              - document
        description: File data
      description: 'This endpoint accepts a `multipart/form-data` payload containing a single `document` parameter.

        The returned document will be queued for processing.

        Optionally, a `documentType` parameter can be specified, containing either the exact name of an existing document type, or its ID.'
      parameters: []
      tags:
      - documents
  /documents/{documentId}:
    parameters:
    - schema:
        type: string
      name: documentId
      in: path
      required: true
      description: Document ID
    get:
      summary: Fetch a document
      tags:
      - documents
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    $ref: '#/components/schemas/response-status'
                  data:
                    $ref: '#/components/schemas/document'
      operationId: get-documents-id
      deprecated: true
      description: 'Available include options:


        * `party`

        * `projects`

        * `types`

        * `archivedBy`

        * `reviewedBy`


        Notes:


        - the uploaded file is accessible via the `url` attribute; the URL will expire in 24 hours.

        '
      parameters:
      - $ref: '#/components/parameters/include'
    patch:
      summary: Update a document
      operationId: patch-documents-documentId
      deprecated: true
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    $ref: '#/components/schemas/response-status'
                  data:
                    $ref: '#/components/schemas/document'
      tags:
      - documents
      description: '* Updating a document''s data will trigger a recalc of the compliance status for all affected parties.

        * You can specify a project scope; the party the document is attached to _must_ belong to the project


        Requirements: the document _must_ belong to a party.'
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                document:
                  $ref: '#/components/schemas/document-input'
      parameters:
      - $ref: '#/components/parameters/scope-type'
      - $ref: '#/components/parameters/scope-id'
      x-internal: false
    delete:
      summary: Delete a document
      operationId: delete-documents-documentId
      deprecated: true
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    $ref: '#/components/schemas/response-status'
                  data:
                    $ref: '#/components/schemas/document'
      description: TBD
      tags:
      - documents
  /documents/{documentId}/review:
    parameters:
    - schema:
        type: string
      name: documentId
      in: path
      required: true
      description: Document ID
    delete:
      summary: Remove the review from a document
      operationId: delete-documents-id-review
      deprecated: true
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    $ref: '#/components/schemas/response-status'
                  data:
                    $ref: '#/components/schemas/document'
      description: 'Mark the document as not reviewed. This will remove all the information about the current review status of the document.


        Requirements: the document _must_ belong to a party.'
      tags:
      - documents
      parameters:
      - $ref: '#/components/parameters/scope-type'
      - $ref: '#/components/parameters/scope-id'
    post:
      summary: Review a document
      operationId: put-documents-id-review
      deprecated: true
      responses:
        '201':
          description: Created
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    $ref: '#/components/schemas/response-status'
                  data:
                    $ref: '#/components/schemas/document'
      description: 'Mark the document as reviewed by the given user. If the document has already been reviewed, no change will be made.


        Requirements: the document _must_ belong to a party.'
      tags:
      - documents
      parameters:
      - $ref: '#/components/parameters/scope-type'
      - $ref: '#/components/parameters/scope-id'
  /documents/{documentId}/archive:
    parameters:
    - schema:
        type: string
      name: documentId
      in: path
      required: true
      description: Document ID
    delete:
      summary: Un-archive a document
      operationId: delete-documents-id-archive
      deprecated: true
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    $ref: '#/components/schemas/response-status'
                  data:
                    $ref: '#/components/schemas/document'
      description: Mark the document as not archived.
      tags:
      - documents
      parameters:
      - $ref: '#/components/parameters/scope-type'
      - $ref: '#/components/parameters/scope-id'
    post:
      summary: Archive a document
      operationId: post-documents-id-archive
      deprecated: true
      responses:
        '201':
          description: Created
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    $ref: '#/components/schemas/response-status'
                  data:
                    $ref: '#/components/schemas/document'
      description: Mark the document as archived.
      tags:
      - documents
      parameters:
      - $ref: '#/components/parameters/scope-type'
      - $ref: '#/components/parameters/scope-id'
  /documents/{documentId}/reprocess:
    parameters:
    - schema:
        type: string
      name: documentId
      in: path
      required: true
      description: Document ID
    post:
      summary: Reprocess a document
      operationId: put-documents-id-review
      deprecated: true
      responses:
        '201':
          description: Created
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    $ref: '#/components/schemas/response-status'
                  data:
                    $ref: '#/components/schemas/document'
      description: 'Send the document to the extraction pipeline. The results will overwite the document''s current data.

        '
      tags:
      - documents
      parameters: []
  /documents/{documentId}/flag:
    parameters:
    - schema:
        type: string
      name: documentId
      in: path
      required: true
      description: Document ID
    delete:
      summary: Remove the flag from a document
      operationId: delete-documents-id-flag
      deprecated: true
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    $ref: '#/components/schemas/response-status'
                  data:
                    $ref: '#/components/schemas/document'
      description: 'Remove the existing flag data from a document (if any).


        If the document belongs to a party, you can specify an additional project `scope` (the party must belong to the project). This will be used to log the event in the activity timeline.


        Requirements: the document _must_ belong to a party.'
      tags:
      - documents
      parameters:
      - $ref: '#/components/parameters/scope-type'
      - $ref: '#/components/parameters/scope-id'
    post:
      summary: Flag a document or update the existing flag info
      operationId: put-documents-id-flag
      deprecated: true
      responses:
        '201':
          description: Created
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    $ref: '#/components/schemas/response-status'
                  data:
                    $ref: '#/components/schemas/document'
      description: 'A document can have at most one flag. If a document is already flagged, existing data will be replaced.


        * `addedOn` will default to the current time if left blank

        * `severityLevel` and `user.id` are the only required parameters


        If the document belongs to a party, you can specify an additional project `scope` (the party must belong to the project). This will be used to log the event in the activity timeline.


        Requirements: the document _must_ belong to a party.

        '
      requestBody:
        content:
          application/json:
            schema:
              description: ''
              type: object
              properties:
                flag:
                  $ref: '#/components/schemas/document-flag-input'
      tags:
      - documents
      parameters:
      - $ref: '#/components/parameters/scope-type'
      - $ref: '#/components/parameters/scope-id'
  /parties/{partyId}/compliance-certificate:
    parameters:
    - schema:
        type: string
      name: partyId
      in: path
      required: true
      description: Party ID
    post:
      summary: Create a party compliance certificate
      operationId: post-parties-id-compliance-certificate-create
      deprecated: true
      responses:
        '201':
          description: Created
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    $ref: '#/components/schemas/response-status'
                  data:
                    $ref: '#/components/schemas/document'
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                complianceCertificate:
                  $ref: '#/components/schemas/compliance-certificate-create'
          multipart/form-data:
            schema:
              type: object
              properties: null
              effectiveDate:
                type: string
                format: date-time
              expirationDate:
                type: string
                format: date-time
              document:
                type: string
                format: binary
      description: '* if `effectiveDate` is not provided, it will default to the current moment

        * if `expirationDate` is not provided, it will default to the earliest expiration date found in currently active documents; if no document is present, it will default to 1 year from the effective date

        * if `document` is provided (only for multipart/form-data), it will be uploaded to the party and used as the compliance certificate


        Available `scope` options:


        * `projects`

        '
      x-internal: false
      tags:
      - documents
    get:
      summary: Fetch a party's compliance certificate
      operationId: get-parties-id-compliance-certificate
      deprecated: true
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    $ref: '#/components/schemas/response-status'
                  data:
                    $ref: '#/components/schemas/document'
      description: 'Returns the currently valid compliance certificate for a party, if it exists; otherwise it responds with a 404 status.


        Available `scope` options:


        * `projects`

        '
      tags:
      - documents
  /parties/{partyId}/relationships/documents:
    parameters:
    - schema:
        type: string
      name: partyId
      in: path
      required: true
      description: Party ID
    post:
      summary: Attach documents to a party
      operationId: post-parties-id-relationships-documents
      deprecated: true
      responses:
        '201':
          description: Created
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    $ref: '#/components/schemas/response-status'
                  data:
                    $ref: '#/components/schemas/party'
      description: 'Note that at any given time, a document can only be attached to one party.

        If the document is already attached to another party, it will be ignored.


        All documents _must_ exist, otherwise a 404 response will be returned and no document will be attached.

        '
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                documents:
                  type: array
                  items:
                    $ref: '#/components/schemas/reference-input'
              required:
              - documents
      tags:
      - documents
      parameters: []
    delete:
      summary: Detach a document from a party
      operationId: delete-parties-id-relationships-documents
      deprecated: true
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    $ref: '#/components/schemas/response-status'
                  data:
                    $ref: '#/components/schemas/party'
      tags:
      - documents
      description: 'Once the document has been detached from its party, it can be reattached to a different party.


        All documents _must_ exist, otherwise a 404 response will be returned and no document will be attached.'
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                documents:
                  $ref: '#/components/schemas/reference-list-input'
              required:
              - documents
  /projects/{projectId}/relationships/documents:
    parameters:
    - schema:
        type: string
      name: projectId
      in: path
      required: true
      description: Project ID
    post:
      summary: Attach documents to a project
      operationId: post-projects-id-relationships-documents
      deprecated: true
      responses:
        '201':
          description: Created
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    $ref: '#/components/schemas/response-status'
                  data:
                    $ref: '#/components/schemas/project'
      tags:
      - documents
      description: 'A document can be attached to any number of projects.


        All documents _must_ exist, otherwise a 404 response will be returned and no document will be attached.'
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                documents:
                  $ref: '#/components/schemas/reference-list-input'
              required:
              - documents
    delete:
      summary: Detach documents from a project
      operationId: delete-projects-id-relationships-documents
      deprecated: true
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    $ref: '#/components/schemas/response-status'
                  data:
                    $ref: '#/components/schemas/project'
      description: All documents _must_ exist, otherwise a 404 response will be returned and no document will be detached.
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                documents:
                  $ref: '#/components/schemas/reference-list-input'
              required:
              - documents
      tags:
      - documents
  /parties/{partyId}/documents:
    parameters:
    - schema:
        type: string
      name: partyId
      in: path
      required: true
      description: Party ID
    post:
      summary: Upload a document to a party
      operationId: post-parties-id-documents
      deprecated: true
      responses:
        '201':
          description: Created
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    $ref: '#/components/schemas/response-status'
                  data:
                    $ref: '#/components/schemas/document'
      tags:
      - documents
      description: This will simultaneusly upload a document and attach it to the party.
      requestBody:
        content:
          multipart/form-data:
            schema:
              type: object
              properties:
                document:
                  type: string
                  format: binary
                documentType:
                  type: string
                  x-stoplight:
                    id: 8w8io4y2eiiha
                  description: Document type name or ID
              required:
              - document
  /parties/{partyId}/relationships/documents/{documentId}:
    parameters:
    - schema:
        type: string
      name: partyId
      in: path
      required: true
      description: Party ID
    - schema:
        type: string
      name: documentId
      in: path
      required: true
      description: Document ID
    delete:
      summary: Remove a document from a party
      tags:
      - documents
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    $ref: '#/components/schemas/response-status'
                  data:
                    $ref: '#/components/schemas/party'
      operationId: get-parties-partyId-relationships-documents-documentId
      deprecated: true
      description: If you need to remove multiple documents at once you can use the alternative endpoint `DELETE /parties/{partyId}/relationships/documents`
  /projects/{projectId}/relationships/documents/{documentId}:
    parameters:
    - schema:
        type: string
      name: projectId
      in: path
      required: true
      description: Project ID
    - schema:
        type: string
      name: documentId
      in: path
      required: true
      description: Document ID
    delete:
      summary: Remove a document from a project
      operationId: delete-projects-projectId-relationships-documents-documentId
      deprecated: true
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    $ref: '#/components/schemas/response-status'
                  data:
                    $ref: '#/components/schemas/project'
      tags:
      - documents
      description: If you need to remove multiple documents at once you can use the alternative endpoint `DELETE /projects/{projectId}/relationships/documents`
  /parties/{partyId}/document-request:
    parameters:
    - schema:
        type: string
      name: partyId
      in: path
      required: true
      description: Party ID
    get:
      summary: Fetch the current document request
      tags:
      - documents
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    $ref: '#/components/schemas/response-status'
                  data:
                    $ref: '#/components/schemas/document-request'
      operationId: get-parties-:id-document-request
      deprecated: true
      description: 'This will return the latest document request sent for the party.


        Available include options:

        * `party`'
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                status:
                  $ref: '#/components/schemas/response-status'
                data:
                  type: object
      parameters:
      - $ref: '#/components/parameters/include'
      x-internal: false
    post:
      summary: Send a new document request
      operationId: post-parties-partyId-document-request
      deprecated: true
      tags:
      - documents
      responses:
        '201':
          description: Created
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    $ref: '#/components/schemas/response-status'
                  data:
                    $ref: '#/components/schemas/document-request'
      description: If a request already exists for this party, this will send a reminder.
      x-internal: false
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                request:
                  $ref: '#/components/schemas/document-request-input'
  /documents/{documentId}/relationships/projects:
    parameters:
    - schema:
        type: string
      name: documentId
      in: path
      required: true
    post:
      summary: Associate a document to multiple projects
      operationId: post-documents-documentId-relationships-projects
      deprecated: true
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    $ref: '#/components/schemas/response-status'
                  data:
                    $ref: '#/components/schemas/document'
      tags:
      - documents
      description: TBD
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                projects:
                  type: array
                  items:
                    $ref: '#/components/schemas/reference-input'
  /documents/{id}/amendments:
    get:
      tags:
      - documents
      description: List amendments (cancellations and reinstatements) attached to a document. Each amendment is either a cancellation that reduces or ends the policy coverage referenced by the document, or a reinstatement that restores it. Supports pagination (`limit`, `skip`). Results are scoped to the caller's organization.
      parameters:
      - schema:
          default: 20
          type: integer
          minimum: 0
          exclusiveMinimum: true
          maximum: 100
        in: query
        name: limit
        required: false
      - schema:
          default: 0
          type: integer
          minimum: 0
          maximum: 9007199254740991
        in: query
        name: skip
        required: false
      - schema:
          allOf:
          - $ref: '#/components/schemas/objectIdInput'
        in: path
        name: id
        required: true
        description: Identifier of the document whose amendments to list.
      responses:
        '200':
          description: Default Response
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    type: array
                    items:
                      type: object
                      properties:
                        _id:
                          $ref: '#/components/schemas/objectId'
                        primaryRecordId:
                          $ref: '#/components/schemas/objectId'
                        policyNumber:
                          type: string
                          minLength: 1
                        status:
                          type: string
                          enum:
                          - pending
                          - active
                          description: 'Lifecycle status of the amendment: Active means it currently affects policy validity; Cancelled means it was revoked.'
                        type:
                          type: string
                          enum:
                          - cancellation
                          - reinstatement
                          description: Whether this amendment is a cancellation (ends or reduces policy coverage) or a reinstatement (restores coverage after a cancellation).
                        subjects:
                          default: []
                          type: array
                          items:
                            type: object
                            properties:
                              code:
                                type: string
                                minLength: 1
                            required:
                            - code
                            additionalProperties: false
                        matchingSubjects:
                          default: []
                          type: array
                          items:
                            type: object
                            properties:
                              code:
                                type: string
                                minLength: 1
                              label:
                                type: string
                                minLength: 1
                            required:
                            - code
                            - label
                            additionalProperties: false
                        effectiveDate:
                          type: string
                          format: date-time
                        issueDate:
                          type: string
                          format: date-time
                        notes:
                          type: string
                          minLength: 1
                        document:
                          type: object
                          properties:
                            id:
                              $ref: '#/components/schemas/objectId'
                          required:
                          - id
                          additionalProperties: false
                      required:
                      - _id
                      - primaryRecordId
                      - policyNumber
                      - status
                      - type
                      - subjects
                      - matchingSubjects
                      - effectiveDate
                      - issueDate
                      - document
                      additionalProperties: false
                  meta:
                    type: object
                    properties:
                      count:
                        type: number
                        description: Total number of records matching the query, across all pages.
                      next:
                        description: Relative URL for the next page of results, preserving filters/sort/projection. Omitted on the last page.
                        type: string
                      prev:
                        description: Relative URL for the previous page of results, preserving filters/sort/projection. Omitted on the first page.
                        type: string
                    required:
                    - count
                    additionalProp

# --- truncated at 32 KB (75 KB total) ---
# Full source: https://raw.githubusercontent.com/api-evangelist/trustlayer/refs/heads/main/openapi/trustlayer-documents-api-openapi.yml