Skip to content

Commit 7cc191e

Browse files
authored
Merge pull request #22 from tscircuit/codex/add-documentation-for-binary-file-upload
docs: document binary file uploads
2 parents 0aa94eb + 004dedd commit 7cc191e

1 file changed

Lines changed: 28 additions & 0 deletions

File tree

README.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,34 @@ The returned file will contain either `text_content` or `binary_content_b64`.
6464
Provide either `text_content` for text files or `binary_content_b64` for
6565
binary data. The response will include whichever field was supplied.
6666

67+
#### Add Binary Files
68+
69+
To upload binary assets (for example, images or compiled artifacts) encode the
70+
file contents as Base64 and provide them via the `binary_content_b64` field.
71+
72+
```http
73+
POST /files/upsert
74+
Content-Type: application/json
75+
76+
{
77+
"file_path": "assets/logo.png",
78+
"binary_content_b64": "iVBORw0KGgoAAAANSUhEUgAA..."
79+
}
80+
81+
Response: {
82+
"file": {
83+
"file_id": "42",
84+
"file_path": "assets/logo.png",
85+
"binary_content_b64": "iVBORw0KGgoAAAANSUhEUgAA...",
86+
"created_at": "2024-01-01T00:00:00.000Z"
87+
}
88+
}
89+
```
90+
91+
The server persists the binary payload exactly as provided. When retrieving the
92+
file with `/files/get`, the same `binary_content_b64` string will be returned
93+
and can be decoded back to the original bytes in your client code.
94+
6795
#### Get File
6896

6997
```http

0 commit comments

Comments
 (0)