# GET /api/v1/metadata

Retrieves metadata about all entities, including Calculated Insights, Engagement, Profile, and other entities, and their relationships to other objects. For Data Lake Objects and Data Model Objects, the API response includes information about key qualifier fields. For each field, the API response includes the name of the associated key qualifier field.

## Syntax

- **HTTP Method**: GET
- **Availability**: Data 360 v1.0, Salesforce API version 51.0 and later
- **Format**: REST
- **URI**: `/api/v1/metadata/`

## Query Parameters

| Parameter      | Type   | Description                                                                                                                                                                                                           |
| -------------- | ------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| entityType     | string | The requested metadata entity type. By default, this parameter includes all of the available types. Acceptable values: DataLakeObject, DataModelObject, and CalculatedInsight                                         |
| entityCategory | string | The requested metadata entity category. By default, this parameter includes all of the available categories. It isn't applicable for Calculated Insight entities. Acceptable values: Profile, Engagement, and Related |
| entityName     | string | The name of the requested metadata entity. By default, this parameter includes all of the available categories and an exhaustive list of entities. Example: UnifiedIndividual__dlm                                    |

## Response Structure

The response includes:

- `metadata`: Array of entity objects containing:
  - `fields`: Array of field objects with:
    - `name`: Field name
    - `displayName`: Human-readable field name
    - `type`: Field data type
    - `keyQualifier`: Associated key qualifier field (if applicable)
  - `indexes`: Array of index objects
  - `category`: Entity category
  - `name`: Entity name
  - `displayName`: Human-readable entity name
  - `relationships`: Array of relationship objects
  - `primaryKeys`: Array of primary key objects

## Examples

### Request

```http
GET https://{TSE}.360a.salesforce.com/api/v1/metadata/
```

### Response

```json
{
  "metadata": [
    {
      "fields": [
        {
          "name": "ssot__BirthDate__c",
          "displayName": "Birth Date",
          "type": "DATE_TIME"
        },
        {
          "name": "ssot__LastName__c",
          "displayName": "Last Name",
          "type": "STRING"
        },
        {
          "name": "KQ_Id__c",
          "displayName": "Key Qualifier Individual Id",
          "type": "STRING"
        },
        {
          "name": "ssot__Id__c",
          "displayName": "Individual Id",
          "type": "STRING",
          "keyQualifier": "KQ_Id__c"
        },
        {
          "name": "ssot__DataSourceObjectId__c",
          "displayName": "Data Source Object",
          "type": "STRING"
        },
        {
          "name": "ssot__YearlyIncome__c",
          "displayName": "Yearly Income",
          "type": "NUMBER"
        },
        {
          "name": "ssot__FirstName__c",
          "displayName": "First Name",
          "type": "STRING"
        }
      ],
      "indexes": [],
      "category": "Profile",
      "name": "ssot__Individual__dlm",
      "displayName": "Individual",
      "relationships": [
        {
          "fromEntity": "ssot__Individual__dlm",
          "toEntity": "IndividualIdentityLink__dlm",
          "fromEntityAttribute": "ssot__Id__c",
          "toEntityAttribute": "SourceRecordId__c",
          "cardinality": "ONETOONE"
        },
        {
          "fromEntity": "ssot__ContactPointPhone__dlm",
          "toEntity": "ssot__Individual__dlm",
          "fromEntityAttribute": "ssot__PartyId__c",
          "toEntityAttribute": "ssot__Id__c",
          "cardinality": "NTOONE"
        }
      ],
      "primaryKeys": [
        {
          "name": "ssot__Id__c",
          "displayName": "Individual Id",
          "indexOrder": "1"
        }
      ]
    },
    {
      "fields": [
        {
          "name": "ssot__DataSourceId__c",
          "displayName": "Data Source",
          "type": "STRING"
        },
        {
          "name": "ssot__DataSourceObjectId__c",
          "displayName": "Data Source Object",
          "type": "STRING"
        },
        {
          "name": "KQ_Id__c",
          "displayName": "Key Qualifier Party Id",
          "type": "STRING"
        },
        {
          "name": "ssot__Id__c",
          "displayName": "Party Identification Id",
          "type": "STRING",
          "keyQualifier": "KQ_Id__c"
        }
      ],
      "indexes": [],
      "category": "Related",
      "name": "ssot__PartyIdentification__dlm",
      "displayName": "Party Identification",
      "relationships": [],
      "primaryKeys": [
        {
          "name": "ssot__Id__c",
          "displayName": "Party Identification Id",
          "indexOrder": "1"
        }
      ]
    },
    {
      "name": "Avg_Spends__cio",
      "displayName": "Avg Spends",
      "dimensions": [
        {
          "name": "Id__c",
          "displayName": "Id",
          "type": "STRING"
        },
        {
          "name": "FirstName__c",
          "displayName": "First Name",
          "type": "STRING"
        }
      ],
      "measures": [
        {
          "name": "Avg_Spend__c",
          "displayName": "Avg Spend",
          "type": "NUMBER",
          "rollupable": true
        }
      ],
      "relationships": [
        {
          "fromEntity": "ssot__Individual__dlm",
          "toEntity": "Avg_Spends__cio"
        }
      ],
      "partitionBy": "Id__c"
    }
  ]
}
```

## Notes

- The API follows REST standards for consistency
- All responses are in JSON format
- Error responses include detailed error messages
- The API supports filtering by entity type, category, and name
- Key qualifier fields are included for Data Lake Objects and Data Model Objects
