Uploads API

The Uploads API allows you to upload, retrieve, and manage files within the GridLogs platform. Files uploaded through this API can be referenced in other GridLogs resources, such as documents and analysis requests.

Upload Public File

POST /v1/files/upload/public

Uploads a file to public storage, making it accessible without authentication.

Request

This endpoint accepts multipart/form-data with a file part named file.

Response

success
boolean

Indicates if the upload was successful

fileKey
string

The key of the uploaded file in storage

url
string

The public URL to access the file

fileName
string

The original name of the file

contentType
string

The MIME type of the file

size
number

The size of the file in bytes

Examples

curl -X POST https://api.gridlogs.co/v1/files/upload/public \
  -H "X-API-Key: your_api_key_here" \
  -F "file=@/path/to/your/file.pdf"

Example Response

{
	"success": true,
	"fileKey": "public/1234567890/file.pdf",
	"url": "https://storage.gridlogs.co/public/1234567890/file.pdf",
	"fileName": "file.pdf",
	"contentType": "application/pdf",
	"size": 1245678
}

Upload Private File

POST /v1/files/upload/private

Uploads a file to private storage, requiring authentication to access.

Request

This endpoint accepts multipart/form-data with a file part named file.

Response

success
boolean

Indicates if the upload was successful

fileKey
string

The key of the uploaded file in storage

fileName
string

The original name of the file

contentType
string

The MIME type of the file

size
number

The size of the file in bytes

Examples

curl -X POST https://api.gridlogs.co/v1/files/upload/private \
  -H "X-API-Key: your_api_key_here" \
  -F "file=@/path/to/your/file.pdf"

Example Response

{
	"success": true,
	"fileKey": "private/1234567890/file.pdf",
	"fileName": "file.pdf",
	"contentType": "application/pdf",
	"size": 1245678
}

Get Signed URL

GET /v1/files/signed-url

Generates a time-limited signed URL to access a private file.

Query Parameters

key
string
required

The key of the private file in storage

Response

success
boolean

Indicates if the signed URL was successfully generated

url
string

The signed URL to access the file

expires
string

When the signed URL expires

Examples

curl -X GET "https://api.gridlogs.co/v1/files/signed-url?key=private/1234567890/file.pdf" \
  -H "X-API-Key: your_api_key_here"

Example Response

{
	"success": true,
	"url": "https://storage.gridlogs.co/private/1234567890/file.pdf?signature=abc123&expires=1679900000",
	"expires": "2023-03-27T12:00:00Z"
}

Delete File

DELETE /v1/files/{key}

Deletes a file from storage.

Path Parameters

key
string
required

The key of the file to delete

Response

success
boolean

Indicates if the file was successfully deleted

message
string

A message confirming the deletion

Examples

curl -X DELETE https://api.gridlogs.co/v1/files/private/1234567890/file.pdf \
  -H "X-API-Key: your_api_key_here"

Example Response

{
	"success": true,
	"message": "File deleted successfully"
}