> For the complete documentation index, see [llms.txt](https://docs.4p.finance/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.4p.finance/en/off-ramp/creating-a-transaction.md).

# Creating a transaction

### Service

* Sends a JSON containing the data required to create an instant sale.
* Returns a JSON containing the data of the created conversion, including the network, token, and wallet to which the crypto assets should be sent.

### Registration/transaction request

The request to create/register a transaction must have, as the JSON request body, the information required to register the transaction.

### Payload example

```json
{
  "person_document": "01234567899",
  "email": "user@example.com",
  "amount_crypto": 1.10,
  "custom_id": "PN123",
  "custom_data": {
    "chain": "Arbitrum",
    "asset": "USDT"
  },
  "sender_wallet": "0x4328...edFB995B6I",
  "destination_pix_key": "01234567899",
  "notification_url": "https://your-webhook-domain.com/param=tes&token=abcd-dfg"
}
```

### Request

Requests the creation/registration of a transaction.

`PUT` `https://api.4p.finance/v1/cryptopix/transaction`

Submits the request to register a transaction.

#### Headers

| Name        | Type   | Description   |
| ----------- | ------ | ------------- |
| x-api-key\* | String | Your API key. |

#### Request Body

| Name                    | Type   | Description                                                                                                                                                                                                 |
| ----------------------- | ------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| custom\_id \*           | String | Transaction Id. Allows the receiving user to reconcile payments. Must be unique per transaction and contain a maximum of 255 characters.                                                                    |
| destination\_pix\_key\* | String | Pix key to which the fiat amount (BRL) will be sent after the crypto assets are received and converted. If not provided, the Pix payment will be sent to the key that must have been previously registered. |
| sender\_wallet\*        | String | Key used to send the paying customer's wallet, which must be the mandatory origin of the crypto asset transfer.                                                                                             |
| notification\_url \*    | String | URL that will receive the POST notifications sent by the webhook service right after the crypto assets are sent and converted.                                                                              |
| amount\_crypto\*        | Float  | Original charge amount in crypto assets. Must be a value greater than or equal to 0.01, with decimal places.                                                                                                |
| person\_document\*      | String | Document or identification number of the user to whom the transaction should be associated, equivalent to the CPF.                                                                                          |
| custom\_data\*          | Object | Parent object for data related to the network and token that will be the target of the transaction.                                                                                                         |

{% tabs %}
{% tab title="200: OK Response after creating/registering a transaction." %}

```json
{
  "http_code": 200,
  "success": true,
  "info": {
    "result": "p2p_transaction_cryptopix_created",
    "message": "P2P transaction promise has been created. Please transfer the crypto to the indicated wallet to proceed.",
    "data": {
      "txid": "da75257ce3f19483ef1049fef890a310",
      "amount_crypto": 1.10,
      "asset": "USDT",
      "chain": "arbitrum",
      "amount_brl": 5.49,
      "receiver_wallet": "0x4328...edFB995B6I",
      "expires": 1769608117
    }
  }
}
```

{% endtab %}
{% endtabs %}

### Response

Note that the data object contains the transaction information, including the destination wallet for the crypto assets (receiver\_wallet). The assets must be sent to this wallet in exactly the amount specified, originating from the paying customer's wallet indicated when the transaction was created.

{% hint style="warning" %}
Please note that the *data* object will include an *expires* key, which represents the maximum period during which the transaction will be monitored. After this expiration, a new transaction must be created before sending the crypto assets.
{% endhint %}

### Conclusion

After confirmation that the cryptocurrency has been received, the amount converted into fiat will be automatically sent to the Pix key provided in the request payload, or previously associated with the user's account.

The average time to send and finalize the transaction is approximately 10 seconds, and may vary depending on the selected blockchain network and that network's conditions at the time of the operation.

Learn more about notifications and callbacks in the next section.
