> ## Documentation Index
> Fetch the complete documentation index at: https://developer.box.com/llms.txt
> Use this file to discover all available pages before exploring further.

# List all metadata templates

export const Link = ({href, children, className, ...props}) => {
  const localizedHref = href;
  return <a href={localizedHref} className={className} {...props}>
      {children}
    </a>;
};

export const MultiRelatedLinks = ({sections = []}) => {
  if (!sections || sections.length === 0) {
    return null;
  }
  return <div className="space-y-8">
      {sections.map((section, index) => <RelatedLinks key={index} title={section.title} items={section.items} />)}
    </div>;
};

export const RelatedLinks = ({title, items = []}) => {
  const getBadgeClass = badge => {
    if (!badge) return "badge-default";
    const badgeType = badge.toLowerCase().replace(/\s+/g, "-");
    return `badge-${badge === "ガイド" ? "guide" : badgeType}`;
  };
  if (!items || items.length === 0) {
    return null;
  }
  return <div className="my-8">
      {}
      <h3 className="text-sm font-bold uppercase tracking-wider mb-4">{title}</h3>

      {}
      <div className="flex flex-col gap-3">
        {items.map((item, index) => <a key={index} href={item.href} className="py-2 px-3 rounded related_link hover:bg-[#f2f2f2] dark:hover:bg-[#111827] flex items-center gap-3 group no-underline hover:no-underline border-b-0">
            {}
            <span className={`px-2 py-1 rounded-full text-xs font-semibold uppercase tracking-wide flex-shrink-0 ${getBadgeClass(item.badge)}`}>
              {item.badge}
            </span>

            {}
            <span className="text-base">{item.label}</span>
          </a>)}
      </div>
    </div>;
};

export const ProgressBar = ({pages = [], ...props}) => {
  const [currentStep, setCurrentStep] = useState(0);
  const [isDarkMode, setIsDarkMode] = useState(false);
  useEffect(() => {
    const checkDarkMode = () => {
      const isDark = document.documentElement.classList.contains('dark');
      console.log('ProgressBar - isDarkMode:', isDark);
      setIsDarkMode(isDark);
    };
    checkDarkMode();
    const observer = new MutationObserver(() => {
      checkDarkMode();
    });
    observer.observe(document.documentElement, {
      attributes: true,
      attributeFilter: ['class']
    });
    return () => {
      observer.disconnect();
    };
  }, []);
  useEffect(() => {
    if (pages.length > 0) {
      const currentPath = window.location.pathname;
      const stepIndex = pages.findIndex(page => {
        const pagePath = page.startsWith('/') ? page : `/${page}`;
        return currentPath.endsWith(pagePath) || currentPath.includes(pagePath);
      });
      if (stepIndex !== -1) {
        setCurrentStep(stepIndex + 1);
      }
    }
  }, [pages]);
  if (!pages || pages.length === 0) {
    return null;
  }
  const step = currentStep;
  const total = pages.length;
  console.log('ProgressBar - Rendering with isDarkMode:', isDarkMode);
  const progressBarContainerStyle = {
    width: '100%',
    marginBottom: '32px',
    display: 'flex',
    alignItems: 'center',
    gap: '16px'
  };
  const stepsContainerStyle = {
    display: 'flex',
    alignItems: 'center',
    gap: '8px',
    flexShrink: 0
  };
  const progressBarTrackStyle = {
    flex: 1,
    height: '22px',
    backgroundColor: 'rgba(169, 210, 244, 0.06)',
    border: isDarkMode ? '1px solid rgba(230, 241, 247, 0.67)' : '1px solid #e3ecf3',
    borderRadius: '4px',
    overflow: 'hidden',
    position: 'relative'
  };
  const progressBarFillStyle = {
    height: '100%',
    backgroundColor: 'rgba(113, 192, 248, 0.23)',
    width: `${step / total * 100}%`,
    transition: 'width 0.3s ease'
  };
  const getStepStyle = (stepNumber, isActive) => {
    if (isDarkMode) {
      return {
        width: '22px',
        height: '22px',
        borderRadius: '4px',
        display: 'flex',
        alignItems: 'center',
        justifyContent: 'center',
        fontSize: '12px',
        fontWeight: '600',
        position: 'relative',
        zIndex: 1,
        transition: 'all 0.3s ease',
        backgroundColor: isActive ? 'rgba(113, 192, 248, 0.23)' : 'transparent',
        color: isActive ? '#60a5fa' : '#a0aec0',
        border: isActive ? '1px solid #e3ecf3' : '1px solid #e0e6eb',
        cursor: 'pointer',
        textDecoration: 'none'
      };
    }
    if (isActive) {
      return {
        width: '22px',
        height: '22px',
        borderRadius: '4px',
        display: 'flex',
        alignItems: 'center',
        justifyContent: 'center',
        fontSize: '12px',
        fontWeight: '600',
        position: 'relative',
        zIndex: 1,
        transition: 'all 0.3s ease',
        backgroundColor: 'rgba(169, 210, 244, 0.32)',
        color: '#374151',
        border: '1px solid #e1eef8',
        cursor: 'pointer',
        textDecoration: 'none'
      };
    }
    return {
      width: '22px',
      height: '22px',
      borderRadius: '4px',
      display: 'flex',
      alignItems: 'center',
      justifyContent: 'center',
      fontSize: '12px',
      fontWeight: '600',
      position: 'relative',
      zIndex: 1,
      transition: 'all 0.3s ease',
      backgroundColor: '#fbfbfb',
      color: '#9ca3af',
      border: '1px solid #e3ecf3',
      cursor: 'pointer',
      textDecoration: 'none'
    };
  };
  return <div style={progressBarContainerStyle} {...props}>
      <div style={stepsContainerStyle}>
        {Array.from({
    length: total
  }, (_, index) => {
    const stepNumber = index + 1;
    const pageIndex = index;
    const pagePath = pages[pageIndex];
    const fullPath = pagePath.startsWith('/') ? pagePath : `/${pagePath}`;
    const isActive = stepNumber === step;
    return <a key={stepNumber} href={fullPath} style={getStepStyle(stepNumber, isActive)}>
              {stepNumber}
            </a>;
  })}
      </div>
      <div style={progressBarTrackStyle}>
        <div style={progressBarFillStyle}></div>
      </div>
    </div>;
};

