Skip to main content
Create Sub-Collection
Creates a new named sub-collection under the specified parent collection. Returns 400 if the parent collection doesn’t exist or isn’t one of the user’s own collections.

Path Parameters

string
required
The ID of the parent collection. Use the root collection’s ID to create a top-level folder.

Body Parameters

string
required
The name for the new collection. Trimmed; must be 1 to 255 characters after trimming.
string
Service key only, and required with one: the user this request acts as. Must own the parent collection; the new collection belongs to them. A user token always acts as its own user and must not send it (400 collection/acting-user-not-allowed).

Response

Returns the newly created Collection object with status 201. Its entityCount is 0.

Error Responses

Returned when name is missing, blank after trimming, or longer than 255 characters. The error message names the offending field.
The request sent collectionName (in the body or the query). The collection’s name is name.
A service key sent no actingUserId.
A user token sent actingUserId, even naming its own user. Only a service key names the user it acts as; a user token always acts as its own user.
Returned when a service key names an actingUserId that isn’t a user in this project.
The request sent userId. On this route the user a service key acts as is actingUserId.With a service key:
With a user token, or with no credentials: