Sample - Box Platform API
POST/folders/{folder_id}/metadata/{scope}/{template_key}

Create a metadata instance on a folder

Creates a metadata instance on a folder using the specified metadata template. Supply folder_id, scope, and template_key, and include values accepted by the template; the global.properties template accepts arbitrary key-value pairs. The folder must not already have an instance of the selected template.

  • RetriesRetries up to 2×, 500ms backoff, 30s timeout.

3 parameters
folder_idstringrequired
The unique identifier of the folder to apply the metadata template to.
scopestringrequired
The metadata template scope: global or enterprise.
Allowed:globalenterprise
template_keystringrequired
The name of the metadata template to apply.

5 status codes
201Returns the newly applied metadata instance, including the metadata values stored on the folder.
$parentstringoptional
The identifier of the item that this metadata instance has been attached to. This combines the `type` and the `id` of the parent in the form `{type}_{id}`.
$templatestringoptional
The name of the template.
$scopestringoptional
An ID for the scope in which this template has been applied. This will be `enterprise_{enterprise_id}` for templates defined for use in this enterprise, and `global` for general templates that are available to all enterprises using Box.
$versionintegeroptional
The version of the metadata instance. This version starts at 0 and increases every time a user-defined property is modified.
$canEditbooleanoptional
Whether the user can edit this metadata instance.
$idstringoptional
A UUID to identify the metadata instance.
$typestringoptional
A unique identifier for the "type" of this instance. This is an internal system property and should not be used by a client application.
$typeVersionintegeroptional
The last-known version of the template of the object. This is an internal system property and should not be used by a client application.
400Returned when the request body is invalid or contains a field or value that does not match the metadata template schema.
codestringoptional
A Box-specific error code.
messagestringoptional
A short message describing the error.
request_idstringoptional
A unique identifier for this response, which can be used when contacting Box support.
404Returned when the folder or metadata template does not exist, or the authenticated user cannot access the folder.
typestringoptional
The value will always be `error`.
Allowed:error
statusintegeroptional
The HTTP status of the response.
codestringoptional
A Box-specific error code.
Allowed:createdacceptedno_contentredirectnot_modifiedbad_requestunauthorizedforbiddennot_foundmethod_not_allowedconflictprecondition_failed
messagestringoptional
A short message describing the error.
context_infoobjectoptional
A free-form object that contains additional context about the error. The possible fields are defined on a per-endpoint basis. `message` is only one example.
help_urlstringoptional
A URL that links to more information about why this error occurred.
request_idstringoptional
A unique identifier for this response, which can be used when contacting Box support.
409Returned when an instance of the selected metadata template already exists on the folder.
codestringoptional
A Box-specific error code.
messagestringoptional
A short message describing the error.
request_idstringoptional
A unique identifier for this response, which can be used when contacting Box support.
defaultReturned for an unexpected client error.
typestringoptional
The value will always be `error`.
Allowed:error
statusintegeroptional
The HTTP status of the response.
codestringoptional
A Box-specific error code.
Allowed:createdacceptedno_contentredirectnot_modifiedbad_requestunauthorizedforbiddennot_foundmethod_not_allowedconflictprecondition_failed
messagestringoptional
A short message describing the error.
context_infoobjectoptional
A free-form object that contains additional context about the error. The possible fields are defined on a per-endpoint basis. `message` is only one example.
help_urlstringoptional
A URL that links to more information about why this error occurred.
request_idstringoptional
A unique identifier for this response, which can be used when contacting Box support.

Error handling

A 400 is returned when the request body contains an unknown field or a value that does not match the metadata template schema. A 404 is returned when folder_id or the metadata template cannot be found, or when the authenticated user cannot access the folder. A 409 is returned when the selected metadata template is already applied to the folder.