Skip to main content

Sending Files

Include files in the files array. Each file needs a name and content (string).
const result = await fetch('https://api.stewrd.dev/v1/agent', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer sk-stw_your_key',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    message: 'Clean this CSV and fix the date formats',
    files: [{
      name: 'raw-data.csv',
      content: 'id,name,date\n1,Alice,2024-01-15...',
    }],
  }),
})

File Object

FieldTypeRequiredDescription
namestringYesFile name with extension (e.g., data.csv)
contentstringYesFile contents as a string

Receiving Files

Generated files appear in the response files array with name, content, and an optional url for downloadable assets.
{
  "files": [
    {
      "name": "cleaned-data.csv",
      "content": "id,name,date\n1,Alice,2024-01-15...",
      "url": "https://files.stewrd.dev/abc123/cleaned-data.csv"
    }
  ]
}

Response File Object

FieldTypeDescription
namestringFile name
contentstringFile contents as a string
urlstring?Download URL (when available)
File URLs are temporary and expire after 24 hours. Download or store files you need to keep.