<ProgressBar
  pages={[
                      "guides/metadata/quick-start/list-all",
                      "guides/metadata/quick-start/create-template",
                      "guides/metadata/quick-start/create-instance",
                      "guides/metadata/quick-start/update-instance",
                      "guides/metadata/quick-start/update-template",
                      "guides/metadata/quick-start/create-query",
                      "guides/metadata/quick-start/next-steps"
                    ]}
/>

It's likely your enterprise already has a list of metadata templates that you
can use right off-the-shelve without having to create your own.

In general, metadata templates are either available to only your enterprise or
to every enterprise using Box. The `scope` of a template defines if a template
is available to everyone (`global`) or only to your enterprise (`enterprise`).

<Card href="/guides/metadata/scopes" arrow title="Learn more about metadata scopes" />

## Listing templates

A few <Link href="/reference/get-metadata-templates-global">global templates</Link> are available to all
customers.

<CodeGroup>
  ```sh cURL theme={null}
  curl -i -X GET "https://api.box.com/2.0/metadata_templates/global" \
       -H "authorization: Bearer <ACCESS_TOKEN>"
  ```

  ```typescript Node/TypeScript v10 theme={null}
  await client.metadataTemplates.getGlobalMetadataTemplates();
  ```

  ```python Python v10 theme={null}
  client.metadata_templates.get_global_metadata_templates()
  ```

  ```csharp .NET v10 theme={null}
  await client.MetadataTemplates.GetGlobalMetadataTemplatesAsync();
  ```

  ```swift Swift v10 theme={null}
  try await client.metadataTemplates.getGlobalMetadataTemplates()
  ```

  ```java Java v10 theme={null}
  client.getMetadataTemplates().getGlobalMetadataTemplates()
  ```

  ```java Java v5 theme={null}
  Iterable<MetadataTemplate> templates = MetadataTemplate.getEnterpriseMetadataTemplates('global', api);
  for (MetadataTemplate templateInfo : templates) {
      // Do something with the metadata template.
  }
  ```

  ```py Python v4 theme={null}
  templates = client.get_metadata_templates(scope='global)
  for template in templates:
      print(f'Metadata template {template.templateKey} is in global scope')
  ```

  ```csharp .NET v6 theme={null}
  BoxEnterpriseMetadataTemplateCollection<BoxMetadataTemplate> templates = await client.MetadataManager
      .GetEnterpriseMetadataAsync("global");
  ```

  ```js Node v4 theme={null}
  client.metadata.getTemplates('global')
   .then(templates => {
    // ...
   });
  ```
</CodeGroup>

Many of these templates are for Box's internal use, yet your application can use
and apply these. More useful are templates <Link href="/reference/get-metadata-templates-enterprise">created by applications and admins
within your enterprise</Link> to hold data
specific to your enterprise's needs.

