# SDTF Engine

## Introduction

The SDTF Engine brings together the core APIs that enable most of Specify features to seamlessly integrate, whether you're working in Figma or Token Studio, managing GitHub pull-requests, or directly within your codebase with the SDK or the CLI.

{% hint style="info" %}
You can access the SDTF Engine APIs over the [Specify SDK](/distribute/available-destinations/specify-sdk.md).
{% endhint %}

{% hint style="success" %}
all parsers written by Specify uses the SDTF Engine under the hood.
{% endhint %}

## Token Tree CRUD API

At the core of the SDTF Engine, the query and mutation methods.

### Query

The SDTF Engine provides a set of built-in getter functions to access tokens, groups, collections and aliases over the loaded token tree.

`getAllTokenStates`, `getChildrenOf`, `getParentsOf`, `getAliasReference`… [and many more](/reference/sdtf-engine/query-api.md) - give you the opportunity to traverse and iterate over the different instances of `TokenState`, `GroupState`, and `CollectionState`.

### Mutation

The SDTF Engine provides a set of built-in mutation functions to locally manipulate the underlaying token tree in order to meet your project and/or company standards.

`updateTokenModeValue`, `updateTokenValue`, `moveToken`, `addToken`, `deleteToken`, `renameToken`… [and many more](/reference/sdtf-engine/mutation-api.md) - assemble into a CRUD API giving you the control to bend your data just right for your use cases, **without ever making changes to the original design data** from the repository.

## SDTF Query Language

Elevating your control over the data, the SDTF Query Language offers sophisticated techniques to navigate and cherry-pick the token tree with precision. You will find functions that allow complex querying patterns, matching specific criteria and conditions, vital for advanced manipulation and data extraction tasks.

```typescript
const query: SDTFQuery = {
  where: {
    collection: '^MyCollection$',
    andWhere: {
      group: '^MyGroup$',
      andWhere: {
        token: '.*',
        select: true,
      },
    },
  },
};
```

With this powerful language at your disposal, it becomes easy to implement custom scenarios and data transformations.

{% hint style="info" %}
Looking for the SDTF Query Language details? 👉 review the [SDTF Query Language](/reference/sdtf-engine/sdtf-query-language.md) reference
{% endhint %}

{% hint style="info" %}
The SDTF Query Language is accessible in the [Specify SDK](/distribute/available-destinations/specify-sdk.md) and in some [parsers](/concepts/parsers-engine.md#the-parsers-functions) via a dedicated option.
{% endhint %}

## Stateful Value API

The Stateful Value API grants direct access to examine the values assigned to tokens.&#x20;

Through an exhaustive map interface, the API simplifies the process of keeping your design tokens and their implementations in sync despite the creation of aliases along the way.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.specifyapp.com/concepts/sdtf-client/sdtf-engine.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
