# org.designtxt.resolveTokens

> Published by [bomberstudios.com](https://lexicon.garden/identity/did:plc:34yvx4hv64znmh2i2fezoyqx)

✓ This is the authoritative definition for this NSID.

## Description

XRPC Procedure to resolve a design token resolver document against a set of contextual inputs, producing a fully resolved token collection.

## Links

- [View on Lexicon Garden](https://lexicon.garden/lexicon/did:plc:34yvx4hv64znmh2i2fezoyqx/org.designtxt.resolveTokens)
- [Documentation](https://lexicon.garden/lexicon/did:plc:34yvx4hv64znmh2i2fezoyqx/org.designtxt.resolveTokens/docs)
- [Examples](https://lexicon.garden/lexicon/did:plc:34yvx4hv64znmh2i2fezoyqx/org.designtxt.resolveTokens/examples)

## Definitions

### `org.designtxt.resolveTokens`

**Type**: `procedure`

Resolve a resolver document by providing concrete context values for each of its modifiers. Returns a flat token set with all aliases resolved. Authentication is optional; the resolver document must be publicly accessible if used without auth.

#### Input

**Encoding**: `application/json`

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `input` | `object` | Yes | Contextual input values, keyed by modifier name. Each value must be a string matching one of that modifier's defined contexts. E.g. { "theme": "dark", "size": "compact" }. |
| `resolverRef` | `string` (at-uri) | Yes | AT-URI of the org.designtxt.resolver record to resolve. |
| `resolveReferences` | `boolean` | No | If true (default), resolve all alias references ({token.name}) in the output. Set to false to preserve aliases as literal strings. |

#### Output

**Encoding**: `application/json`

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `input` | `object` | No | Echo of the input values used for resolution. |
| `tokens` | `unknown` | Yes | The resolved token collection. All modifier conditions have been applied according to resolutionOrder, and alias references have been resolved. |
| `resolvedAt` | `string` (datetime) | No | Timestamp when resolution was performed. |

#### Errors

- **ResolverNotFound**: The specified resolver document could not be found.
- **InvalidInput**: The input values do not match the resolver's modifier definitions (unknown modifier, invalid context value, or missing required modifier without a default).
- **CircularReference**: The resolver or referenced token sources contain a circular reference.
- **ResolutionFailed**: Token resolution failed due to unresolvable alias references, invalid token values, or other processing errors.

## Raw Schema

```json
{
  "id": "org.designtxt.resolveTokens",
  "defs": {
    "main": {
      "type": "procedure",
      "input": {
        "schema": {
          "type": "object",
          "required": [
            "resolverRef",
            "input"
          ],
          "properties": {
            "input": {
              "type": "object",
              "properties": {},
              "description": "Contextual input values, keyed by modifier name. Each value must be a string matching one of that modifier's defined contexts. E.g. { \"theme\": \"dark\", \"size\": \"compact\" }."
            },
            "resolverRef": {
              "type": "string",
              "format": "at-uri",
              "maxLength": 8192,
              "description": "AT-URI of the org.designtxt.resolver record to resolve."
            },
            "resolveReferences": {
              "type": "boolean",
              "description": "If true (default), resolve all alias references ({token.name}) in the output. Set to false to preserve aliases as literal strings."
            }
          }
        },
        "encoding": "application/json"
      },
      "errors": [
        {
          "name": "ResolverNotFound",
          "description": "The specified resolver document could not be found."
        },
        {
          "name": "InvalidInput",
          "description": "The input values do not match the resolver's modifier definitions (unknown modifier, invalid context value, or missing required modifier without a default)."
        },
        {
          "name": "CircularReference",
          "description": "The resolver or referenced token sources contain a circular reference."
        },
        {
          "name": "ResolutionFailed",
          "description": "Token resolution failed due to unresolvable alias references, invalid token values, or other processing errors."
        }
      ],
      "output": {
        "schema": {
          "type": "object",
          "required": [
            "tokens"
          ],
          "properties": {
            "input": {
              "type": "object",
              "properties": {},
              "description": "Echo of the input values used for resolution."
            },
            "tokens": {
              "type": "unknown",
              "description": "The resolved token collection. All modifier conditions have been applied according to resolutionOrder, and alias references have been resolved."
            },
            "resolvedAt": {
              "type": "string",
              "format": "datetime",
              "maxLength": 64,
              "description": "Timestamp when resolution was performed."
            }
          }
        },
        "encoding": "application/json"
      },
      "description": "Resolve a resolver document by providing concrete context values for each of its modifiers. Returns a flat token set with all aliases resolved. Authentication is optional; the resolver document must be publicly accessible if used without auth."
    }
  },
  "$type": "com.atproto.lexicon.schema",
  "lexicon": 1,
  "description": "XRPC Procedure to resolve a design token resolver document against a set of contextual inputs, producing a fully resolved token collection."
}
```
