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

# Token Layer Action Guide

> Action-first guide for /token-layer with register and createToken flows.

# Token Layer Action Guide

Use this guide for practical integration with `POST /token-layer`.

## Decision Flow

1. New wallet with no `user_wallets` mapping: call `action.type=register`.
2. Registered wallet: call `action.type=createToken`.
3. If you get `IDENTITY_NOT_REGISTERED`, run `register` first, then retry your action.

## Register (Web3, Single Step)

Use this action to bootstrap identity for wallets that are not registered yet.

Requirements:

* `Authorization: Bearer 0x...` (wallet address)
* `signature`: EIP-712 signature for register action
* `nonce`: timestamp in ms
* `action.message` + `action.signature`
* `action.message` must include a 13-digit timestamp in ms
* message timestamp must match `nonce` and be inside `expiresAfter`

```bash theme={null}
curl --request POST \
  --url https://api.tokenlayer.network/functions/v1/token-layer \
  --header 'Authorization: Bearer 0xafe140dbfe00606990d913c04efd318701c99d17' \
  --header 'Content-Type: application/json' \
  --data '{
    "action": {
      "type": "register",
      "method": "web3",
      "message": "TokenLayer register\naddress: 0xafe140dbfe00606990d913c04efd318701c99d17\ntimestamp: 1737600000000",
      "signature": "0x..."
    },
    "source": "Mainnet",
    "nonce": 1737600000000,
    "expiresAfter": 300000,
    "signatureChainId": "0x1",
    "signature": "0x..."
  }'
```

```json theme={null}
{
  "actionType": "register",
  "success": true,
  "name": "register",
  "userId": "b558937d-fd36-4e49-944e-691806190f46",
  "walletAddress": "0xafe140dbfe00606990d913c04efd318701c99d17",
  "method": "web3"
}
```

## Create Token

Use this action after wallet registration.

Requirements:

* `Authorization: Bearer 0x...` for wallet-signed mode
* `signature`: EIP-712 signature for createToken payload
* `nonce`: timestamp in ms

```bash theme={null}
curl --request POST \
  --url https://api.tokenlayer.network/functions/v1/token-layer \
  --header 'Authorization: Bearer 0xafe140dbfe00606990d913c04efd318701c99d17' \
  --header 'Content-Type: application/json' \
  --data '{
    "action": {
      "type": "createToken",
      "name": "My Cool Token",
      "symbol": "MCT",
      "description": "A new token",
      "image": "https://example.com/logo.png",
      "chainSlug": "base"
    },
    "source": "Mainnet",
    "nonce": 1737600001000,
    "expiresAfter": 300000,
    "signatureChainId": "0x1",
    "signature": "0x..."
  }'
```

```json theme={null}
{
  "actionType": "createToken",
  "name": "createToken",
  "success": true
}
```

## Common Errors

* `IDENTITY_NOT_REGISTERED`: wallet signature is valid but wallet has no user mapping.
* `REPLAY_DETECTED`: same `(wallet, nonce, actionHash)` was already used.
* `ACTION_EXPIRED`: `nonce + expiresAfter` is invalid.
* `INVALID_ACTION_SIGNATURE`: EIP-712 signature does not match payload.

## API Reference

For full schema and interactive testing, see:

* [`POST /token-layer`](/api-reference/transactions/execute-token-layer-action)
