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

# List

> Get filtered metadata based on conditions. Supports shared connections.

## Request Body

| Field                 | Type                  | Description                                                                  |
|-----------------------|-----------------------|------------------------------------------------------------------------------|
| `data_connector_name` | `str`                 | Name of the data connector (vector database profile).                        |
| `dataslice_id`        | `Optional[str]`       | ID of the dataslice to get files from.                                       |
| `tag_names`           | `Optional[List[str]]` | List of tag names to include in the metadata.                                |
| `include_chunk_level` | `Optional[bool]`      | Whether to include chunk-level metadata. Default: `true`                     |
| `file_names`          | `Optional[List[str]]` | List of specific file names to include in the metadata.                      |
| `chunk_ids`           | `Optional[List[str]]` | List of specific chunk IDs to include in the metadata.                       |
| `include_last_updated`| `Optional[bool]`      | Whether to include the last updated timestamp. Default: `false`              |

## Response

- **200**: Metadata retrieved successfully  
    - Without `chunk_ids`: Returns metadata grouped by filename, tag, and level  
      `{filename: {tag_id: {chunk_level: {chunk_id: metadata}, file_level: metadata}}}`
    - With `chunk_ids`: Returns metadata by chunk ID  
      `{chunk_id: {metadata}}`
- **500**: Internal Server Error

## Example

```json
{
  "data_connector_name": "my-connector",
  "dataslice_id": "abc123",
  "tag_names": ["category", "date"],
  "include_chunk_level": true,
  "file_names": ["document1.pdf", "document2.pdf"]
}
```



## OpenAPI

````yaml /deasy-openapi-stainless.yml post /metadata/list
openapi: 3.1.0
info:
  title: FastAPI
  version: 0.1.0
servers:
  - url: /rest/unstructured
security: []
paths:
  /metadata/list:
    post:
      tags:
        - Metadata
      summary: List
      description: >-
        Get filtered metadata based on conditions. Supports shared connections.


        ## Request Body


        | Field                 | Type                  |
        Description                                                                 
        |

        |-----------------------|-----------------------|------------------------------------------------------------------------------|

        | `data_connector_name` | `str`                 | Name of the data
        connector (vector database profile).                        |

        | `dataslice_id`        | `Optional[str]`       | ID of the dataslice to
        get files from.                                       |

        | `tag_names`           | `Optional[List[str]]` | List of tag names to
        include in the metadata.                                |

        | `include_chunk_level` | `Optional[bool]`      | Whether to include
        chunk-level metadata. Default: `true`                     |

        | `file_names`          | `Optional[List[str]]` | List of specific file
        names to include in the metadata.                      |

        | `chunk_ids`           | `Optional[List[str]]` | List of specific chunk
        IDs to include in the metadata.                       |

        | `include_last_updated`| `Optional[bool]`      | Whether to include the
        last updated timestamp. Default: `false`              |


        ## Response


        - **200**: Metadata retrieved successfully  
            - Without `chunk_ids`: Returns metadata grouped by filename, tag, and level  
              `{filename: {tag_id: {chunk_level: {chunk_id: metadata}, file_level: metadata}}}`
            - With `chunk_ids`: Returns metadata by chunk ID  
              `{chunk_id: {metadata}}`
        - **500**: Internal Server Error


        ## Example


        ```json

        {
          "data_connector_name": "my-connector",
          "dataslice_id": "abc123",
          "tag_names": ["category", "date"],
          "include_chunk_level": true,
          "file_names": ["document1.pdf", "document2.pdf"]
        }

        ```
      operationId: list_metadata_route_metadata_list_post
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ListMetadataRequest'
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ListMetadataResponse'
        '403':
          description: Missing token
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPError'
        '404':
          description: Resource not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPError'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
        '429':
          description: Too many requests
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPError'
        '500':
          description: >-
            Internal Server Error. An unexpected error occurred while processing
            the request.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPError'
      security:
        - BasicAuth: []
        - BearerAuth: []
          UserIdAuth: []
      x-codeSamples:
        - lang: Python
          source: |-
            import os
            from unstructured import UnstructuredClient

            client = UnstructuredClient(
                username=os.environ.get("UNSTRUCTURED_USERNAME"),  # This is the default and can be omitted
                password=os.environ.get("UNSTRUCTURED_PASSWORD"),  # This is the default and can be omitted
            )
            metadata = client.metadata.list(
                data_connector_name="data_connector_name",
            )
            print(metadata.metadata)
        - lang: JavaScript
          source: >-
            import UnstructuredClient from 'unstructured-sdk';


            const client = new UnstructuredClient({
              authMethod: 'My Auth Method',
              username: process.env['UNSTRUCTURED_USERNAME'], // This is the default and can be omitted
              password: process.env['UNSTRUCTURED_PASSWORD'], // This is the default and can be omitted
            });


            const metadata = await client.metadata.list({ data_connector_name:
            'data_connector_name' });


            console.log(metadata.metadata);
components:
  schemas:
    ListMetadataRequest:
      properties:
        data_connector_name:
          type: string
          title: Data Connector Name
        dataslice_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Dataslice Id
        tag_names:
          anyOf:
            - items:
                type: string
              type: array
            - type: 'null'
          title: Tag Names
        include_chunk_level:
          anyOf:
            - type: boolean
            - type: 'null'
          title: Include Chunk Level
          default: true
        file_names:
          anyOf:
            - items:
                type: string
              type: array
            - type: 'null'
          title: File Names
        chunk_ids:
          anyOf:
            - items:
                type: string
              type: array
            - type: 'null'
          title: Chunk Ids
        include_last_updated:
          anyOf:
            - type: boolean
            - type: 'null'
          title: Include Last Updated
          default: false
      type: object
      required:
        - data_connector_name
      title: ListMetadataRequest
    ListMetadataResponse:
      properties:
        metadata:
          anyOf:
            - additionalProperties:
                additionalProperties:
                  $ref: '#/components/schemas/TagMetadata'
                type: object
              type: object
              title: MetadataByTagAndChunk
            - additionalProperties:
                additionalProperties:
                  $ref: '#/components/schemas/Metadata'
                type: object
              type: object
              title: MetadataByChunk
          title: Metadata
      type: object
      required:
        - metadata
      title: ListMetadataResponse
    HTTPError:
      properties:
        detail:
          type: string
          title: Detail
      type: object
      required:
        - detail
      title: HTTPError
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    TagMetadata:
      properties:
        chunk_level:
          anyOf:
            - additionalProperties:
                anyOf:
                  - $ref: '#/components/schemas/Metadata'
                  - type: 'null'
              type: object
            - type: 'null'
          title: Chunk Level
        file_level:
          anyOf:
            - $ref: '#/components/schemas/Metadata'
            - type: 'null'
      type: object
      title: TagMetadata
    Metadata:
      properties:
        values:
          items:
            anyOf:
              - type: string
              - type: number
              - type: integer
          type: array
          title: Values
        evidence:
          anyOf:
            - type: string
            - type: 'null'
          title: Evidence
      type: object
      required:
        - values
      title: Metadata
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
  securitySchemes:
    BasicAuth:
      type: http
      scheme: basic
    BearerAuth:
      type: http
      scheme: bearer
    UserIdAuth:
      type: apiKey
      in: header
      name: X-User-ID

````