> For the complete documentation index, see [llms.txt](https://firstoken.gitbook.io/api-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://firstoken.gitbook.io/api-docs/api-reference/proxy/actions.md).

# Actions

In the FirsToken Proxy there are some elements that allows you to run specifics tasks in the request before being forwarded to the desired destination.&#x20;

{% hint style="info" %}
All actions must be send between a double braked string, like this:

"{{ token: detokenize | extract: element | filter: format | encrypt }}"
{% endhint %}

The actions that are supported are the following:

* To choose the type of token to process, you can use:
  * **:detokenize**\
    Used for describe a permanent token. \
    Must be send concatenated to the token, \
    Example: "*<mark style="background-color:yellow;">69a96c12-ad1e-4392-b230-c154f8e4aabd:detokenize</mark>*"
  * **:transaction** \
    Used for describe an temporal token. \
    Must be send concatenated to the token.\
    Example: "*<mark style="background-color:yellow;">69a96c12-ad1e-4392-b230-c154f8e4aabd:transaction</mark>*"
* **extract:element** \
  Used for extract an specific element from the token data, for example in a credit card context can be the pan, card holder name, cvv for temporal tokens and the expiration date.
  * Allowed elements:
    * **card**: get the card number
    * **token**: gets the card token
    * **name**: if exist gets the card holder name.
    * **expiration**: gets the expiration date.
    * **cvv**: get the cvv value. (works only with transaction - temporal token)
* **filter: format**\
  Used to apply an specific date format (***Only works with expiration dates values)***\
  &#x20;As expiration just has months and year values, it allows formats like&#x20;
  * "date: MM/YY"
  * "date: MM/YYYY"
  * "date: MM"
  * "date: YY"
  * "date: YYYY/MM"
* **encrypt**

  Used to apply an encryption algorithm to the resulting string value

  * Currently only supports RSA algorithm
  * The key must be sent as part of the request in the ft-encryption header
* **parse: type** \
  Converts string values to numeric types. Only works for card-related fields:
  * Applicable fields:
    * expirationYear
    * expirationMonth
    * number
    * securityCode
  * Supported types:
    * `integer`
    * `int`
  * Example:

    ```json
    {
        "card": {
            "expirationYear": "{{token:detokenize|extract:expiration|date:YYYY|parse:integer}}",
            "expirationMonth": "{{token:detokenize|extract:expiration|date:MM|parse:int}}",
            "number": "{{token:detokenize|extract:card}}",
            "securityCode": "897"
        } 
    }
    ```
  * Notes:

    * When using parse, the value will be sent as an integer instead of a string
      * Using unsupported types will result in an error:

    ```json
    {
        "status_code": 400,
        "status": "fail",
        "description": "Invalid action:option combination received. action:option= parse:string",
        "data": ""
    }
    ```

{% hint style="info" %}
The actions must be follow an order, the first action will indicate the token type (temporal or permanent), the second must be the extract task with an allowed element, next can be the filter, encrypt or parse action.
{% endhint %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://firstoken.gitbook.io/api-docs/api-reference/proxy/actions.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
