> For the complete documentation index, see [llms.txt](https://docs.blockz.fi/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.blockz.fi/api/submit-intent/create-intent.md).

# Create Intent

#### Create Intent

Create a new swap intent based on a previously obtained quote.

An intent is created off-chain and defines the swap conditions. Once signed and approved, it can be fulfilled on-chain by a resolver.

```http
POST /affiliate/v1/intents
```

***

#### Request

```json
{
  "quote_id": "fe5601fb-60f2-4cb0-8a67-c55bd3640411",
  "refund_address": "0x000000000000000000000000000000000000000",
  "retail_user_id": "fe5601fb-60f2-4cb0-8a67-c55bd3640411",
  "user_destination_address": "0x000000000000000000000000000000000000000",
  "user_source_address": "0x000000000000000000000000000000000000000",
  "user_source_public_key": "00000000000000000000000000000000000000"
}
```

Request notes:

* `retail_user_id` is optional and may be used by the Partner for analytics or attribution.
* `user_source_public_key` is required field only when source chain is Bitcoin or Solana.

***

#### Response

Response example for EVM and Tron:

```json
{
  "intent_id": "8a2d3f92-2a2b-4e4c-9d8a-3c9f92e4a111",
  "deadline_secs": 1761545456,
  "secret_hash": "0x000000000000000000000000000000000000000000000000000000000000000",
  "approval_mechanism": "permit2",
  "params_to_sign": {
    "escrow_contract_address": "0x000000000000000000000000000000000000000",
    "permit2_contract_address": "0x000000000000000000000000000000000000000",
    "resolver_deposit_address": "0x000000000000000000000000000000000000000",
    "nonce": 10000,
    "additional_data": {
      "domain": { /* EIP-712 domain data */ },
      "types": { /* EIP-712 types */ },
      "witness": { /* witness data */ },
      "witness_type_string": "ExampleTrade witness)ExampleTrade(address exampleTokenAddress,uint256 exampleMinimumAmountOut)",
      "witness_hash": "0x000000000000000000000000000000000000000000000000000000000000000"
    }
  }
}
```

***

#### **Approval Mechanism**

The approval flow depends on the blockchain and swap type.

The value of `approval_mechanism` determines:

* The signing method required
* The structure of `params_to_sign`

Partners must inspect `approval_mechanism` and process `params_to_sign` accordingly.

The structure of `params_to_sign` may vary depending on the mechanism.

#### Approval Mechanism Examples

Permit2 — used for EVM-based blockchains

```json
{
    "intent_id": "528d72ae-61cd-4fbc-9940-48ce4104abbb",
    "deadline_secs": 1772124002,
    "secret_hash": "0x19875e12d834bc245b834c4c031d4b89c6354fba4575e44dd26f37d367a44926",
    "approval_mechanism": "permit2",
    "params_to_sign": {
        "escrow_contract_address": "0x8DcbE1aCf345BF5117543f69C3541e318F8e8836",
        "permit2_contract_address": "0x000000000022D473030F116dDEE9F6B43aC78BA3",
        "resolver_deposit_address": "0xF3B3a4edBb93E8eb85B4DBCB1483B2f69f557029",
        "nonce": 499,
        "additional_data": {
            "domain": { /* EIP-712 domain data */ },
            "types": { /* EIP-712 types */ },
            "witness": { /* witness data */ },
            "secretHash": "0xabcde...",
            "witness_type_string": "DepositWitness witness)DepositWitness(address resolverDepositAddress,bytes32 secretHash,uint256 deadline)TokenPermissions(address token,uint256 amount)",
            "witness_hash": "0xc77ff4a96e07cede0217fa3bf985d16078f9f1b637ea7b60e8b8c12636c39f7f"
        }
    }
}
```

***

HTLC — used for Bitcoin blockchain

```json
{
  "approval_mechanism": "htlc",
  "params_to_sign": {
    "psbt": "cHNidP8BAJ0CAAAAAQEBAQEB...", // psbt in base64.
    "inputs": [0, 1, 2]
  }
}
```

***

Cosigned transaction — used for Solana blockchain

```json
{
    "intent_id": "0a47fbd6-056a-4e4d-a1e3-9b9a1bf947e5",
    "deadline_secs": 1772124152,
    "secret_hash": "0x84edcf73255d3a419a9f12686128d0ef00bfff31e82b110fe160dd0fb60baccf",
    "approval_mechanism": "cosign",
    "params_to_sign": {
        "transaction": "02000..." // versioned transaction in hex
    }
}
```
