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

# Resource IDs

> How Deck identifies objects across the API.

Every object in the Deck API has a unique identifier with a type prefix. The prefix tells you what kind of resource the ID refers to, making it easier to debug, log, and route objects through your system without additional lookups.

## Format

All IDs follow the same pattern:

```text theme={null}
{type_prefix}_{unique_string}
```

The prefix is always lowercase, followed by an underscore, followed by a URL-safe alphanumeric string. IDs are case-sensitive.

## ID Reference

| Prefix     | Resource          | Example             | Description                                                              |
| ---------- | ----------------- | ------------------- | ------------------------------------------------------------------------ |
| `agt_`     | Agent             | `agt_a1b2c3d4`      | An automation agent scoped to a use case.                                |
| `src_`     | Source            | `src_a1b2c3d4`      | A website or service your agent connects to.                             |
| `cred_`    | Credential        | `cred_a1b2c3d4`     | Stored authentication details for a user on a source.                    |
| `sess_`    | Session           | `sess_a1b2c3d4`     | An isolated compute session used to execute tasks.                       |
| `task_`    | Task              | `task_abc123`       | A defined action an agent can perform.                                   |
| `trun_`    | Task Run          | `trun_a1b2c3d4`     | A single execution of a task.                                            |
| `stor_`    | Storage Item      | `stor_a1b2c3d4`     | A file or document captured during a task run.                           |
| `evt_`     | Event             | `evt_a1b2c3d4`      | A lifecycle event emitted by the platform.                               |
| `evtd_`    | Event Destination | `evtd_a1b2c3d4`     | An endpoint that receives events.                                        |
| `edlv_`    | Event Delivery    | `edlv_a1b2c3d4`     | A record of an event sent to a destination.                              |
| `req_`     | Request           | `req_a1b2c3d4`      | A unique identifier for an API request, returned in error responses.     |
| `sk_live_` | API Key           | `sk_live_abc123...` | Your API key. Not a resource ID, but follows the same prefix convention. |

## Using prefixed IDs

### Type checking

Because the prefix encodes the resource type, you can validate IDs before making API calls.

```javascript theme={null}
function getResourceType(id) {
  const prefix = id.split("_").slice(0, -1).join("_");
  const types = {
    agt: "agent",
    src: "source",
    cred: "credential",
    sess: "session",
    task: "task",
    trun: "task_run",
    stor: "storage",
    evt: "event",
    evtd: "event_destination",
    edlv: "event_delivery",
  };
  return types[prefix] || null;
}
```

### Logging and debugging

Prefixed IDs make it easy to trace activity across resources in your logs. A log entry containing `cred_a1b2c3d4` and `trun_x9y8z7` immediately tells you which credential and task run were involved, without needing to cross-reference separate tables.

### Cross-referencing resources

Many API responses include related resource IDs. A task run object, for example, includes `task_id`, `credential_id`, `agent_id`, and `source_id`. The prefixes let you quickly verify the relationships are correct.

```json theme={null}
{
  "id": "trun_a1b2c3d4",
  "object": "task_run",
  "task_id": "task_abc123",
  "credential_id": "cred_a1b2c3d4",
  "session_id": "sess_a1b2c3d4",
  "agent_id": "agt_a1b2c3d4",
  "source_id": "src_a1b2c3d4",
  "status": "completed"
}
```

## Notes

* IDs are immutable. Once assigned, they never change.
* IDs are globally unique. You will never see the same ID across different resource types or organizations.
* IDs are case-sensitive. `agt_A1B2` and `agt_a1b2` are different identifiers.
* Passing an ID with the wrong prefix to an endpoint returns a `400` validation error.
