Files
Delete one file or a directory
A directory path deletes every file under it. The answer is the new version, not 204. Deleting by id goes through PUT /v2/pens/{id}/files with { "id": "...", "delete": true }.
delete/v2/pens/{id}/files/{path}
Request
- Base URLhttps://api.codepen.io
- Auth
- HTTP bearer
- or API key in header X-API-Key
Query parameters
waitinteger
Seconds to wait for the build (default 45, at most 75; 0 answers as soon as the files are saved). A wait in the JSON body takes precedence.
dry_runboolean
Build the proposed files without saving them: the head does not move and the answer's version has saved: false. A dry_run in the JSON body takes precedence.
expected_version_idstring
The saved_version.id the change was built on. The write is refused with 409 if the Pen's head has moved since.
Response
The Pen, the newest version the write produced with its files, and that version's build.
Example response
{
"build": {
"files": [
{
"name": "app.js",
"path": "/src/app.js"
}
]
},
"pen": {
"build": {
"files": [
{
"name": "app.js",
"path": "/src/app.js"
}
]
},
"saved_version": {
"build": {
"files": [
{
"name": "app.js",
"path": "/src/app.js"
}
]
},
"files": [
{
"name": "app.js",
"path": "/src/app.js"
}
]
}
},
"version": {
"build": {
"files": [
{
"name": "app.js",
"path": "/src/app.js"
}
]
},
"files": [
{
"name": "app.js",
"path": "/src/app.js"
}
]
}
}Changes
No recorded changes to this operation across all 1 revision of this API.