PUT
/
files
/
append
/
{path}
Append content to file
curl --request PUT \
  --url https://api.openfiles.ai/functions/v1/api/files/append/{path} \
  --header 'Content-Type: application/json' \
  --header 'x-api-key: <api-key>' \
  --data '{
  "content": "<string>"
}'
{
  "success": true,
  "data": {
    "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
    "path": "<string>",
    "version": 2,
    "mimeType": "<string>",
    "size": 1,
    "createdAt": "2023-11-07T05:31:56Z",
    "updatedAt": "2023-11-07T05:31:56Z"
  },
  "operation": "write_file",
  "message": "File created successfully, version 1"
}

Append Content to File

Adds new content to the end of an existing file without replacing the original content. Perfect for logs, ongoing documents, and incremental updates.

Use Cases

  • Log files - Add new log entries to existing logs
  • Data collection - Append new records to data files
  • Document building - Add sections to reports or documentation
  • Chat histories - Add new messages to conversation files

Example Usage

const response = await fetch('https://api.openfiles.ai/functions/v1/api/files/append/logs/app.log', {
  method: 'PUT',
  headers: {
    'x-api-key': API_KEY,
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    content: '\n2024-01-15 10:30:00 INFO User login successful'
  })
})

Authorizations

x-api-key
string
header
required

API key for authentication. Get your API key from the console.

Path Parameters

path
string
required

File path (S3-style, no leading slash)

Body

application/json

Response

200
application/json

Success

The response is of type object.