Documents API

Documents represent files associated with business cases, consumer cases, and other resources in the GridLogs platform. This API allows you to create, retrieve, update, and delete document metadata records.

Create Document

POST /v1/documents

Creates a new document metadata record.

Request

title
string
required

Title of the document

description
string

Description of the document

fileKey
string
required

Key of the file in storage (obtained from Uploads API)

fileType
string

Type of file (e.g., PDF, IMAGE, DOCX)

documentType
string

Type of document (e.g., ID, CERTIFICATE, PROOF_OF_ADDRESS)

businessCaseId
string

ID of the associated business case

consumerCaseId
string

ID of the associated consumer case

Response

id
string

Unique identifier for the document

title
string

Title of the document

description
string

Description of the document

fileKey
string

Key of the file in storage

fileType
string

Type of file

documentType
string

Type of document

businessCaseId
string

ID of the associated business case

consumerCaseId
string

ID of the associated consumer case

createdAt
string

Creation timestamp

updatedAt
string

Last update timestamp

Examples

curl -X POST https://api.gridlogs.co/v1/documents \
  -H "X-API-Key: your_api_key_here" \
  -H "Content-Type: application/json" \
  -d '{
    "title": "Certificate of Incorporation",
    "description": "Official certificate of incorporation for Acme Corp",
    "fileKey": "private/1234567890/certificate.pdf",
    "fileType": "PDF",
    "documentType": "CERTIFICATE",
    "businessCaseId": "bc_12345"
  }'

List Documents

GET /v1/documents

Returns a paginated list of documents.

Query Parameters

page
number

Page number for pagination (default: 1)

limit
number

Number of items per page (default: 10)

documentType
string

Filter by document type

fileType
string

Filter by file type

businessCaseId
string

Filter by business case ID

consumerCaseId
string

Filter by consumer case ID

Search term to filter results by title or description

Response

items
array

Array of document objects

meta
object

Pagination metadata

meta.total
number

Total number of documents

meta.page
number

Current page number

meta.limit
number

Number of items per page

meta.totalPages
number

Total number of pages

Examples

curl -X GET "https://api.gridlogs.co/v1/documents?page=1&limit=10&documentType=CERTIFICATE&businessCaseId=bc_12345" \
  -H "X-API-Key: your_api_key_here"

Get Document

GET /v1/documents/{id}

Retrieves a specific document by ID.

Path Parameters

id
string
required

Document ID

Response

Returns a document object with all its properties.

Examples

curl -X GET "https://api.gridlogs.co/v1/documents/doc_12345" \
  -H "X-API-Key: your_api_key_here"

Update Document

PUT /v1/documents/{id}

Updates a specific document metadata record.

Path Parameters

id
string
required

Document ID

Request

title
string

Updated title of the document

description
string

Updated description of the document

documentType
string

Updated type of document

Response

Returns the updated document object.

Examples

curl -X PUT "https://api.gridlogs.co/v1/documents/doc_12345" \
  -H "X-API-Key: your_api_key_here" \
  -H "Content-Type: application/json" \
  -d '{
    "title": "Updated Certificate of Incorporation",
    "description": "Updated official certificate of incorporation for Acme Corp",
    "documentType": "INCORPORATION_CERTIFICATE"
  }'

Delete Document

DELETE /v1/documents/{id}

Deletes a specific document metadata record. Note that this does not delete the underlying file, which must be deleted separately using the Uploads API.

Path Parameters

id
string
required

Document ID

Response

Returns the deleted document object.

Examples

curl -X DELETE "https://api.gridlogs.co/v1/documents/doc_12345" \
  -H "X-API-Key: your_api_key_here"