<!-- Generated from the data model. Do not edit manually. -->

## Baseten Schema

```mermaid
graph LR
    BasetenApiKey -- OWNED_BY --> BasetenUser
    BasetenApiKey -- SCOPED_TO --> BasetenModel
    BasetenOrganization -- RESOURCE --> BasetenApiKey
    BasetenOrganization -- RESOURCE --> BasetenEnvironmentGroup
    BasetenOrganization -- RESOURCE --> BasetenModel
    BasetenOrganization -- RESOURCE --> BasetenSecret
    BasetenOrganization -- RESOURCE --> BasetenTeam
    BasetenOrganization -- RESOURCE --> BasetenUser
    BasetenTeam -- RESOURCE --> BasetenApiKey
    BasetenTeam -- RESOURCE --> BasetenEnvironmentGroup
    BasetenTeam -- RESOURCE --> BasetenModel
    BasetenTeam -- RESOURCE --> BasetenSecret
    BasetenUser -- CAN_MANAGE --> BasetenEnvironmentGroup
```

### BasetenApiKey

A Baseten API key.

Cartography ingests key metadata from `GET /v1/api_keys`; Baseten never returns
plaintext keys. Which keys the endpoint returns depends on the configured key: an
organization Admin's personal key or an API key management key returns every
team key and every member's personal key, a Team Admin sees their teams' keys,
and other users see only their own keys and the team keys they created.

