Files

List a Pen's files

The files of the saved head, with content.

get/v2/pens/{id}/files

Request

  • Base URL
    https://api.codepen.io
  • Auth
    • HTTP bearer
    • or API key in header X-API-Key

Response

The files.

bytesinteger required
contentstring nullable required

Null for binary files, which are read from url.

content_hashstring required
content_typestring required

The media type the file is served with, from its extension.

download_urlstring uri nullable required

The file's exact bytes for anyone holding the URL, on the API host (GET /v2/pens/{id}/download/{path}), for one hour from this response: no API key, session or Referer needed. Served as an attachment with the file's content_type. A new URL comes with every read; an expired one answers 403. Null for the files of a Pen made in the classic editor.

idstring required

Stable across versions, renames and edits.

is_binaryboolean required
namestring required
pathstring required
urlstring uri nullable required

Where the file is served raw on the Pen's content domain. It follows the Pen's own access rules: a Private, Protected or Collaborators Pen needs a browser session and a Pen owned by a Free account needs a CodePen Referer, neither of which an API client has, so read files through content or download_url. Null for the files of a Pen made in the classic editor.

Example response

[
  {
    "name": "app.js",
    "path": "/src/app.js"
  }
]

Changes

No recorded changes to this operation across all 1 revision of this API.