http
PUT /projects/{project_reference}/files/{file_path}Create a file or replace its content. Requires project.files.write.
Servers
JSON
1[2 {3 "url": "https://api.veryfront.com"4 }5]Authentication
JSON
1[2 {3 "bearerAuth": []4 },5 {6 "apiKeyAuth": []7 }8]JSON
1{2 "bearerAuth": {3 "type": "http",4 "scheme": "bearer",5 "bearerFormat": "JWT or API Key",6 "description": "Use a JWT bearer token or a Veryfront API key in the `Authorization` header."7 },8 "apiKeyAuth": {9 "type": "apiKey",10 "in": "header",11 "name": "X-API-Key",12 "description": "Alternative API key header for `vf_<prefix>_<secret>` tokens."13 }14}Parameters
| Name | Location | Required | Description |
|---|---|---|---|
| project_reference | path | Yes | |
| file_path | path | Yes | |
| ref | query | No | |
| branch | query | No | |
| branch_id | query | No |
Parameter contracts
JSON
1[2 {3 "schema": {4 "type": "string",5 "description": "Project slug, UUID, or domain"6 },7 "required": true,8 "name": "project_reference",9 "in": "path"10 },11 {12 "schema": {13 "type": "string",14 "description": "File path (URL-encoded, for example, pages%2Findex.mdx)."15 },16 "required": true,17 "name": "file_path",18 "in": "path"19 },20 {21 "schema": {22 "type": "string",23 "description": "Mutable content to address: main or branch:<name-or-id>. Omit for main. Release and environment selectors return 400. Supplied aliases must name the same content.",24 "example": "branch:feature-x"25 },26 "required": false,27 "name": "ref",28 "in": "query"29 },30 {31 "schema": {32 "type": "string",33 "description": "Branch name or ID; legacy alias for ref=branch:<value>. Supplied aliases must agree."34 },35 "required": false,36 "name": "branch",37 "in": "query"38 },39 {40 "schema": {41 "type": "string",42 "format": "uuid",43 "description": "Branch UUID; legacy alias for ref=branch:<uuid>. Supplied aliases must agree."44 },45 "required": false,46 "name": "branch_id",47 "in": "query"48 }49]Request body
JSON
1{2 "content": {3 "application/json": {4 "schema": {5 "type": "object",6 "properties": {7 "content": {8 "type": "string",9 "description": "Replacement textual content in main or the selected branch, stored as a new immutable version. Source-file MIME type is not writable."10 },11 "expected_checksum": {12 "type": "string",13 "description": "Expected current checksum when updating an existing file; ignored on creation. Omission disables this guard."14 },15 "expected_version_id": {16 "type": "string",17 "description": "Expected current version ID when updating an existing file; ignored on creation. Omission disables this guard."18 },19 "metadata": {20 "type": "object",21 "additionalProperties": {},22 "description": "Optional durable file-version metadata for source provenance; service-owned visibility keys are rejected."23 },24 "expected_absent": {25 "type": "boolean",26 "description": "True requires absence atomically when creating; an existing file returns 409. False or omission retains upsert behavior."27 }28 },29 "required": [30 "content"31 ],32 "additionalProperties": false33 }34 }35 }36}Responses
200
File updated successfully
JSON
1{2 "description": "File updated successfully",3 "content": {4 "application/json": {5 "schema": {6 "type": "object",7 "properties": {8 "id": {9 "type": "string",10 "description": "Path-derived file identifier."11 },12 "file_id": {13 "type": "string",14 "description": "Alias for id; canonical file identifier committed by this write."15 },16 "path": {17 "type": "string",18 "description": "Normalized stored file path."19 },20 "content": {21 "type": "string",22 "description": "Text supplied by this write request."23 },24 "size": {25 "type": "number",26 "description": "Size of the file content encoded as UTF-8, in bytes."27 },28 "updated_at": {29 "type": "string",30 "description": "Response timestamp for the successful update."31 },32 "version_id": {33 "type": "string",34 "description": "Version ID the write produced."35 },36 "type": {37 "type": "string",38 "enum": [39 "page",40 "function",41 "component",42 "file"43 ],44 "description": "File kind: page, function, component or file."45 },46 "size_bytes": {47 "type": "number",48 "description": "Size of the content encoded as UTF-8, in bytes."49 },50 "checksum": {51 "type": [52 "string",53 "null"54 ],55 "description": "SHA-256 content hash, or null when unavailable."56 }57 },58 "required": [59 "id",60 "file_id",61 "path",62 "content",63 "size",64 "updated_at"65 ]66 }67 }68 }69}201
File created successfully
JSON
1{2 "description": "File created successfully",3 "content": {4 "application/json": {5 "schema": {6 "type": "object",7 "properties": {8 "id": {9 "type": "string",10 "description": "Path-derived file identifier."11 },12 "file_id": {13 "type": "string",14 "description": "Alias for id; canonical file identifier committed by this write."15 },16 "path": {17 "type": "string",18 "description": "Normalized stored file path."19 },20 "content": {21 "type": "string",22 "description": "Text supplied by this write request."23 },24 "size": {25 "type": "number",26 "description": "Size of the file content encoded as UTF-8, in bytes."27 },28 "created_at": {29 "type": "string",30 "description": "Response timestamp for successful creation."31 },32 "updated_at": {33 "type": "string",34 "description": "Same instant as created_at."35 },36 "version_id": {37 "type": "string",38 "description": "Version ID the write produced."39 },40 "type": {41 "type": "string",42 "enum": [43 "page",44 "function",45 "component",46 "file"47 ],48 "description": "File kind: page, function, component or file."49 },50 "size_bytes": {51 "type": "number",52 "description": "Size of the content encoded as UTF-8, in bytes."53 },54 "checksum": {55 "type": [56 "string",57 "null"58 ],59 "description": "SHA-256 content hash, or null when unavailable."60 }61 },62 "required": [63 "id",64 "file_id",65 "path",66 "content",67 "size",68 "created_at"69 ]70 }71 }72 }73}400
Bad request
JSON
1{2 "description": "Bad request",3 "content": {4 "application/problem+json": {5 "schema": {6 "$ref": "#/components/schemas/Problem"7 }8 }9 }10}401
Unauthorized
JSON
1{2 "description": "Unauthorized",3 "content": {4 "application/problem+json": {5 "schema": {6 "$ref": "#/components/schemas/Problem"7 }8 }9 }10}403
Forbidden
JSON
1{2 "description": "Forbidden",3 "content": {4 "application/problem+json": {5 "schema": {6 "$ref": "#/components/schemas/Problem"7 }8 }9 }10}404
Not found
JSON
1{2 "description": "Not found",3 "content": {4 "application/problem+json": {5 "schema": {6 "$ref": "#/components/schemas/Problem"7 }8 }9 }10}409
Conflict
JSON
1{2 "description": "Conflict",3 "content": {4 "application/problem+json": {5 "schema": {6 "$ref": "#/components/schemas/Problem"7 }8 }9 }10}500
Server error
JSON
1{2 "description": "Server error",3 "content": {4 "application/problem+json": {5 "schema": {6 "$ref": "#/components/schemas/Problem"7 }8 }9 }10}Referenced contracts
components/schemas/Problem
JSON
1{2 "type": "object",3 "properties": {4 "cause": {5 "type": "string",6 "enum": [7 "schedule_concurrency_forbidden",8 "schedule_fire_in_progress",9 "schedule_run_limit_reached"10 ],11 "description": "Schedule admission refusal."12 },13 "idempotency": {14 "type": "object",15 "properties": {16 "state": {17 "type": "string",18 "enum": [19 "in_progress",20 "payload_mismatch",21 "outcome_unknown"22 ]23 },24 "operation": {25 "type": "string",26 "minLength": 127 },28 "retryable": {29 "type": "boolean"30 },31 "retry_after_seconds": {32 "type": [33 "integer",34 "null"35 ],36 "minimum": 037 },38 "expires_at": {39 "type": [40 "string",41 "null"42 ]43 },44 "recovery": {45 "type": "object",46 "properties": {47 "available": {48 "type": "boolean"49 },50 "description": {51 "type": "string"52 },53 "resource_url": {54 "type": "string"55 }56 },57 "required": [58 "available",59 "description"60 ]61 }62 },63 "required": [64 "state",65 "operation",66 "retryable",67 "retry_after_seconds",68 "expires_at"69 ],70 "description": "Replay status, retry timing, and recovery lookup."71 },72 "type": {73 "type": "string",74 "description": "URI reference identifying the problem type",75 "example": "https://api.veryfront.com/errors/validation-failed"76 },77 "title": {78 "type": "string",79 "description": "Short human-readable summary of the problem",80 "example": "Validation Failed"81 },82 "status": {83 "type": "integer",84 "minimum": 100,85 "maximum": 599,86 "description": "HTTP status code",87 "example": 40088 },89 "code": {90 "type": "string",91 "description": "Stable machine-readable error code",92 "example": "RUN_INVALID_INPUT"93 },94 "detail": {95 "type": "string",96 "description": "Human-readable explanation specific to this occurrence",97 "example": "The 'email' field must be a valid email address"98 },99 "instance": {100 "type": "string",101 "description": "URI reference identifying the specific occurrence",102 "example": "/projects/my-project/members"103 },104 "slug": {105 "type": "string",106 "description": "Stable identifier for the problem type",107 "example": "validation-failed"108 },109 "category": {110 "type": "string",111 "enum": [112 "AUTH",113 "RESOURCE",114 "VALIDATION",115 "DATABASE",116 "SUBSCRIPTION",117 "INTEGRATION",118 "INTERNAL"119 ],120 "description": "API error category",121 "example": "VALIDATION"122 },123 "suggestion": {124 "type": "string",125 "description": "Suggested action to resolve the problem",126 "example": "Check the request body and query parameters against the API documentation."127 },128 "errors": {129 "type": "array",130 "items": {131 "type": "object",132 "properties": {133 "field": {134 "type": "string",135 "description": "Field path that caused the error",136 "example": "email"137 },138 "message": {139 "type": "string",140 "description": "Error message for this field",141 "example": "Invalid email format"142 },143 "code": {144 "type": "string",145 "description": "Error code for this field",146 "example": "INVALID_FORMAT"147 }148 },149 "required": [150 "field",151 "message"152 ]153 },154 "description": "Detailed field-level errors for validation failures"155 }156 },157 "required": [158 "type",159 "title",160 "status"161 ]162}Operation contract
JSON
1{2 "operationId": "writeFile",3 "tags": [4 "projects/Files/Files"5 ],6 "summary": "Write file",7 "description": "Create a file or replace its content. Requires project.files.write.",8 "parameters": [9 {10 "schema": {11 "type": "string",12 "description": "Project slug, UUID, or domain"13 },14 "required": true,15 "name": "project_reference",16 "in": "path"17 },18 {19 "schema": {20 "type": "string",21 "description": "File path (URL-encoded, for example, pages%2Findex.mdx)."22 },23 "required": true,24 "name": "file_path",25 "in": "path"26 },27 {28 "schema": {29 "type": "string",30 "description": "Mutable content to address: main or branch:<name-or-id>. Omit for main. Release and environment selectors return 400. Supplied aliases must name the same content.",31 "example": "branch:feature-x"32 },33 "required": false,34 "name": "ref",35 "in": "query"36 },37 {38 "schema": {39 "type": "string",40 "description": "Branch name or ID; legacy alias for ref=branch:<value>. Supplied aliases must agree."41 },42 "required": false,43 "name": "branch",44 "in": "query"45 },46 {47 "schema": {48 "type": "string",49 "format": "uuid",50 "description": "Branch UUID; legacy alias for ref=branch:<uuid>. Supplied aliases must agree."51 },52 "required": false,53 "name": "branch_id",54 "in": "query"55 }56 ],57 "requestBody": {58 "content": {59 "application/json": {60 "schema": {61 "type": "object",62 "properties": {63 "content": {64 "type": "string",65 "description": "Replacement textual content in main or the selected branch, stored as a new immutable version. Source-file MIME type is not writable."66 },67 "expected_checksum": {68 "type": "string",69 "description": "Expected current checksum when updating an existing file; ignored on creation. Omission disables this guard."70 },71 "expected_version_id": {72 "type": "string",73 "description": "Expected current version ID when updating an existing file; ignored on creation. Omission disables this guard."74 },75 "metadata": {76 "type": "object",77 "additionalProperties": {},78 "description": "Optional durable file-version metadata for source provenance; service-owned visibility keys are rejected."79 },80 "expected_absent": {81 "type": "boolean",82 "description": "True requires absence atomically when creating; an existing file returns 409. False or omission retains upsert behavior."83 }84 },85 "required": [86 "content"87 ],88 "additionalProperties": false89 }90 }91 }92 },93 "responses": {94 "200": {95 "description": "File updated successfully",96 "content": {97 "application/json": {98 "schema": {99 "type": "object",100 "properties": {101 "id": {102 "type": "string",103 "description": "Path-derived file identifier."104 },105 "file_id": {106 "type": "string",107 "description": "Alias for id; canonical file identifier committed by this write."108 },109 "path": {110 "type": "string",111 "description": "Normalized stored file path."112 },113 "content": {114 "type": "string",115 "description": "Text supplied by this write request."116 },117 "size": {118 "type": "number",119 "description": "Size of the file content encoded as UTF-8, in bytes."120 },121 "updated_at": {122 "type": "string",123 "description": "Response timestamp for the successful update."124 },125 "version_id": {126 "type": "string",127 "description": "Version ID the write produced."128 },129 "type": {130 "type": "string",131 "enum": [132 "page",133 "function",134 "component",135 "file"136 ],137 "description": "File kind: page, function, component or file."138 },139 "size_bytes": {140 "type": "number",141 "description": "Size of the content encoded as UTF-8, in bytes."142 },143 "checksum": {144 "type": [145 "string",146 "null"147 ],148 "description": "SHA-256 content hash, or null when unavailable."149 }150 },151 "required": [152 "id",153 "file_id",154 "path",155 "content",156 "size",157 "updated_at"158 ]159 }160 }161 }162 },163 "201": {164 "description": "File created successfully",165 "content": {166 "application/json": {167 "schema": {168 "type": "object",169 "properties": {170 "id": {171 "type": "string",172 "description": "Path-derived file identifier."173 },174 "file_id": {175 "type": "string",176 "description": "Alias for id; canonical file identifier committed by this write."177 },178 "path": {179 "type": "string",180 "description": "Normalized stored file path."181 },182 "content": {183 "type": "string",184 "description": "Text supplied by this write request."185 },186 "size": {187 "type": "number",188 "description": "Size of the file content encoded as UTF-8, in bytes."189 },190 "created_at": {191 "type": "string",192 "description": "Response timestamp for successful creation."193 },194 "updated_at": {195 "type": "string",196 "description": "Same instant as created_at."197 },198 "version_id": {199 "type": "string",200 "description": "Version ID the write produced."201 },202 "type": {203 "type": "string",204 "enum": [205 "page",206 "function",207 "component",208 "file"209 ],210 "description": "File kind: page, function, component or file."211 },212 "size_bytes": {213 "type": "number",214 "description": "Size of the content encoded as UTF-8, in bytes."215 },216 "checksum": {217 "type": [218 "string",219 "null"220 ],221 "description": "SHA-256 content hash, or null when unavailable."222 }223 },224 "required": [225 "id",226 "file_id",227 "path",228 "content",229 "size",230 "created_at"231 ]232 }233 }234 }235 },236 "400": {237 "description": "Bad request",238 "content": {239 "application/problem+json": {240 "schema": {241 "$ref": "#/components/schemas/Problem"242 }243 }244 }245 },246 "401": {247 "description": "Unauthorized",248 "content": {249 "application/problem+json": {250 "schema": {251 "$ref": "#/components/schemas/Problem"252 }253 }254 }255 },256 "403": {257 "description": "Forbidden",258 "content": {259 "application/problem+json": {260 "schema": {261 "$ref": "#/components/schemas/Problem"262 }263 }264 }265 },266 "404": {267 "description": "Not found",268 "content": {269 "application/problem+json": {270 "schema": {271 "$ref": "#/components/schemas/Problem"272 }273 }274 }275 },276 "409": {277 "description": "Conflict",278 "content": {279 "application/problem+json": {280 "schema": {281 "$ref": "#/components/schemas/Problem"282 }283 }284 }285 },286 "500": {287 "description": "Server error",288 "content": {289 "application/problem+json": {290 "schema": {291 "$ref": "#/components/schemas/Problem"292 }293 }294 }295 }296 },297 "x-documentation-source-tag": "Project Files",298 "x-canonical-documentation": {299 "domain": "projects",300 "resource": "Files",301 "subgroup": "Files",302 "name": "Write file",303 "description": "Create a file or replace its content. Requires project.files.write.",304 "operationId": "writeFile"305 },306 "x-mint": {307 "href": "/cloud/rest/api-reference/projects-files-files/write-file"308 }309}