Skip to main content
POST
/
files
Write file
curl --request POST \
  --url https://api.openfiles.ai/functions/v1/api/files \
  --header 'Content-Type: application/json' \
  --header 'x-api-key: <api-key>' \
  --data '{
  "path": "src/app.py",
  "content": "print('\''Hello World'\'')",
  "contentType": "text/x-python",
  "isBase64": false
}'
{
  "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"
}

Authorizations

x-api-key
string
header
required

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

Body

application/json
path
string
required
Minimum length: 1
Example:

"src/app.py"

content
string
required
Maximum length: 10485760
Example:

"print('Hello World')"

contentType
enum<string>

MIME type of the file content. Must be one of the supported types.

Available options:
text/markdown,
text/plain,
text/javascript,
text/typescript,
application/json,
text/html,
text/css,
text/x-python,
text/x-java-source,
text/x-c++src,
text/x-csrc,
application/xml,
application/yaml,
text/csv,
image/jpeg,
image/png,
image/gif,
image/webp,
image/bmp,
image/svg+xml,
application/pdf,
application/zip,
audio/mpeg,
video/mp4,
video/x-msvideo,
video/quicktime,
application/octet-stream
Example:

"text/x-python"

isBase64
boolean
default:false

Response

Success

success
boolean
required
Example:

true

data
object
required
operation
string
required
Example:

"write_file"

message
string
required
Example:

"File created successfully, version 1"

⌘I