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

# Create Entities

> Learn how to create entities using the API.

export const HowToSchema = ({name, description, steps = []}) => {
  const schema = {
    "@context": "https://schema.org",
    "@type": "HowTo",
    name,
    description
  };
  if (steps.length > 0) {
    schema.step = steps.map((s, i) => ({
      "@type": "HowToStep",
      position: i + 1,
      name: typeof s === "string" ? s : s.name,
      text: typeof s === "string" ? s : s.text || s.name
    }));
  }
  return <script type="application/ld+json" dangerouslySetInnerHTML={{
    __html: JSON.stringify(schema)
  }} />;
};

<HowToSchema
  name="Create Entities"
  description="Learn how to create entities using the API."
  steps={[
{
  name: "Before You Begin",
  text: "Before creating entities, ensure you have: - An API access token with appropriate permissions - Determined the data type of your entity identifier (string, integer, etc.)",
},
{
  name: "Create an Entity",
  text: "To create an entity of type string called User: The response includes the entity resource name you can use to reference it:",
},
{
  name: "Create an Integer Entity",
  text: "For entities with integer identifiers:",
},
{
  name: "Supported Primary Key Types",
  text: "- COLUMN_TYPE_STRING: String identifiers (UUIDs, usernames, etc.) - COLUMN_TYPE_INTEGER: Integer identifiers - COLUMN_TYPE_BOOLEAN: Boolean values",
},
]}
/>

Create entities that can be uniquely identified and randomized, like users or sessions.

## Before You Begin

Before creating entities, ensure you have:

* An API access token with appropriate permissions
* Determined the data type of your entity identifier (string, integer, etc.)

## Create an Entity

To create an entity of type string called `User`:

```bash theme={null}
curl -X POST "https://metrics.confidence.dev/v1/entities" \
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "displayName": "User",
    "primaryKeyType": "COLUMN_TYPE_STRING"
  }'
```

The response includes the entity resource name you can use to reference it:

```json theme={null}
{
  "name": "entities/user",
  "displayName": "User",
  "primaryKeyType": "COLUMN_TYPE_STRING"
}
```

## Create an Integer Entity

For entities with integer identifiers:

```bash theme={null}
curl -X POST "https://metrics.confidence.dev/v1/entities" \
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "displayName": "Session",
    "primaryKeyType": "COLUMN_TYPE_INTEGER"
  }'
```

## Supported Primary Key Types

* `COLUMN_TYPE_STRING`: String identifiers (UUIDs, usernames, etc.)
* `COLUMN_TYPE_INTEGER`: Integer identifiers
* `COLUMN_TYPE_BOOLEAN`: Boolean values
* `COLUMN_TYPE_DOUBLE`: Floating point numbers

## Next Steps

After creating entities:

* [Create an assignment table](./create-assignment-table) to track assignments
* [Create fact tables](./create-fact-table) to measure entity behaviors
* [Create dimension tables](./create-dimension-table) to segment entities
