Skip to main content
POST
cURL

Authorizations

Authorization
string
header
required

Paste your API key as the CMS showed it: fsk_<site>_<key id>_<secret> (issued under API Keys). ApiKey in front of it works too. Leave it empty to read as the public.

Scopes

content:files:write

Query Parameters

aposMode
enum<string>
default:published

published (the default) or draft. Drafts need a credential that may see them: an API key with the type’s write scope (content:<type>:write), or a signed-in editor. The public and a key with only the read scope get 403.

Available options:
draft,
published
aposLocale
string

The locale to read or write, e.g. en (default: the site’s default locale).

Example:

"fr"

Body

application/json

Built-in file piece type for general file uploads (PDFs, documents, etc.)

title
string | null

File title/description

Example:

"Company Brochure"

slug
string

Its URL name: lowercase words joined by hyphens.

Example:

"company-brochure"

archived
boolean | null
default:false

In the archive: kept, but out of every list and off the site until it is restored. false (or null) for a live document.

visibility
enum<string>
default:public

Who may see it on the site: public (everyone) or loginRequired (signed-in people only).

Available options:
public,
loginRequired
attachment
Attachment · object

The file itself: its URLs (_urls by size for an image, _url for another file), size and dimensions.

description
string | null

File description

copyOfId
string | null

The _id of the piece/page that was copied to create this document (only present if created via _copyingId)

Example:

"ckhdscx5900054z9k88uqs16w:en:published"

_folder
object[] | null

The media folder holding it (one at most; empty at the library’s root).

_tags
object[] | null

Its tags, as documents.

_url
string<uri> | null

The file’s URL (the attachment’s _url).

Response

File created successfully

Built-in file piece type for general file uploads (PDFs, documents, etc.)

_id
string
required
read-only

Unique identifier

Example:

"clx1234567890abcdef"

type
string
required
read-only
Example:

"@apostrophecms/file"

createdAt
string<date-time>
required
read-only
updatedAt
string<date-time>
required
read-only
title
string | null

File title/description

Example:

"Company Brochure"

slug
string

Its URL name: lowercase words joined by hyphens.

Example:

"company-brochure"

archived
boolean | null
default:false

In the archive: kept, but out of every list and off the site until it is restored. false (or null) for a live document.

visibility
enum<string>
default:public

Who may see it on the site: public (everyone) or loginRequired (signed-in people only).

Available options:
public,
loginRequired
attachment
Attachment · object

The file itself: its URLs (_urls by size for an image, _url for another file), size and dimensions.

description
string | null

File description

copyOfId
string | null

The _id of the piece/page that was copied to create this document (only present if created via _copyingId)

Example:

"ckhdscx5900054z9k88uqs16w:en:published"

_folder
object[] | null

The media folder holding it (one at most; empty at the library’s root).

_tags
object[] | null

Its tags, as documents.

_url
string<uri> | null

The file’s URL (the attachment’s _url).

aposShareKey
string | null
read-only

The draft’s preview share key, while its share link is on: the link is the draft’s _url with aposShareKey and aposShareId (the draft’s _id) in its query. Absent otherwise, and on published documents.

Example:

"k3v9x2m7q1z8w4p6"