Skip to main content
POST
/
v1
/
businesses
/
{businessId}
/
documents
Create document upload
curl --request POST \
  --url https://sandbox.layerfi.com/v1/businesses/{businessId}/documents \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "file_name": "quarterly-report.pdf",
  "file_type": "application/pdf",
  "file_size_bytes": 10485760
}
'
{
  "document_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
  "upload_id": "<string>",
  "part_size_bytes": 123,
  "parts": [
    {
      "part_number": 123,
      "url": "<string>"
    }
  ]
}

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Headers

Content-Type
string

Content-Type must be set to application/json.

Path Parameters

businessId
string<uuid>
required

The UUID of the business to create the document for.

Body

application/json

Parameters for creating a new document with presigned upload URLs.

document_type
enum<string>
required

The type of document being uploaded.

Available options:
RECEIPT,
UNSTRUCTURED_BOOKKEEPING_CONTEXT,
OTHER
file_name
string
required

The name of the file including its extension.

Example:

"quarterly-report.pdf"

file_type
string
required

The MIME type of the file.

Example:

"application/pdf"

file_size_bytes
integer<int64>
required

The size of the file in bytes. Used to calculate the number of upload parts.

Example:

10485760

Response

Document record created and multipart upload initiated. The response includes presigned URLs for uploading file parts.

Response containing presigned URLs for multipart upload to S3.

document_id
string<uuid>
required

The unique identifier of the created document record.

upload_id
string
required

The S3 multipart upload ID. Required when completing or aborting the upload.

part_size_bytes
integer<int64>
required

The size in bytes that each part should be, except for the last part which may be smaller.

parts
object[]
required

List of presigned URLs for uploading each part of the file.