v1

latestOpenAPI 3.0.2Apache-2.02026-07-142963051.0 MB
Metadata templates

Create metadata template

Creates a new metadata template that can be applied to files and folders.

post/metadata_templates/schema

Request body

scopestring required

The scope of the metadata template to create. Applications can only create templates for use within the authenticated user's enterprise.

This value needs to be set to enterprise, as global scopes can not be created by applications.

templateKeystring

A unique identifier for the template. This identifier needs to be unique across the enterprise for which the metadata template is being created.

When not provided, the API will create a unique templateKey based on the value of the displayName.

displayNamestring required

The display name of the template.

hiddenboolean

Defines if this template is visible in the Box web app UI, or if it is purely intended for usage through the API.

copyInstanceOnItemCopyboolean

Whether or not to copy any metadata attached to a file or folder when it is copied. By default, metadata is not copied along with a file or folder when it is copied.

Example request

{
  "scope": "enterprise",
  "templateKey": "productInfo",
  "displayName": "Product Info",
  "hidden": true,
  "fields": [
    {
      "type": "string",
      "key": "category",
      "displayName": "Category",
      "description": "The category",
      "hidden": true,
      "options": [
        {
          "key": "Category 1"
        }
      ],
      "taxonomyKey": "locationTaxonomy",
      "taxonomyId": "05ece6d7-fec4-4d3f-bfd2-36fd4dddea97",
      "namespace": "enterprise_123456",
      "optionsRules": {
        "multiSelect": true,
        "selectableLevels": [
          1,
          2
        ]
      }
    }
  ],
  "copyInstanceOnItemCopy": true
}

Response

The schema representing the metadata template created.

idstring required

The ID of the metadata template.

type'metadata_template' required

The value will always be metadata_template.

scopestring

The scope of the metadata template can either be global or enterprise_*. The global scope is used for templates that are available to any Box enterprise. The enterprise_* scope represents templates that have been created within a specific enterprise, where * will be the ID of that enterprise.

templateKeystring

A unique identifier for the template. This identifier is unique across the scope of the enterprise to which the metadata template is being applied, yet is not necessarily unique across different enterprises.

displayNamestring

The display name of the template. This can be seen in the Box web app and mobile apps.

hiddenboolean

Defines if this template is visible in the Box web app UI, or if it is purely intended for usage through the API.

copyInstanceOnItemCopyboolean

Whether or not to include the metadata when a file or folder is copied.

Example response

{
  "id": "58063d82-4128-7b43-bba9-92f706befcdf",
  "type": "metadata_template",
  "scope": "enterprise_123456",
  "templateKey": "productInfo",
  "displayName": "Product Info",
  "hidden": true,
  "fields": [
    {
      "type": "string",
      "key": "category",
      "displayName": "Category",
      "description": "The category",
      "hidden": true,
      "options": [
        {
          "key": "Category 1",
          "id": "45dc2849-a4a7-40a9-a751-4a699a589190"
        }
      ],
      "taxonomyKey": "locationTaxonomy",
      "taxonomyId": "05ece6d7-fec4-4d3f-bfd2-36fd4dddea97",
      "namespace": "enterprise_123456",
      "optionsRules": {
        "multiSelect": true,
        "selectableLevels": [
          1,
          2
        ]
      },
      "id": "822227e0-47a5-921b-88a8-494760b2e6d2"
    }
  ],
  "copyInstanceOnItemCopy": true
}