<CodeGroup>
  ```sh cURL theme={null}
  curl -i -X GET "https://api.box.com/2.0/metadata_templates/enterprise" \
       -H "authorization: Bearer <ACCESS_TOKEN>"
  ```

  ```typescript Node/TypeScript v10 theme={null}
  await client.metadataTemplates.getEnterpriseMetadataTemplates();
  ```

  ```python Python v10 theme={null}
  client.metadata_templates.get_enterprise_metadata_templates()
  ```

  ```csharp .NET v10 theme={null}
  await client.MetadataTemplates.GetEnterpriseMetadataTemplatesAsync();
  ```

  ```swift Swift v10 theme={null}
  try await client.metadataTemplates.getEnterpriseMetadataTemplates()
  ```

  ```java Java v10 theme={null}
  client.getMetadataTemplates().getEnterpriseMetadataTemplates()
  ```

  ```java Java v5 theme={null}
  Iterable<MetadataTemplate> templates = MetadataTemplate.getEnterpriseMetadataTemplates(api);
  for (MetadataTemplate templateInfo : templates) {
      // Do something with the metadata template.
  }
  ```

  ```py Python v4 theme={null}
  templates = client.get_metadata_templates()
  for template in templates:
      print(f'Metadata template {template.templateKey} is in enterprise scope')
  ```

  ```csharp .NET v6 theme={null}
  BoxEnterpriseMetadataTemplateCollection<BoxMetadataTemplate> templates = await client.MetadataManager
      .GetEnterpriseMetadataAsync();
  ```

  ```js Node v4 theme={null}
  client.metadata.getTemplates('enterprise')
   .then(templates => {
    /* templates -> {
     limit: 100,
     entries: 
     [ { templateKey: 'documentFlow',
      scope: 'enterprise_12345',
      displayName: 'Document Flow',
      hidden: false,
      fields: 
       [ { type: 'string',
        key: 'currentDocumentStage',
        displayName: 'Current Document Stage',
        hidden: false }
       { type: 'string',
        key: 'needsApprovalFrom',
        displayName: 'Needs Approval From',
        hidden: false },
       { type: 'string',
        key: 'nextDocumentStage',
        displayName: 'Next Document Stage',
        hidden: false }
       { type: 'float',
        key: 'maximumDaysAllowedInCurrentStage',
        displayName: 'Maximum Days Allowed In Current Stage',
        hidden: false }
      { templateKey: 'marketingCollateral',
      scope: 'enterprise_12345',
      displayName: 'Marketing Collateral',
      hidden: false,
      fields: 
       [ { type: 'string',
        key: 'audience1',
        displayName: 'Audience',
        hidden: false },
       { type: 'string',
        key: 'previousState',
        displayName: 'Previous State',
        hidden: false } ] },
      { templateKey: 'productInfo',
      scope: 'enterprise_12345',
      displayName: 'Product Info',
      hidden: false,
      fields: 
       [ { type: 'float',
        key: 'skuNumber',
        displayName: 'SKU Number',
        hidden: false },
       { type: 'enum',
        key: 'department',
        displayName: 'Department',
        hidden: false,
        options: 
        [ { key: 'Beauty' },
        { key: 'Shoes' },
        { key: 'Accessories' },
        { key: 'Clothing' },
        { key: 'Handbags' },
        { key: 'Bedding' },
        { key: 'Watches' } ] },
       { type: 'date',
        key: 'displayDate',
        displayName: 'Display Date',
        hidden: false } ] } ],
     next_marker: null,
     prev_marker: null }
    */
   });
  ```
</CodeGroup>

## A metadata template

A <Link href="/guides/metadata/templates">metadata template</Link> describes a set of key/value
pairs that can be assigned to a file or folder.

For example, a `customerInfo` template might hold data about a customer,
having a field for the customer name as well as the customer's industry.

```json theme={null}
{
  "id": "100ac693-a468-4b37-9535-05984b804dc2",
  "type": "metadata_template",
  "templateKey": "customerInfo",
  "scope": "enterprise_12345",
  "displayName": "Customer Info",
  "hidden": false,
  "copyInstanceOnItemCopy": false,
  "fields": [
    {
      "id": "5c6a5906-003b-4654-9deb-472583fc2930",
      "type": "string",
      "key": "name",
      "displayName": "Name",
      "hidden": false
    },
    {
      "id": "cf3eb5b8-52ef-456c-b175-44354a27e289",
      "type": "enum",
      "key": "industry",
      "displayName": "Industry",
      "options": [
        {"key": "Technology"},
        {"key": "Healthcare"},
        {"key": "Legal"}
      ],
      "hidden": false
    }
  ]
}
```

<Next>I've listed the templates available to me</Next>

<RelatedLinks
  title="RELATED APIS"
  items={[
{ label: translate("List all global metadata templates"), href: "/reference/get-metadata-templates-global", badge: "GET" },
{ label: translate("List all metadata templates for enterprise"), href: "/reference/get-metadata-templates-enterprise", badge: "GET" }
]}
/>

<RelatedLinks
  title="RELATED GUIDES"
  items={[
{ label: translate("Metadata template scopes"), href: "/guides/metadata/scopes", badge: "GUIDE" }
]}
/>