> **Ontology Mapping**: This node uses the ontology label [`APIKey`](#ontology-apikey).

#### Properties

Ontology-generated fields are shown in *italics*.

| Field | Index | Description |
|-------|-------|-------------|
| id | Yes | Organization ID and API key prefix, joined with a slash. |
| firstseen |  | Timestamp when a sync job first created this node. |
| lastupdated | Yes | Timestamp of the last sync that observed this node. |
| created_at |  | ISO 8601 timestamp when the key was created. |
| expires_at |  | ISO 8601 expiry timestamp. Null if the key never expires. |
| last_used_at |  | ISO 8601 timestamp of the key's last recorded use. Baseten may delay updates. |
| name |  | API key name, if set. |
| owner_email | Yes | Email address of the user who owns a personal API key. |
| owner_user_id |  | ID of the user who owns a personal API key. |
| prefix | Yes | API key prefix. The plaintext key is never returned or stored. |
| team_name |  | Name of the team that a team API key belongs to. |
| type |  | Key type: `PERSONAL`, `WORKSPACE_MANAGE_ALL`, `WORKSPACE_INVOKE`, `WORKSPACE_EXPORT_METRICS`, `WORKSPACE_MANAGE_API_KEYS`, or `GRID`. |
| *_ont_created_at* | Yes | Normalized field sourced from `created_at`. |
| *_ont_expires_at* | Yes | Normalized field sourced from `expires_at`. |
| *_ont_last_used_at* | Yes | Normalized field sourced from `last_used_at`. |
| *_ont_name* | Yes | Normalized field sourced from `name`. |
| *_ont_source* |  | Module that populated this node's ontology fields. |

#### Relationships

- `(:BasetenApiKey)-[:OWNED_BY]->(:BasetenUser)`: A personal API key is owned by a user and carries that user's permissions.

- `(:User)-[:OWNS]->(:BasetenApiKey)`: generated by analysis job `Ontology - User OWNS APIKey linking`.

- `(:BasetenOrganization)-[:RESOURCE]->(:BasetenApiKey)`: The organization contains this resource.

- `(:BasetenTeam)-[:RESOURCE]->(:BasetenApiKey)`: The team owns this resource.

- `(:BasetenApiKey)-[:SCOPED_TO]->(:BasetenModel)`: A team API key includes the model in its scope. See the key type for permissions.

### BasetenEnvironmentGroup

A Baseten environment group: the restriction settings for one environment name,
such as `production`, across every model and Chain in a team.

When an environment is restricted, only the users that Baseten lists can modify
deployments, autoscaling, and promotions in it. Cartography reads each accessible
team's groups from `GET /v1/teams/{team_id}/environment_groups`.

#### Properties

| Field | Index | Description |
|-------|-------|-------------|
| id | Yes | Synthetic ID built from the team ID and the environment name. |
| firstseen |  | Timestamp when a sync job first created this node. |
| lastupdated | Yes | Timestamp of the last sync that observed this node. |
| is_restricted |  | Whether only designated users can manage the environment. When `false`, any team member can change deployments, autoscaling, and promotions in it. |
| name | Yes | Environment name, such as `production`. The group governs that environment on every model and Chain in the team. |
| team_id |  | ID of the team that the environment group belongs to. |
| team_name |  | Name of the team that the environment group belongs to. |

#### Relationships

- `(:BasetenUser)-[:CAN_MANAGE]->(:BasetenEnvironmentGroup)`: The user can manage the restricted environment. Baseten lists these users only
while the environment is restricted, and includes organization and team admins.

- `(:BasetenOrganization)-[:RESOURCE]->(:BasetenEnvironmentGroup)`: The organization contains this resource.

- `(:BasetenTeam)-[:RESOURCE]->(:BasetenEnvironmentGroup)`: The team owns this resource.

### BasetenModel

A model deployed on Baseten Dedicated Inference.

A model groups the deployments of one inference service and belongs to a team.
Baseten reports the owning team by name, so Cartography links the model to the
`BasetenTeam` with that name in the same organization.

> **Ontology Mapping**: This node uses the ontology label [`AIModel`](#ontology-aimodel).

#### Properties

Ontology-generated fields are shown in *italics*.

| Field | Index | Description |
|-------|-------|-------------|
| id | Yes | Baseten model ID. |
| firstseen |  | Timestamp when a sync job first created this node. |
| lastupdated | Yes | Timestamp of the last sync that observed this node. |
| created_at |  | ISO 8601 timestamp when the model was created. |
| deployments_count |  | Number of deployments of the model. |
| development_deployment_id |  | ID of the model's development deployment, if any. |
| instance_type_name |  | Instance type of the model's production deployment. |
| name | Yes | Model name, unique in its team. |
| production_deployment_id |  | ID of the model's production deployment, if any. |
| team_name |  | Name of the team that owns the model. |
| *_ont_name* | Yes | Normalized field sourced from `name`. |
| *_ont_provider* | Yes | Property generated by the ontology mapping. |
| *_ont_source* |  | Module that populated this node's ontology fields. |

#### Relationships

- `(:BasetenOrganization)-[:RESOURCE]->(:BasetenModel)`: The organization contains this resource.

- `(:BasetenTeam)-[:RESOURCE]->(:BasetenModel)`: The team owns this resource.

- `(:BasetenApiKey)-[:SCOPED_TO]->(:BasetenModel)`: A team API key includes the model in its scope. See the key type for permissions.

### BasetenOrganization

A Baseten organization, the tenant that owns teams, users, API keys, secrets,
models, and Chains.

Cartography reads the organization of the configured API key from
`GET /v1/organizations/me`, together with its API key creation controls.

> **Ontology Mapping**: This node uses the ontology label [`Tenant`](#ontology-tenant).

#### Properties

Ontology-generated fields are shown in *italics*.

| Field | Index | Description |
|-------|-------|-------------|
| id | Yes | Baseten organization ID. |
| firstseen |  | Timestamp when a sync job first created this node. |
| lastupdated | Yes | Timestamp of the last sync that observed this node. |
| allow_personal_api_keys |  | Whether members can create new personal API keys. Existing keys keep working when this is `false`. |
| allow_service_account_api_keys |  | Whether new team and organization API keys can be created. Existing keys keep working when this is `false`. |
| allow_team_admins_to_manage_roles |  | Whether team admins can create, change, and delete their team's custom roles. Null when custom roles aren't available to the organization or the API key can't read its roles. |
| aws_assume_role_baseten_role_arn |  | ARN of the Baseten-owned IAM role to allow in your IAM role's trust policy when AWS AssumeRole authentication is enabled. |
| aws_assume_role_enabled |  | Whether AWS AssumeRole authentication is enabled, so Baseten can assume an IAM role in your AWS accounts. |
| created_at |  | ISO 8601 timestamp when the organization was created. |
| name | Yes | Display name of the organization. |
| *_ont_name* | Yes | Normalized field sourced from `name`. |
| *_ont_source* |  | Module that populated this node's ontology fields. |

#### Relationships

- `(:BasetenOrganization)-[:RESOURCE]->(:BasetenApiKey)`: The organization contains this resource.

- `(:BasetenOrganization)-[:RESOURCE]->(:BasetenEnvironmentGroup)`: The organization contains this resource.

- `(:BasetenOrganization)-[:RESOURCE]->(:BasetenModel)`: The organization contains this resource.

- `(:BasetenOrganization)-[:RESOURCE]->(:BasetenSecret)`: The organization contains this resource.

- `(:BasetenOrganization)-[:RESOURCE]->(:BasetenTeam)`: The organization contains this resource.

- `(:BasetenOrganization)-[:RESOURCE]->(:BasetenUser)`: The organization contains this resource.

### BasetenSecret

A Baseten secret that models, Chains, and training jobs read at runtime.

Cartography ingests secret metadata only. The Management API never returns secret
values, so none are stored in the graph.

> **Ontology Mapping**: This node uses the ontology label [`Secret`](#ontology-secret).

#### Properties

Ontology-generated fields are shown in *italics*.

| Field | Index | Description |
|-------|-------|-------------|
| id | Yes | Baseten secret ID. It stays the same when the secret is rotated. |
| firstseen |  | Timestamp when a sync job first created this node. |
| lastupdated | Yes | Timestamp of the last sync that observed this node. |
| created_at |  | ISO 8601 timestamp when the secret was created. |
| name | Yes | Secret name. |
| team_name |  | Name of the team that owns the secret. |
| *_ont_created_at* | Yes | Normalized field sourced from `created_at`. |
| *_ont_name* | Yes | Normalized field sourced from `name`. |
| *_ont_source* |  | Module that populated this node's ontology fields. |

#### Relationships

- `(:BasetenOrganization)-[:RESOURCE]->(:BasetenSecret)`: The organization contains this resource.

- `(:BasetenTeam)-[:RESOURCE]->(:BasetenSecret)`: The team owns this resource.

### BasetenTeam

A team in a Baseten organization.

Teams isolate models, Chains, secrets, team API keys, and restricted environments.
Every organization has a default team; organizations on the Enterprise plan can
create more. Cartography ingests the teams that the API key can access.

> **Ontology Mapping**: This node uses the ontology label [`Tenant`](#ontology-tenant).

#### Properties

Ontology-generated fields are shown in *italics*.

| Field | Index | Description |
|-------|-------|-------------|
| id | Yes | Baseten team ID. |
| firstseen |  | Timestamp when a sync job first created this node. |
| lastupdated | Yes | Timestamp of the last sync that observed this node. |
| created_at |  | ISO 8601 timestamp when the team was created. |
| default |  | Whether this is the organization's default team. |
| name | Yes | Team name, unique in the organization. |
| *_ont_name* | Yes | Normalized field sourced from `name`. |
| *_ont_source* |  | Module that populated this node's ontology fields. |

#### Relationships

- `(:BasetenTeam)-[:RESOURCE]->(:BasetenApiKey)`: The team owns this resource.

- `(:BasetenTeam)-[:RESOURCE]->(:BasetenEnvironmentGroup)`: The team owns this resource.

- `(:BasetenTeam)-[:RESOURCE]->(:BasetenModel)`: The team owns this resource.

- `(:BasetenOrganization)-[:RESOURCE]->(:BasetenTeam)`: The organization contains this resource.

- `(:BasetenTeam)-[:RESOURCE]->(:BasetenSecret)`: The team owns this resource.

### BasetenUser

A member of a Baseten organization.

Cartography ingests joined members from `GET /v1/users`. Baseten excludes invited
users, pending join requests, and service accounts from that list. The
`UserAccount` label links the user to other identities with the same email.

> **Ontology Mapping**: This node uses the ontology label [`UserAccount`](#ontology-useraccount).

#### Properties

Ontology-generated fields are shown in *italics*.

| Field | Index | Description |
|-------|-------|-------------|
| id | Yes | Baseten user ID. |
| firstseen |  | Timestamp when a sync job first created this node. |
| lastupdated | Yes | Timestamp of the last sync that observed this node. |
| email | Yes | Email address of the user. |
| name |  | Display name of the user. |
| workspace_name |  | Name of the user's workspace. |
| *_ont_email* | Yes | Normalized field sourced from `email`. |
| *_ont_fullname* | Yes | Normalized field sourced from `name`. |
| *_ont_source* |  | Module that populated this node's ontology fields. |

#### Relationships

- `(:BasetenUser)-[:CAN_MANAGE]->(:BasetenEnvironmentGroup)`: The user can manage the restricted environment. Baseten lists these users only
while the environment is restricted, and includes organization and team admins.

- `(:User)-[:HAS_ACCOUNT]->(:BasetenUser)`: generated by analysis job `Ontology - UserAccount HAS_ACCOUNT User linking by normalized email`.

- `(:BasetenApiKey)-[:OWNED_BY]->(:BasetenUser)`: A personal API key is owned by a user and carries that user's permissions.

- `(:BasetenOrganization)-[:RESOURCE]->(:BasetenUser)`: The organization contains this resource.
