
# Point de terminaison exchange {#exchange-endpoint}

Le point de terminaison d'échange est utilisé pour interagir et trader sur la chaîne Hyperliquid. Consultez le code Python SDK pour générer des signatures pour ces requêtes.

### Actif {#asset}

La plupart des demandes prennent l'actif comme une entrée. Pour les perpétuels, c'est l'index dans le champ `universe` retourné par la réponse `meta`. Pour les actifs spot, utilisez `10000 + index` où `index` est l'indice correspondant dans `spotMeta.universe`. Par exemple, lors de l'envoi d'une commande pour `PURR/USDC`, l'actif qui doit être utilisé est `10000` car son index d'actifs dans les métadonnées spot est `0`.

### Sous-comptes et chambres fortes {#subaccounts-and-vaults}

Les sous-comptes et les coffres n'ont pas de clés privées. Pour effectuer des actions au nom d'un sous-compte ou d'un coffre, la signature doit être effectuée par le compte principal et le champ vaultAddress doit être défini sur l'adresse du sous-compte ou du coffre. The basic\_vault.py example in the Python SDK demonstrates this.

### Expire après {#expires-after}

Certaines actions prennent en charge un champ optionnel `expiresAfter` qui est un horodatage en millisecondes après quoi l'action sera rejetée. Les actions signées par l'utilisateur telles que le transfert Core USDC ne prennent pas en charge le champ `expiresAfter`. Notez que les actions consomment 5x la limite de débit basée sur l'adresse habituelle lorsqu'elles sont annulées en raison d'un champ `expiresAfter` périmé.

Voir le Python SDK pour plus de détails sur la façon d'incorporer ce champ lors de la signature.

## Passer une commande {#place-an-order}

<mark style="color:green;">`POST`</mark> `https://api.hyperliquid.xyz/exchange`

Voir Python SDK pour des exemples complets sur les champs de la demande de commande.

Pour les ordres limités, TIF (temps en vigueur) définit le comportement de l'ordre lors de la première frappe sur le livre.

ALO (ajoutez de la liquidité seulement, c'est-à-dire "post only") sera annulé au lieu de correspondre immédiatement.

IOC (immédiat ou annulé) aura la partie non remplie annulée au lieu de se reposer.

GTC (bon jusqu'à annulé) commandes n'ont pas de comportement particulier.

ID (cloïde) est une chaîne hexadécimale optionnelle de bit de 128, par ex. `0x1234567890abcdef1234567890abcdef`

#### En-têtes {#headers}

| Nom | Type | Description |
| ---------------------------------------------- | ------ | ------------------ |
| Content-Type<mark style="color:red;">\*</mark> | String | "application/json" |

#### Corps de la requête {#request-body}

| Nom | Type | Description |       |                                                                                                                                                     |                                                                                                       |              |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
| ------------------------------------------- | ------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----- | --------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------- | ------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| action<mark style="color:red;">\*</mark>    | Object | <p>{</p><p>  "type": "order",<br>  "orders": \[{</p><p>    "a": Number,</p><p>    "b": Boolean,</p><p>    "p": String,</p><p>    "s": String,</p><p>    "r": Boolean,</p><p>    "t": {</p><p>      "limit": {</p><p>        "tif": "Alo" | "Ioc" | "Gtc"</p><p>      } or</p><p>      "trigger": {</p><p>         "isMarket": Boolean,</p><p>         "triggerPx": String,</p><p>         "tpsl": "tp" | "sl"</p><p>       }</p><p>    },</p><p>    "c": Cloid (optional)</p><p>  }],</p><p>  "grouping": "na" | "normalTpsl" | "positionTpsl",</p><p>  "builder": Optional({"b": "address", "f": Number, "s": Optional(\[{"b": "address", "s": Number}])})</p><p>}<br><br>Signification des clés:<br>a est un actif<br>b est isBuy<br>p est le prix<br>s est la taille<br>r est reduceOnly<br>t est le type<br>c est cloid (identifiant d'ordre client)<br><br>Signification des clés dans l'argument constructeur optionnel :<br>b est l'adresse à laquelle les frais supplémentaires doivent être perçus<br>f est la taille de la taxe en dixièmes d'un point de base, par exemple si f est 10, 1bp de la commande théorique sera facturé à l'utilisateur et envoyé au constructeur<br>s est une liste facultative de sous-constructeurs jusqu'à 5 qui reçoivent une partie des frais de construction. Dans chaque entrée b est l'adresse, qui doit être un utilisateur existant, et s est la part des frais de constructeur dans les unités de 0.001%, par exemple si s est 50000, la moitié des frais de constructeur est envoyée à cette adresse. Les actions doivent être positives et sum au plus 100%. Le constructeur reçoit le reste</p> |
| nonce<mark style="color:red;">\*</mark>     | Number | Recommandé pour utiliser l'horodatage actuel en millisecondes |       |                                                                                                                                                     |                                                                                                       |              |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
| signature<mark style="color:red;">\*</mark> | Object |                                                                                                                                                                                                                                          |       |                                                                                                                                                     |                                                                                                       |              |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
| vaultAddress                                | String | Si vous négociez pour le compte d'un coffre ou d'un sous-compte, son adresse Onchain au format hexadécimal de caractère 42; par exemple 0x0000000000000000000000000000000000000000 |       |                                                                                                                                                     |                                                                                                       |              |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
| expiresAfter                                | Number | Horodatage en millisecondes |       |                                                                                                                                                     |                                                                                                       |              |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |


**200: OK Réponse réussie (ordre en attente)**


```
{
   "status":"ok",
   "response":{
      "type":"order",
      "data":{
         "statuses":[
            {
               "resting":{
                  "oid":77738308
               }
            }
         ]
      }
   }
}
```



**200: OK Réponse d’erreur**


```
{
   "status":"ok",
   "response":{
      "type":"order",
      "data":{
         "statuses":[
            {
               "error":"Order must have minimum value of $10."
            }
         ]
      }
   }
}
```



**200: OK Réponse réussie (ordre exécuté)**


```
{
   "status":"ok",
   "response":{
      "type":"order",
      "data":{
         "statuses":[
            {
               "filled":{
                  "totalSz":"0.02",
                  "avgPx":"1891.4",
                  "oid":77747314
               }
            }
         ]
      }
   }
}
```


## Annuler commande(s) {#cancel-orders}

<mark style="color:green;">`POST`</mark> `https://api.hyperliquid.xyz/exchange`

#### En-têtes {#headers_1}

| Nom | Type | Description |
| ---------------------------------------------- | ------ | ------------------ |
| Content-Type<mark style="color:red;">\*</mark> | String | "application/json" |

#### Corps de la requête {#request-body_1}

| Nom | Type | Description |
| ------------------------------------------- | ------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| action<mark style="color:red;">\*</mark>    | Object | <p>{</p><p>  "type": "cancel",</p><p>  "cancels": \[</p><p>    {</p><p>      "a": Number,</p><p>      "o": Number</p><p>    }</p><p>  ],</p><p>  "f": Boolean // fast</p><p>}<br><br>Signification des clés:<br>a est un actif<br>o est oid (ID d'ordre)</p> |
|                                             |        |                                                                                                                                                                                                                                                |
| nonce<mark style="color:red;">\*</mark>     | Number | Recommandé pour utiliser l'horodatage actuel en millisecondes |
| signature<mark style="color:red;">\*</mark> | Object |                                                                                                                                                                                                                                                |
| vaultAddress                                | String | Si vous négociez pour le compte d'un coffre ou d'un sous-compte, son adresse au format hexadécimal de caractère 42; par exemple 0x0000000000000000000000000000000000000000 |
| expiresAfter                                | Number | Horodatage en millisecondes |


**200: OK Réponse réussie**


```
{
   "status":"ok",
   "response":{
      "type":"cancel",
      "data":{
         "statuses":[
            "success"
         ]
      }
   }
}
```



**200: OK Réponse d’erreur**


```
{
   "status":"ok",
   "response":{
      "type":"cancel",
      "data":{
         "statuses":[
            {
               "error":"Order was never placed, already canceled, or filled."
            }
         ]
      }
   }
}
```


Les deux actions `cancel` et `cancelByCloid` incluent un drapeau optionnel `fast`, codé en tant que `f` dans l'action. Les ordres avec `f: true` sont rejetés s'ils se réfèrent à des ordres de déclenchement. Actuellement `fast` n'a pas d'autre effet. Dans une future mise à niveau réseau, les actions d'annulation seront prioritaires dans le mempool si et seulement si `fast = true`.

Notez que `f` doit être ignoré si false, c'est-à-dire que les actions hachées avec `f: false` seront rejetées.

## Annuler la commande(s) par cloid {#cancel-orders-by-cloid}

<mark style="color:green;">`POST`</mark> `https://api.hyperliquid.xyz/exchange`

#### En-têtes {#headers_2}

| Nom | Type | Description |
| ---------------------------------------------- | ------ | ------------------ |
| Content-Type<mark style="color:red;">\*</mark> | String | "application/json" |

#### Corps de la requête {#request-body_2}

| Nom | Type | Description |
| ------------------------------------------- | ------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| action<mark style="color:red;">\*</mark>    | Object | <p>{</p><p>  "type": "cancelByCloid",</p><p>  "cancels": \[</p><p>    {</p><p>      "asset": Number,</p><p>      "cloid": String</p><p>    }</p><p>  ],</p><p>  "f": Boolean // fast</p><p>}</p> |
| nonce<mark style="color:red;">\*</mark>     | Number | Recommandé pour utiliser l'horodatage actuel en millisecondes |
| signature<mark style="color:red;">\*</mark> | Object |                                                                                                                                                                                                  |
| vaultAddress                                | String | Si vous négociez pour le compte d'un coffre ou d'un sous-compte, son adresse au format hexadécimal de caractère 42; par exemple 0x0000000000000000000000000000000000000000 |
| expiresAfter                                | Number | Horodatage en millisecondes |


**200: OK Réponse réussie**




**200: OK Réponse d’erreur**



## Horaire d'annulation (interrupteur de l'homme mort) {#schedule-cancel-dead-mans-switch}

<mark style="color:green;">`POST`</mark> `https://api.hyperliquid.xyz/exchange`

#### En-têtes {#headers_3}

| Nom | Type | Description |
| ---------------------------------------------- | ------ | ------------------ |
| Content-Type<mark style="color:red;">\*</mark> | String | "application/json" |

#### Corps de la requête {#request-body_3}

| Nom | Type | Description |
| ------------------------------------------- | ------ | ---------------------------------------------------------------------------------------------------------------------------------------------- |
| action<mark style="color:red;">\*</mark>    | Object | <p>{</p><p>  "type": "scheduleCancel",</p><p>  "time": number (optional)</p><p>}</p> |
| nonce<mark style="color:red;">\*</mark>     | Number | Recommandé pour utiliser l'horodatage actuel en millisecondes |
| signature<mark style="color:red;">\*</mark> | Object |                                                                                                                                                |
| vaultAddress                                | String | Si vous négociez pour le compte d'un coffre ou d'un sous-compte, son adresse au format hexadécimal de caractère 42; par exemple 0x0000000000000000000000000000000000000000 |
| expiresAfter                                | Number | Horodatage en millisecondes |

Planifiez une opération d'annulation à une date ultérieure. Ne pas inclure le temps supprimera l'opération d'annulation planifiée. L'heure doit être au moins 5 secondes après l'heure courante. Une fois que le temps est venu, tous les ordres ouverts seront annulés et un nombre de déclenchement sera incrémenté. Le nombre maximum de déclencheurs par jour est 10. Ce nombre de déclencheurs est réinitialisé à 00:00 UTC.

## Modifier une commande {#modify-an-order}

<mark style="color:green;">`POST`</mark> `https://api.hyperliquid.xyz/exchange`

#### En-têtes {#headers_4}

| Nom | Type | Description |
| ---------------------------------------------- | ------ | ------------------ |
| Content-Type<mark style="color:red;">\*</mark> | String | "application/json" |

#### Corps de la requête {#request-body_4}

| Nom | Type | Description |                                                                                                                                                                                                                   |       |                                                                                                                                                     |                                                                                                                                                                                                                                                                              |
| ------------------------------------------- | ------ | ------------------------------------------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----- | --------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| action<mark style="color:red;">\*</mark>    | Object | <p>{</p><p>  "type": "modify",</p><p>  "oid": Number | Cloid,</p><p>  "order": {</p><p>    "a": Number,</p><p>    "b": Boolean,</p><p>    "p": String,</p><p>    "s": String,</p><p>    "r": Boolean,</p><p>    "t": {</p><p>      "limit": {</p><p>        "tif": "Alo" | "Ioc" | "Gtc"</p><p>      } or</p><p>      "trigger": {</p><p>         "isMarket": Boolean,</p><p>         "triggerPx": String,</p><p>         "tpsl": "tp" | "sl"</p><p>       }</p><p>    },</p><p>    "c": Cloid (optional)</p><p>  },</p><p>  "a": Boolean // always\_place</p><p>}<br><br>Signification des clés:<br>a est un actif<br>b est isBuy<br>p est le prix<br>s est la taille<br>r est reduceOnly<br>t est le type<br>c est cloid (identifiant d'ordre client)</p> |
| nonce<mark style="color:red;">\*</mark>     | Number | Recommandé pour utiliser l'horodatage actuel en millisecondes |                                                                                                                                                                                                                   |       |                                                                                                                                                     |                                                                                                                                                                                                                                                                              |
| signature<mark style="color:red;">\*</mark> | Object |                                                                                                                                                        |                                                                                                                                                                                                                   |       |                                                                                                                                                     |                                                                                                                                                                                                                                                                              |
| vaultAddress                                | String | Si vous négociez pour le compte d'un coffre ou d'un sous-compte, son adresse Onchain au format hexadécimal de caractère 42; par exemple 0x0000000000000000000000000000000000000000 |                                                                                                                                                                                                                   |       |                                                                                                                                                     |                                                                                                                                                                                                                                                                              |
| expiresAfter                                | Number | Horodatage en millisecondes |                                                                                                                                                                                                                   |       |                                                                                                                                                     |                                                                                                                                                                                                                                                                              |


**200: OK Réponse réussie**




**200: OK Réponse d’erreur**



Les actions de modification simple et par lot incluent un indicateur `always_place` optionnel, encodé en tant que `a` dans l'action. Lorsque `always_place = true` placera la nouvelle commande, que l'annulation ait réussi ou non. Lorsque `always_place = false` le nouvel ordre doit être un ordre non déclencheur, et doit avoir TIF = ALO ou un ordre non exécutable avec TIF = GTC. Dans ce dernier cas, TIF du nouvel ordre est remplacé par ALO.

Notez que `a` doit être ignoré si false, c'est-à-dire que les actions hachées avec `a: false` seront rejetées.

## Modifier plusieurs commandes {#modify-multiple-orders}

<mark style="color:green;">`POST`</mark> `https://api.hyperliquid.xyz/exchange`

#### En-têtes {#headers_5}

| Nom | Type | Description |
| ---------------------------------------------- | ------ | ------------------ |
| Content-Type<mark style="color:red;">\*</mark> | String | "application/json" |

#### Corps de la requête {#request-body_5}

| Nom | Type | Description |                                                                                                                                                                                                                                     |       |                                                                                                                                                               |                                                                                                                                                                                                                                                                                                 |
| ------------------------------------------- | ------ | ------------------------------------------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----- | ------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| action<mark style="color:red;">\*</mark>    | Object | <p>{</p><p>  "type": "batchModify",</p><p>  "modifies": \[{</p><p>    "oid": Number | Cloid,</p><p>    "order": {</p><p>      "a": Number,</p><p>      "b": Boolean,</p><p>      "p": String,</p><p>      "s": String,</p><p>      "r": Boolean,</p><p>      "t": {</p><p>        "limit": {</p><p>          "tif": "Alo" | "Ioc" | "Gtc"</p><p>        } or</p><p>        "trigger": {</p><p>           "isMarket": Boolean,</p><p>           "triggerPx": String,</p><p>           "tpsl": "tp" | "sl"</p><p>         }</p><p>      },</p><p>      "c": Cloid (optional)</p><p>    }</p><p>  }],</p><p>  "a": Boolean // always\_place</p><p>}<br><br>Signification des clés:<br>a est un actif<br>b est isBuy<br>p est le prix<br>s est la taille<br>r est reduceOnly<br>t est le type<br>c est cloid (identifiant d'ordre client)</p> |
| nonce<mark style="color:red;">\*</mark>     | Number | Recommandé pour utiliser l'horodatage actuel en millisecondes |                                                                                                                                                                                                                                     |       |                                                                                                                                                               |                                                                                                                                                                                                                                                                                                 |
| signature<mark style="color:red;">\*</mark> | Object |                                                                                                                                                        |                                                                                                                                                                                                                                     |       |                                                                                                                                                               |                                                                                                                                                                                                                                                                                                 |
| vaultAddress                                | String | Si vous négociez pour le compte d'un coffre ou d'un sous-compte, son adresse Onchain au format hexadécimal de caractère 42; par exemple 0x0000000000000000000000000000000000000000 |                                                                                                                                                                                                                                     |       |                                                                                                                                                               |                                                                                                                                                                                                                                                                                                 |
| expiresAfter                                | Number | Horodatage en millisecondes |                                                                                                                                                                                                                                     |       |                                                                                                                                                               |                                                                                                                                                                                                                                                                                                 |

## Mettre à jour le levier {#update-leverage}

<mark style="color:green;">`POST`</mark> `https://api.hyperliquid.xyz/exchange`

Mettre à jour un effet de levier croisé ou isolé sur une pièce.

#### En-têtes {#headers_6}

| Nom | Type | Description |
| ---------------------------------------------- | ------ | ------------------ |
| Content-Type<mark style="color:red;">\*</mark> | String | "application/json" |

#### Corps de la requête {#request-body_6}

| Nom | Type | Description |
| ------------------------------------------- | ------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| action<mark style="color:red;">\*</mark>    | Object | <p>{</p><p>  "type": "updateLeverage",</p><p>  "asset": index of coin,</p><p>  "isCross": true or false if updating cross-leverage,</p><p>  "leverage": integer representing new leverage, subject to leverage constraints on that coin</p><p>}</p> |
| nonce<mark style="color:red;">\*</mark>     | Number | Recommandé pour utiliser l'horodatage actuel en millisecondes |
| signature<mark style="color:red;">\*</mark> | Object |                                                                                                                                                                                                                                                     |
| vaultAddress                                | String | Si vous négociez pour le compte d'un coffre ou d'un sous-compte, son adresse Onchain au format hexadécimal de caractère 42; par exemple 0x0000000000000000000000000000000000000000 |
| expiresAfter                                | Number | Horodatage en millisecondes |


**200: OK Réponse réussie**


```
{'status': 'ok', 'response': {'type': 'default'}}
```


## Mettre à jour la marge isolée {#update-isolated-margin}

<mark style="color:green;">`POST`</mark> `https://api.hyperliquid.xyz/exchange`

Ajouter ou supprimer une marge d'une position isolée

Notez que pour cibler un effet de levier spécifique au lieu d'une valeur USDC de changement de marge, il existe une action alternative `{"type": "topUpIsolatedOnlyMargin", "asset": <asset>, "leverage": <float string>}`

#### En-têtes {#headers_7}

| Nom | Type | Description |
| ---------------------------------------------- | ------ | ------------------ |
| Content-Type<mark style="color:red;">\*</mark> | String | "application/json" |

#### Corps de la requête {#request-body_7}

| Nom | Type | Description |
| ------------------------------------------- | ------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| action<mark style="color:red;">\*</mark>    | Object | <p>{</p><p>  "type": "updateIsolatedMargin",</p><p>  "asset": index of coin,</p><p>  "isBuy": true, (this parameter won't have any effect until hedge mode is introduced)</p><p>  "ntli": int representing amount to add or remove with 6 decimals, e.g. 1000000 for 1 usd,</p><p>}</p> |
| nonce<mark style="color:red;">\*</mark>     | Number | Recommandé pour utiliser l'horodatage actuel en millisecondes |
| signature<mark style="color:red;">\*</mark> | Object |                                                                                                                                                                                                                                                                                         |
| vaultAddress                                | String | Si vous négociez pour le compte d'un coffre ou d'un sous-compte, son adresse Onchain au format hexadécimal de caractère 42; par exemple 0x0000000000000000000000000000000000000000 |
| expiresAfter                                | Number | Horodatage en millisecondes |


**200: OK Réponse réussie**


```
{'status': 'ok', 'response': {'type': 'default'}}
```


## Envoyer la ressource {#send-asset}

<mark style="color:green;">`POST`</mark> `https://api.hyperliquid.xyz/exchange`

Cette méthode généralisée est utilisée pour transférer des jetons entre différents DEX perp, solde au comptant, utilisateurs et / ou sous-comptes. Use "" to specify the default USDC perp DEX and "spot" to specify spot. Seul le jeton de garantie peut être transféré vers ou depuis un perp DEX.

#### En-têtes {#headers_8}

| Nom | Valeur |
| ---------------------------------------------- | ------------------ |
| Content-Type<mark style="color:red;">\*</mark> | `application/json` |

#### Corps {#body}

| Nom | Type | Description |
| ------------------------------------------- | ------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| action<mark style="color:red;">\*</mark>    | Object | <p>{</p><p>  "type": "sendAsset",</p><p>  "hyperliquidChain": "Mainnet" (on testnet use "Testnet" instead),</p><p>  "signatureChainId": the id of the chain used when signing in hexadecimal format; e.g. "0xa4b1" for Arbitrum,</p><p>  "destination": address in 42-character hexadecimal format; e.g. 0x0000000000000000000000000000000000000000,</p><p>  "sourceDex": name of perp dex to transfer from,</p><p>  "destinationDex": name of the perp dex to transfer to,</p><p>  "token": tokenName:tokenId; e.g. "PURR:0xc4bf3f870c0e9465323c0b6ed28096c2",</p><p>  "amount": amount of token to send as a string; e.g. "0.01",</p><p>  "fromSubAccount": address in 42-character hexadecimal format or empty string if not from a subaccount,</p><p>  "nonce": current timestamp in milliseconds as a Number, should match nonce</p><p>}</p> |
| nonce<mark style="color:red;">\*</mark>     | Number | Recommandé d'utiliser l'horodatage courant en millisecondes, doit correspondre au nonce dans l'action Objet ci-dessus |
| signature<mark style="color:red;">\*</mark> | Object |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |

#### Réponse {#response}


**200: OK**


```
{'status': 'ok', 'response': {'type': 'default'}}
```


## Agent Envoyer la ressource {#agent-send-asset}

<mark style="color:green;">`POST`</mark> `https://api.hyperliquid.xyz/exchange`

Cette action fonctionne comme un transfert d’actifs, mais un agent peut la signer. L’adresse de destination doit être identique à l’adresse source. Utilisez "" pour désigner le DEX de contrats perpétuels USDC par défaut et "spot" pour le marché au comptant. Seul le jeton de garantie peut être transféré vers ou depuis un DEX de contrats perpétuels.

#### En-têtes {#headers_9}

| Nom | Valeur |
| ---------------------------------------------- | ------------------ |
| Content-Type<mark style="color:red;">\*</mark> | `application/json` |

#### Corps {#body_1}

| Nom | Type | Description |
| ------------------------------------------- | ------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| action<mark style="color:red;">\*</mark>    | Object | <p>{</p><p>  "type": "agentSendAsset",</p><p>  "destination": address in 42-character hexadecimal format; e.g. 0x0000000000000000000000000000000000000000,</p><p>  "sourceDex": name of perp dex to transfer from,</p><p>  "destinationDex": name of the perp dex to transfer to,</p><p>  "token": tokenName:tokenId; e.g. "PURR:0xc4bf3f870c0e9465323c0b6ed28096c2",</p><p>  "amount": amount of token to send as a string; e.g. "0.01",</p><p>  "fromSubAccount": address in 42-character hexadecimal format or empty string if not from a subaccount,</p><p>  "nonce": current timestamp in milliseconds as a Number, should match nonce</p><p>}</p> |
| nonce<mark style="color:red;">\*</mark>     | Number | Recommandé d'utiliser l'horodatage courant en millisecondes, doit correspondre au nonce dans l'action Objet ci-dessus |
| signature<mark style="color:red;">\*</mark> | Object |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |

#### Réponse {#response_1}


**200: OK**


```
{'status': 'ok', 'response': {'type': 'default'}}
```


## Envoyer à EVM avec les données {#send-to-evm-with-data}

<mark style="color:green;">`POST`</mark> `https://api.hyperliquid.xyz/exchange`

Action spécialisée pour le transfert Core vers EVM qui inclut une charge utile de données supplémentaire. Voir [Transferts entre HyperCore et HyperEVM](https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/hyperevm/hypercore-less-than-greater-than-hyperevm-transfers) pour plus de détails. Lorsqu'il est utilisé, coreReceiveWithData sera appelé sur le contrat lié au lieu du transfert. IMPORTANT: il est de la responsabilité de l'appelant de s'assurer que le jeton est correctement lié et que le contrat lié prend en charge l'interface suivante:<br>

```
interface ICoreReceiveWithData {
  function coreReceiveWithData(
    address from,
    bytes32 destinationRecipient,
    uint32 destinationChainId,
    uint256 amount,
    uint64 nonce,
    bytes calldata data
  ) external;
}
```

#### En-têtes {#headers_10}

| Nom | Valeur |
| ---------------------------------------------- | ------------------ |
| Content-Type<mark style="color:red;">\*</mark> | `application/json` |

#### Corps {#body_2}

| Nom | Type | Description |                                                                                                                                                                                                   |
| ------------------------------------------- | ------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| action<mark style="color:red;">\*</mark>    | Object | <p>{</p><p>  "type": "sendToEvmWithData",</p><p>  "hyperliquidChain": "Mainnet" (on testnet use "Testnet" instead),</p><p>  "signatureChainId": the id of the chain used when signing in hexadecimal format; e.g. "0xa4b1" for Arbitrum,</p><p>  "token": tokenName:tokenId; e.g. "PURR:0xc4bf3f870c0e9465323c0b6ed28096c2",</p><p>  "amount": amount of token to send as a string; e.g. "0.01",</p><p>  "sourceDex": name of perp dex to transfer from,</p><p>  "destinationRecipient": address in addressEncoding format,</p><p>  "addressEncoding": "hex" | "base58",</p><p>  "destinationChainId": number,</p><p>  "gasLimit": number,</p><p>  "data": bytes,</p><p>  "nonce": current timestamp in milliseconds as a Number, should match nonce</p><p>}</p> |
| nonce<mark style="color:red;">\*</mark>     | Number | Recommandé d'utiliser l'horodatage courant en millisecondes, doit correspondre au nonce dans l'action Objet ci-dessus |                                                                                                                                                                                                   |
| signature<mark style="color:red;">\*</mark> | Object |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |                                                                                                                                                                                                   |

#### Réponse {#response_2}


**200: OK**


```
{'status': 'ok', 'response': {'type': 'default'}}
```


## Transfert de noyau USDC {#core-usdc-transfer}

<mark style="color:green;">`POST`</mark> `https://api.hyperliquid.xyz/exchange`

Envoyez-nous une autre adresse. Ce transfert ne touche pas le pont EVM. Le format de signature est lisible par l'homme pour les interfaces de portefeuille.

#### En-têtes {#headers_11}

| Nom | Type | Description |
| ---------------------------------------------- | ------ | ------------------ |
| Content-Type<mark style="color:red;">\*</mark> | String | "application/json" |

#### Corps de la requête {#request-body_8}

| Nom | Type | Description |
| ------------------------------------------- | ------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| action<mark style="color:red;">\*</mark>    | Object | <p>{</p><p>  "type": "usdSend",</p><p>  "hyperliquidChain": "Mainnet" (on testnet use "Testnet" instead),<br>  "signatureChainId": the id of the chain used when signing in hexadecimal format; e.g. "0xa4b1" for Arbitrum,</p><p>  "destination": address in 42-character hexadecimal format; e.g. 0x0000000000000000000000000000000000000000,</p><p>   "amount": amount of usd to send as a string, e.g. "1" for 1 usd,</p><p>     "time": current timestamp in milliseconds as a Number, should match nonce</p><p>}</p> |
| nonce<mark style="color:red;">\*</mark>     | Number | Recommandé pour utiliser l'horodatage actuel en millisecondes |
| signature<mark style="color:red;">\*</mark> | Object |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |


**200: OK Réponse réussie**


```
{'status': 'ok', 'response': {'type': 'default'}}
```


## Core spot transfer

<mark style="color:green;">`POST`</mark> `https://api.hyperliquid.xyz/exchange`

Envoyer des actifs spot à une autre adresse. Ce transfert ne touche pas le pont EVM. Le format de signature est lisible par l'homme pour les interfaces de portefeuille.

#### En-têtes {#headers_12}

| Nom | Type | Description |
| ---------------------------------------------- | ------ | ------------------ |
| Content-Type<mark style="color:red;">\*</mark> | String | "application/json" |

#### Corps de la requête {#request-body_9}

| Nom | Type | Description |
| ------------------------------------------- | ------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| action<mark style="color:red;">\*</mark>    | Object | <p>{</p><p>  "type": "spotSend",</p><p>  "hyperliquidChain": "Mainnet" (on testnet use "Testnet" instead),<br>  "signatureChainId": the id of the chain used when signing in hexadecimal format; e.g. "0xa4b1" for Arbitrum,</p><p>  "destination": address in 42-character hexadecimal format; e.g. 0x0000000000000000000000000000000000000000,<br>  "token": tokenName:tokenId; e.g. "PURR:0xc4bf3f870c0e9465323c0b6ed28096c2",</p><p>   "amount": amount of token to send as a string, e.g. "0.01",</p><p>     "time": current timestamp in milliseconds as a Number, should match nonce</p><p>}</p> |
| nonce<mark style="color:red;">\*</mark>     | Number | Recommandé pour utiliser l'horodatage actuel en millisecondes |
| signature<mark style="color:red;">\*</mark> | Object |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |


**200: OK Réponse réussie**


```
{'status': 'ok', 'response': {'type': 'default'}}
```


```
Example sign typed data for generating the signature:
{
  "types": {
    "HyperliquidTransaction:SpotSend": [
      {
        "name": "hyperliquidChain",
        "type": "string"
      },
      {
        "name": "destination",
        "type": "string"
      },
      {
        "name": "token",
        "type": "string"
      },
      {
        "name": "amount",
        "type": "string"
      },
      {
        "name": "time",
        "type": "uint64"
      }
    ]
  },
  "primaryType": "HyperliquidTransaction:SpotSend",
  "domain": {
    "name": "HyperliquidSignTransaction",
    "version": "1",
    "chainId": 42161,
    "verifyingContract": "0x0000000000000000000000000000000000000000"
  },
  "message": {
    "destination": "0x0000000000000000000000000000000000000000",
    "token": "PURR:0xc1fb593aeffbeb02f85e0308e9956a90",
    "amount": "0.1",
    "time": 1716531066415,
    "hyperliquidChain": "Mainnet"
  }
}
```

## Lancer une demande de retrait {#initiate-a-withdrawal-request}

<mark style="color:green;">`POST`</mark> `https://api.hyperliquid.xyz/exchange`

Cette méthode est utilisée pour initier le flux de soutirage. Après avoir fait cette demande, les validateurs L1 signeront et enverront la demande de retrait au contrat de pont. Il y a des frais de $1 pour retirer au moment de cet écrit et les retraits prennent environ 5 minutes pour finaliser.

#### En-têtes {#headers_13}

| Nom | Type | Description |
| ---------------------------------------------- | ------ | ------------------ |
| Content-Type<mark style="color:red;">\*</mark> | String | "application/json" |

#### Corps de la requête {#request-body_10}

| Nom | Type | Description |
| ------------------------------------------- | ------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| action<mark style="color:red;">\*</mark>    | Object | <p>{<br>  "type": "withdraw3",</p><p>  "hyperliquidChain": "Mainnet" (on testnet use "Testnet" instead),<br>  "signatureChainId": the id of the chain used when signing in hexadecimal format; e.g. "0xa4b1" for Arbitrum,</p><p>  "amount": amount of usd to send as a string, e.g. "1" for 1 usd,</p><p>  "time": current timestamp in milliseconds as a Number, should match nonce,</p><p>  "destination": address in 42-character hexadecimal format; e.g. 0x0000000000000000000000000000000000000000</p><p>}</p> |
| nonce<mark style="color:red;">\*</mark>     | Number | Recommandé d'utiliser l'horodatage courant en millisecondes, doit correspondre au nonce dans l'action Objet ci-dessus |
| signature<mark style="color:red;">\*</mark> | Object |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |


**200: OK**


```
{'status': 'ok', 'response': {'type': 'default'}}
```


## Transférer du compte Spot au compte Perp (et vice versa) {#transfer-from-spot-account-to-perp-account-and-vice-versa}

<mark style="color:green;">`POST`</mark> `https://api.hyperliquid.xyz/exchange`

Cette méthode est utilisée pour transférer USDC du portefeuille spot de l'utilisateur au portefeuille perp et vice versa.

**En-têtes**

| Nom | Valeur |
| ---------------------------------------------- | ------------------ |
| Content-Type<mark style="color:red;">\*</mark> | "application/json" |

**Corps**

<table><thead><tr><th>Nom</th><th width="200">Type</th><th>Description</th></tr></thead><tbody><tr><td>action<mark style="color:red;">*</mark></td><td>Objet</td><td><p>{</p><p>  "type": "usdClassTransfer",</p><p>  "hyperliquidChain": "Mainnet" (on testnet use "Testnet" instead),<br>  "signatureChainId": the id of the chain used when signing in hexadecimal format; e.g. "0xa4b1" for Arbitrum,</p><p> "amount": amount of usd to transfer as a string, e.g. "1" for 1 usd. If you want to use this action for a subaccount, you can include subaccount: address after the amount, e.g. "1" subaccount:0x0000000000000000000000000000000000000000,</p><p>  "toPerp": true if (spot -> perp) else false,</p><p>"nonce": current timestamp in milliseconds as a Number, must match nonce in outer request body</p><p>}</p></td></tr><tr><td>nonce<mark style="color:red;">*</mark></td><td>Nombre</td><td>Recommandé d'utiliser l'horodatage courant en millisecondes, doit correspondre au nonce dans l'action Objet ci-dessus</td></tr><tr><td>signature<mark style="color:red;">*</mark></td><td>Objet</td><td></td></tr></tbody></table>

**Réponse**


**200: OK**


```json
{'status': 'ok', 'response': {'type': 'default'}}
```


## Dépôt en jalonnement {#deposit-into-staking}

<mark style="color:green;">`POST`</mark> `https://api.hyperliquid.xyz/exchange`

Cette méthode est utilisée pour transférer le jeton natif du compte spot de l'utilisateur au staking pour la délégation aux validateurs.

#### En-têtes {#headers_14}

| Nom | Valeur |
| ---------------------------------------------- | ------------------ |
| Content-Type<mark style="color:red;">\*</mark> | `application/json` |

#### Corps {#body_3}

| Nom | Type | Description |
| ------------------------------------------- | ------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| action<mark style="color:red;">\*</mark>    | Object | <p>{</p><p>  "type": "cDeposit",</p><p>  "hyperliquidChain": "Mainnet" (on testnet use "Testnet" instead),<br>  "signatureChainId": the id of the chain used when signing in hexadecimal format; e.g. "0xa4b1" for Arbitrum,</p><p> "wei": amount of wei to transfer as a number,</p><p>"nonce": current timestamp in milliseconds as a Number, must match nonce in outer request body</p><p>}</p> |
| nonce<mark style="color:red;">\*</mark>     | Number | Recommandé d'utiliser l'horodatage courant en millisecondes, doit correspondre au nonce dans l'action Objet ci-dessus |
| signature<mark style="color:red;">\*</mark> | Object |                                                                                                                                                                                                                                                                                                                                                                                                    |

#### Réponse {#response_3}


**200: OK**


```json
{'status': 'ok', 'response': {'type': 'default'}}
```


## Dépôt dans le staking (agent) {#deposit-into-staking-agent}

<mark style="color:green;">`POST`</mark> `https://api.hyperliquid.xyz/exchange`

Semblable au dépôt dans le staking, mais peut être signé par un agent.

#### En-têtes {#headers_15}

| Nom | Valeur |
| ---------------------------------------------- | ------------------ |
| Content-Type<mark style="color:red;">\*</mark> | `application/json` |

#### Corps {#body_4}

| Nom | Type | Description |
| ------------------------------------------- | ------ | -------------------------------------------------------------------------------------------------- |
| action<mark style="color:red;">\*</mark>    | Object | <p>{</p><p>  "type": "cDeposit2",</p><p>  "wei": amount of wei to transfer as a number</p><p>}</p> |
| nonce<mark style="color:red;">\*</mark>     | Number | Recommandé pour utiliser l'horodatage actuel en millisecondes |
| signature<mark style="color:red;">\*</mark> | Object |                                                                                                    |
| expiresAfter                                | Number | Horodatage en millisecondes |

#### Réponse {#response_4}


**200: OK**


```json
{'status': 'ok', 'response': {'type': 'default'}}
```


## Retrait du jalonnement {#withdraw-from-staking}

<mark style="color:green;">`POST`</mark> `https://api.hyperliquid.xyz/exchange`

Cette méthode est utilisée pour transférer le jeton natif du jalonnement dans le compte au comptant de l'utilisateur. Notez que les transferts du jalonnement au compte au comptant passent par une file d'attente non jalonnée de 7.

#### En-têtes {#headers_16}

| Nom | Valeur |
| ---------------------------------------------- | ------------------ |
| Content-Type<mark style="color:red;">\*</mark> | `application/json` |

#### Corps {#body_5}

| Nom | Type | Description |
| ------------------------------------------- | ------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| action<mark style="color:red;">\*</mark>    | Object | <p>{</p><p>  "type": "cWithdraw",</p><p>  "hyperliquidChain": "Mainnet" (on testnet use "Testnet" instead),<br>  "signatureChainId": the id of the chain used when signing in hexadecimal format; e.g. "0xa4b1" for Arbitrum,</p><p> "wei": amount of wei to transfer as a number,</p><p>"nonce": current timestamp in milliseconds as a Number, must match nonce in outer request body</p><p>}</p> |
| nonce<mark style="color:red;">\*</mark>     | Number | Recommandé d'utiliser l'horodatage courant en millisecondes, doit correspondre au nonce dans l'action Objet ci-dessus |
| signature<mark style="color:red;">\*</mark> | Object |                                                                                                                                                                                                                                                                                                                                                                                                     |

#### Réponse {#response_5}


**200: OK**


```json
{'status': 'ok', 'response': {'type': 'default'}}
```


## Déléguer ou annuler la mise du validateur {#delegate-or-undelegate-stake-from-validator}

<mark style="color:green;">`POST`</mark> `https://api.hyperliquid.xyz/exchange`

Déléguez ou annulez les jetons natifs vers ou depuis un validateur. Notez que les délégations à un validateur particulier ont une durée de verrouillage de jour 1.

#### En-têtes {#headers_17}

| Nom | Valeur |
| ---------------------------------------------- | ------------------ |
| Content-Type<mark style="color:red;">\*</mark> | `application/json` |

#### Corps {#body_6}

| Nom | Type | Description |
| ------------------------------------------- | ------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| action<mark style="color:red;">\*</mark>    | Object | <p>{</p><p>  "type": "tokenDelegate",</p><p>  "hyperliquidChain": "Mainnet" (on testnet use "Testnet" instead),<br>  "signatureChainId": the id of the chain used when signing in hexadecimal format; e.g. "0xa4b1" for Arbitrum,</p><p>  "validator": address in 42-character hexadecimal format; e.g. 0x0000000000000000000000000000000000000000,<br>"isUndelegate": boolean,</p><p>"wei": number,</p><p>"nonce": current timestamp in milliseconds as a Number, must match nonce in outer request body</p><p>}</p> |
| nonce<mark style="color:red;">\*</mark>     | number | Recommandé pour utiliser l'horodatage actuel en millisecondes |
| signature<mark style="color:red;">\*</mark> | Object |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |

#### Réponse {#response_6}


**200: OK**


```json
{'status': 'ok', 'response': {'type': 'default'}}
```


## Dépôt ou retrait d'un coffre {#deposit-or-withdraw-from-a-vault}

<mark style="color:green;">`POST`</mark> `https://api.hyperliquid.xyz/exchange`

Ajoutez ou retirez des fonds d'un coffre.

**En-têtes**

| Nom | Valeur |
| ---------------------------------------------- | ------------------ |
| Content-Type<mark style="color:red;">\*</mark> | `application/json` |

**Corps**

| Nom | Type | Description |
| ------------------------------------------- | ------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| action<mark style="color:red;">\*</mark>    | Object | <p>{</p><p>  "type": "vaultTransfer",</p><p>  "vaultAddress": address in 42-character hexadecimal format; e.g. 0x0000000000000000000000000000000000000000,<br>"isDeposit": boolean,</p><p>"usd": number</p><p>}</p> |
| nonce<mark style="color:red;">\*</mark>     | number | Recommandé pour utiliser l'horodatage actuel en millisecondes |
| signature<mark style="color:red;">\*</mark> | Object |                                                                                                                                                                                                                     |
| expiresAfter                                | Number | Horodatage en millisecondes |

**Réponse**


**200**


```json
{'status': 'ok', 'response': {'type': 'default'}}
```


## Dépôt ou retrait d'un liquidateur backstop HIP-3 DEX {#deposit-or-withdraw-from-an-hip-3-dexs-backstop-liquidator}

<mark style="color:green;">`POST`</mark> `https://api.hyperliquid.xyz/exchange`

Ajouter ou retirer des fonds de l'adresse de liquidateur de backstop HIP-3. `ntl` est un entier en unités de jetons de cotation 1e-6. Le montant doit être un multiple de jetons de cotation 1000 (i.e. `ntl % 1000000000 == 0`).

Seul le montant principal peut être retiré, pas pnl.

**En-têtes**

| Nom | Valeur |
| ---------------------------------------------- | ------------------ |
| Content-Type<mark style="color:red;">\*</mark> | `application/json` |

**Corps**

| Nom | Type | Description |
| ------------------------------------------- | ------ | ------------------------------------------------------------------------------------------------------------------------------------------- |
| action<mark style="color:red;">\*</mark>    | Object | <p>{</p><p>  "type": "hip3LiquidatorTransfer",</p><p>  "dex": string (e.g. "xyz"),</p><p>"ntl": number,<br>"isDeposit": boolean</p><p>}</p> |
| nonce<mark style="color:red;">\*</mark>     | number | Recommandé pour utiliser l'horodatage actuel en millisecondes |
| signature<mark style="color:red;">\*</mark> | Object |                                                                                                                                             |
| expiresAfter                                | Number | Horodatage en millisecondes |

**Réponse**


**200**


```json
{'status': 'ok', 'response': {'type': 'default'}}
```


## Approuver un portefeuille API {#approve-an-api-wallet}

<mark style="color:green;">`POST`</mark> `https://api.hyperliquid.xyz/exchange`

Approuve un portefeuille API (également parfois appelé un portefeuille d'agent). Voir [ici](https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/nonces-and-api-wallets#api-wallets) pour plus de détails.

**En-têtes**

| Nom | Valeur |
| ---------------------------------------------- | ------------------ |
| Content-Type<mark style="color:red;">\*</mark> | `application/json` |

**Corps**

| Nom | Type | Description |
| ------------------------------------------- | ------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| action<mark style="color:red;">\*</mark>    | Object | <p>{<br>  "type": "approveAgent",</p><p>  "hyperliquidChain": "Mainnet" (on testnet use "Testnet" instead),<br>  "signatureChainId": the id of the chain used when signing in hexadecimal format; e.g. "0xa4b1" for Arbitrum,</p><p>  "agentAddress": address in 42-character hexadecimal format; e.g. 0x0000000000000000000000000000000000000000,</p><p>"agentName": Optional name for the API wallet. An account can have 1 unnamed approved wallet and up to 3 named ones. And additional 2 named agents are allowed per subaccount. A custom expiration can be set by appending <code>valid\_until {timestamp}</code> après le nom. L'expiration peut être au plus 180 jours dans l'avenir,</p><p>  "nonce": current timestamp in milliseconds as a Number, must match nonce in outer request body</p><p>}</p> |
| nonce<mark style="color:red;">\*</mark>     | number | Recommandé pour utiliser l'horodatage actuel en millisecondes |
| signature<mark style="color:red;">\*</mark> | Object |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |

**Réponse**


**200**


```json
{'status': 'ok', 'response': {'type': 'default'}}
```


## Approuver des frais de construction {#approve-a-builder-fee}

<mark style="color:green;">`POST`</mark> `https://api.hyperliquid.xyz/exchange`

Approuver un taux d'honoraires maximum pour un constructeur.

**En-têtes**

| Nom | Valeur |
| ---------------------------------------------- | ------------------ |
| Content-Type<mark style="color:red;">\*</mark> | `application/json` |

**Corps**

| Nom | Type | Description |
| ------------------------------------------- | ------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| action<mark style="color:red;">\*</mark>    | Object | <p>{<br>  "type": "approveBuilderFee",</p><p>  "hyperliquidChain": "Mainnet" (on testnet use "Testnet" instead),<br>  "signatureChainId": the id of the chain used when signing in hexadecimal format; e.g. "0xa4b1" for Arbitrum,</p><p>  "maxFeeRate": the maximum allowed builder fee rate as a percent string; e.g. "0.001%",</p><p>  "builder": address in 42-character hexadecimal format; e.g. 0x0000000000000000000000000000000000000000,</p><p>  "nonce": current timestamp in milliseconds as a Number, must match nonce in outer request body</p><p>}</p> |
| nonce<mark style="color:red;">\*</mark>     | number | Recommandé pour utiliser l'horodatage actuel en millisecondes |
| signature<mark style="color:red;">\*</mark> | Object |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |

**Réponse**


**200**


```json
{'status': 'ok', 'response': {'type': 'default'}}
```


## Passer une commande TWAP {#place-a-twap-order}

<mark style="color:green;">`POST`</mark> `https://api.hyperliquid.xyz/exchange`

#### En-têtes {#headers_18}

| Nom | Type | Description |
| ---------------------------------------------- | ------ | ------------------ |
| Content-Type<mark style="color:red;">\*</mark> | String | "application/json" |

#### Corps de la requête {#request-body_11}

| Nom | Type | Description |
| ------------------------------------------- | ------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| action<mark style="color:red;">\*</mark>    | Object | <p>{</p><p>  "type": "twapOrder",<br>  "twap": {</p><p>    "a": Number,</p><p>    "b": Boolean,</p><p>    "s": String,</p><p>    "r": Boolean,</p><p>    "m": Number,</p><p>    "t": Boolean</p><p>  }</p><p>  }<br><br>Signification des clés:<br>a est un actif<br>b est isBuy<br>s est la taille<br>r est reduceOnly</p><p>m est minutes<br>t est aléatoire</p> |
| nonce<mark style="color:red;">\*</mark>     | Number | Recommandé pour utiliser l'horodatage actuel en millisecondes |
| signature<mark style="color:red;">\*</mark> | Object |                                                                                                                                                                                                                                                                                                                                               |
| vaultAddress                                | String | Si vous négociez pour le compte d'un coffre ou d'un sous-compte, son adresse Onchain au format hexadécimal de caractère 42; par exemple 0x0000000000000000000000000000000000000000 |
| expiresAfter                                | Number | Horodatage en millisecondes |


**200: OK Réponse réussie**


```
{
   "status":"ok",
   "response":{
      "type":"twapOrder",
      "data":{
         "status": {
            "running":{
               "twapId":77738308
            }
         }
      }
   }
}
```



**200: OK Réponse d’erreur**


```
{
   "status":"ok",
   "response":{
      "type":"twapOrder",
      "data":{
         "status": {
            "error":"Invalid TWAP duration: 1 min(s)"
         }
      }
   }
}
```


## Annuler une commande TWAP {#cancel-a-twap-order}

<mark style="color:green;">`POST`</mark> `https://api.hyperliquid.xyz/exchange`

#### En-têtes {#headers_19}

| Nom | Type | Description |
| ---------------------------------------------- | ------ | ------------------ |
| Content-Type<mark style="color:red;">\*</mark> | String | "application/json" |

#### Corps de la requête {#request-body_12}

| Nom | Type | Description |
| ------------------------------------------- | ------ | ------------------------------------------------------------------------------------------------------------------------------------------------ |
| action<mark style="color:red;">\*</mark>    | Object | <p>{</p><p>  "type": "twapCancel",</p><p>   "a": Number,</p><p>   "t": Number</p><p>}<br><br>Signification des clés:<br>a est un actif<br>t is twap\_id</p> |
| nonce<mark style="color:red;">\*</mark>     | Number | Recommandé pour utiliser l'horodatage actuel en millisecondes |
| signature<mark style="color:red;">\*</mark> | Object |                                                                                                                                                  |
| vaultAddress                                | String | Si vous négociez pour le compte d'un coffre ou d'un sous-compte, son adresse au format hexadécimal de caractère 42; par exemple 0x0000000000000000000000000000000000000000 |
| expiresAfter                                | Number | Horodatage en millisecondes |


**200: OK Réponse réussie**


```
{
   "status":"ok",
   "response":{
      "type":"twapCancel",
      "data":{
         "status": "success"
      }
   }
}
```



**200: OK Réponse d’erreur**


```
{
   "status":"ok",
   "response":{
      "type":"twapCancel",
      "data":{
         "status": {
            "error": "TWAP was never placed, already canceled, or filled."
         }
      }
   }
}
```


## Placer un ordre d'arrêt suiveur {#place-a-trailing-stop-order}

<mark style="color:green;">`POST`</mark> `https://api.hyperliquid.xyz/exchange`

#### En-têtes {#headers_20}

| Nom | Type | Description |
| ---------------------------------------------- | ------ | ------------------ |
| Content-Type<mark style="color:red;">\*</mark> | String | "application/json" |

#### Corps de la requête {#request-body_13}

| Nom | Type | Description |                  |
| ------------------------------------------- | ------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------- |
| action<mark style="color:red;">\*</mark>    | Object | <p>{</p><p>  "type": "trailingStop",</p><p>  "asset": Number,</p><p>  "isBuy": Boolean,</p><p>  "sz": String,</p><p>  "reduceOnly": Boolean,</p><p>  "retracement": {"pct": as a percent string; e.g. "1.234%"} or {"px": String},</p><p>  "activationPx": String | null</p><p>}</p> |
| nonce<mark style="color:red;">\*</mark>     | Number | Recommandé pour utiliser l'horodatage actuel en millisecondes |                  |
| signature<mark style="color:red;">\*</mark> | Object |                                                                                                                                                                                                                                                                   |                  |
| vaultAddress                                | String | Si vous négociez pour le compte d'un coffre ou d'un sous-compte, son adresse au format hexadécimal de caractère 42; par exemple 0x0000000000000000000000000000000000000000 |                  |
| expiresAfter                                | Number | Horodatage en millisecondes |                  |


**200: OK Réponse réussie**


```
{
   "status":"ok",
   "response":{
      "type":"trailingStop",
      "data":{
         "oid":77738308
      }
   }
}
```


## Réserver des actions supplémentaires {#reserve-additional-actions}

<mark style="color:green;">`POST`</mark> `https://api.hyperliquid.xyz/exchange`

Au lieu de négocier pour augmenter les limites de taux basées sur l'adresse, cette action permet de réserver des actions supplémentaires pour 0.0005 USDC par demande. Le coût est payé à partir du solde Perps.

`destination` peut être configuré pour payer un autre utilisateur L1. L'utilisateur de destination doit déjà exister. Ce champ est ignoré dans le hachage s'il n'est pas défini.

#### En-têtes {#headers_21}

| Nom | Type | Description |
| ---------------------------------------------- | ------ | ------------------ |
| Content-Type<mark style="color:red;">\*</mark> | String | "application/json" |

#### Corps de la requête {#request-body_14}

| Nom | Type | Description |                  |
| ------------------------------------------- | ------ | ------------------------------------------------------------------------------------------------------- | ---------------- |
| action<mark style="color:red;">\*</mark>    | Object | <p>{</p><p>  "type": "reserveRequestWeight",</p><p>   "weight": Number,</p><p>   "destination": Address | null</p><p>}</p> |
| nonce<mark style="color:red;">\*</mark>     | Number | Recommandé pour utiliser l'horodatage actuel en millisecondes |                  |
| signature<mark style="color:red;">\*</mark> | Object |                                                                                                         |                  |
| expiresAfter                                | Number | Horodatage en millisecondes |                  |


**200: OK Réponse réussie**


```
{'status': 'ok', 'response': {'type': 'default'}}
```


## Nonce en attente (noop) {#invalidate-pending-nonce-noop}

<mark style="color:green;">`POST`</mark> `https://api.hyperliquid.xyz/exchange`

Cette action ne fait rien (pas d'opération), mais fait marquer le nonce comme utilisé. Cela peut être un moyen plus efficace d'annuler les commandes en vol que l'action d'annulation.

#### En-têtes {#headers_22}

| Nom | Type | Description |
| ---------------------------------------------- | ------ | ------------------ |
| Content-Type<mark style="color:red;">\*</mark> | String | "application/json" |

#### Corps de la requête {#request-body_15}

| Nom | Type | Description |
| ------------------------------------------- | ------ | -------------------------------------------------------- |
| action<mark style="color:red;">\*</mark>    | Object | <p>{</p><p>  "type": "noop"</p><p>}</p> |
| nonce<mark style="color:red;">\*</mark>     | Number | Recommandé pour utiliser l'horodatage actuel en millisecondes |
| signature<mark style="color:red;">\*</mark> | Object |                                                          |
| expiresAfter                                | Number | Horodatage en millisecondes |


**200: OK Réponse réussie**


```
{'status': 'ok', 'response': {'type': 'default'}}
```


## Activer l'abstraction HIP-3 DEX {#enable-hip-3-dex-abstraction}

<mark style="color:green;">`POST`</mark> `https://api.hyperliquid.xyz/exchange`

NOTE : obsolète. Préférez `userSetAbstraction`.

Si elle est définie, les actions sur HIP-3 perps transféreront automatiquement la garantie à partir du solde USDC perps géré par le validateur pour les HIP-3 DEX où USDC est le jeton de garantie, et repérera le contraire. Quand HIP-3 DEX L'abstraction est active, la garantie est retournée à la même source (validator-operated) USDC perps ou solde au comptant) lorsqu'ils sont libérés des positions ou des ordres ouverts.

#### En-têtes {#headers_23}

| Nom | Type | Description |
| ---------------------------------------------- | ------ | ------------------ |
| Content-Type<mark style="color:red;">\*</mark> | String | "application/json" |

#### Corps de la requête {#request-body_16}

<table><thead><tr><th width="106.30859375">Nom</th><th width="159.5078125">Type</th><th>Description</th></tr></thead><tbody><tr><td>action<mark style="color:red;">*</mark></td><td>Objet</td><td><p>{</p><p>  "type": "userDexAbstraction",</p><p>  "hyperliquidChain": "Mainnet" (on testnet use "Testnet" instead),</p><p>  "signatureChainId": the id of the chain used when signing in hexadecimal format; e.g. "0xa4b1" for Arbitrum,</p><p>  "user": address in 42-character hexadecimal format. Can be a sub-account of the user,</p><p>  "enabled": boolean,</p><p>  "nonce": current timestamp in milliseconds as a Number, should match nonce</p><p>}</p></td></tr><tr><td>nonce<mark style="color:red;">*</mark></td><td>Nombre</td><td>Recommandé pour utiliser l'horodatage actuel en millisecondes</td></tr><tr><td>signature<mark style="color:red;">*</mark></td><td>Objet</td><td></td></tr></tbody></table>


**200: OK Réponse réussie**


```
{'status': 'ok', 'response': {'type': 'default'}}
```


## Activer HIP-3 DEX abstraction (agent) {#enable-hip-3-dex-abstraction-agent}

NOTE : obsolète. Préférez `agentSetAbstraction`.

Même effet que UserDexAbstraction ci-dessus, mais ne fonctionne que si vous définissez la valeur de `null` à `true`.

#### En-têtes {#headers_24}

| Nom | Type | Description |
| ---------------------------------------------- | ------ | ------------------ |
| Content-Type<mark style="color:red;">\*</mark> | String | "application/json" |

#### Corps de la requête {#request-body_17}

| Nom | Type | Description |
| ------------------------------------------- | ------ | ------------------------------------------------------------ |
| action<mark style="color:red;">\*</mark>    | Object | <p>{</p><p>  "type": "agentEnableDexAbstraction"</p><p>}</p> |
| nonce<mark style="color:red;">\*</mark>     | Number | Recommandé pour utiliser l'horodatage actuel en millisecondes |
| signature<mark style="color:red;">\*</mark> | Object |                                                              |


**200: OK Réponse réussie**


```
{'status': 'ok', 'response': {'type': 'default'}}
```


## Définir l'abstraction de l'utilisateur {#set-user-abstraction}

<mark style="color:green;">`POST`</mark> `https://api.hyperliquid.xyz/exchange`

#### En-têtes {#headers_25}

| Nom | Type | Description |
| ---------------------------------------------- | ------ | ------------------ |
| Content-Type<mark style="color:red;">\*</mark> | String | "application/json" |

#### Corps de la requête {#request-body_18}

| Nom | Type | Description |
| ------------------------------------------- | ------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| action<mark style="color:red;">\*</mark>    | Object | <p>{</p><p>"type": "userSetAbstraction",</p><p>"hyperliquidChain": "Mainnet" (on testnet use "Testnet" instead),</p><p>"signatureChainId": the id of the chain used when signing in hexadecimal format; e.g. "0xa4b1" for Arbitrum,</p><p>"user": address in 42-character hexadecimal format. Can be a sub-account of the user,</p><p>"abstraction": one of the strings \["disabled", "unifiedAccount", "portfolioMargin"],</p><p>"nonce": current timestamp in milliseconds as a Number, should match nonce</p><p>}</p> |
| nonce<mark style="color:red;">\*</mark>     | Number | Recommandé pour utiliser l'horodatage actuel en millisecondes |
| signature<mark style="color:red;">\*</mark> | Object |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |


**200: OK Réponse réussie**


```json
{'status': 'ok', 'response': {'type': 'default'}}
```


## Définir l'abstraction de l'utilisateur (agent) {#set-user-abstraction-agent}

<mark style="color:green;">`POST`</mark> `https://api.hyperliquid.xyz/exchange`

#### En-têtes {#headers_26}

| Nom | Type | Description |
| ---------------------------------------------- | ------ | ------------------ |
| Content-Type<mark style="color:red;">\*</mark> | String | "application/json" |

#### Corps de la requête {#request-body_19}

| Nom | Type | Description |
| ------------------------------------------- | ------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| action<mark style="color:red;">\*</mark>    | Object | <p>{</p><p>"type": "agentSetAbstraction",</p><p> "abstraction": one of the strings \["i", "u", "p"] where "i" is "disabled", "u" is "unifiedAccount", and "p" is "portfolioMargin"</p><p>}</p> |
| nonce<mark style="color:red;">\*</mark>     | Number | Recommandé pour utiliser l'horodatage actuel en millisecondes |
| signature<mark style="color:red;">\*</mark> | Object |                                                                                                                                                                                                |


**200: OK Réponse réussie**


```json
{'status': 'ok', 'response': {'type': 'default'}}
```


## Résultat fractionné {#split-outcome}

Diviser les jetons de cotation `X` en `X` Oui et `X` Non actions.

<mark style="color:green;">`POST`</mark> `https://api.hyperliquid.xyz/exchange`

#### En-têtes {#headers_27}

| Nom | Type | Description |
| ---------------------------------------------- | ------ | ------------------ |
| Content-Type<mark style="color:red;">\*</mark> | String | "application/json" |

#### Corps de la requête {#request-body_20}

| Nom | Type | Description |
| ------------------------------------------- | ------ | ----------------------------------------------------------------------------------------------------------------------------- |
| action<mark style="color:red;">\*</mark>    | Object | <p>{</p><p>  "type": "userOutcome",</p><p>  "splitOutcome": { "outcome": Number, amount: String (e.g., "123.0") }</p><p>}</p> |
| nonce<mark style="color:red;">\*</mark>     | Number | Recommandé pour utiliser l'horodatage actuel en millisecondes |
| signature<mark style="color:red;">\*</mark> | Object |                                                                                                                               |


**200: OK Réponse réussie**


```
{'status': 'ok', 'response': {'type': 'default'}}
```


## Fusionner les résultats {#merge-outcome}

Fusionner `X` Oui et `X` Non partage dans les jetons de cotation `X`.

<mark style="color:green;">`POST`</mark> `https://api.hyperliquid.xyz/exchange`

#### En-têtes {#headers_28}

| Nom | Type | Description |
| ---------------------------------------------- | ------ | ------------------ |
| Content-Type<mark style="color:red;">\*</mark> | String | "application/json" |

#### Corps de la requête {#request-body_21}

| Nom | Type | Description |                                     |
| ------------------------------------------- | ------ | ----------------------------------------------------------------------------------------------- | ----------------------------------- |
| action<mark style="color:red;">\*</mark>    | Object | <p>{</p><p>  "type": "userOutcome",</p><p>  "mergeOutcome": { "outcome": Number, amount: String | NULL (NULL signifie max)</p><p>}</p> |
| nonce<mark style="color:red;">\*</mark>     | Number | Recommandé pour utiliser l'horodatage actuel en millisecondes |                                     |
| signature<mark style="color:red;">\*</mark> | Object |                                                                                                 |                                     |


**200: OK Réponse réussie**


```
{'status': 'ok', 'response': {'type': 'default'}}
```


## Fusionner la question {#merge-question}

Fusionner `X` Oui partages de chaque résultat associé à la même question dans les jetons de cotation `X`.

<mark style="color:green;">`POST`</mark> `https://api.hyperliquid.xyz/exchange`

#### En-têtes {#headers_29}

| Nom | Type | Description |
| ---------------------------------------------- | ------ | ------------------ |
| Content-Type<mark style="color:red;">\*</mark> | String | "application/json" |

#### Corps de la requête {#request-body_22}

| Nom | Type | Description |                                     |
| ------------------------------------------- | ------ | ------------------------------------------------------------------------------------------------- | ----------------------------------- |
| action<mark style="color:red;">\*</mark>    | Object | <p>{</p><p>  "type": "userOutcome",</p><p>  "mergeQuestion": { "question": Number, amount: String | NULL (NULL signifie max)</p><p>}</p> |
| nonce<mark style="color:red;">\*</mark>     | Number | Recommandé pour utiliser l'horodatage actuel en millisecondes |                                     |
| signature<mark style="color:red;">\*</mark> | Object |                                                                                                   |                                     |


**200: OK Réponse réussie**


```
{'status': 'ok', 'response': {'type': 'default'}}
```


## Néant {#negate-outcome}

Convertir `X` Pas d'actions d'un résultat associé à une question en `X` Oui actions de tous les autres résultats associés à la question.

<mark style="color:green;">`POST`</mark> `https://api.hyperliquid.xyz/exchange`

#### En-têtes {#headers_30}

| Nom | Type | Description |
| ---------------------------------------------- | ------ | ------------------ |
| Content-Type<mark style="color:red;">\*</mark> | String | "application/json" |

#### Corps de la requête {#request-body_23}

| Nom | Type | Description |
| ------------------------------------------- | ------ | ---------------------------------------------------------------------------------------------------------------------------------- |
| action<mark style="color:red;">\*</mark>    | Object | <p>{</p><p>  "type": "userOutcome",</p><p>  "negateOutcome": { "question": Number, "outcome": Number, amount: String }</p><p>}</p> |
| nonce<mark style="color:red;">\*</mark>     | Number | Recommandé pour utiliser l'horodatage actuel en millisecondes |
| signature<mark style="color:red;">\*</mark> | Object |                                                                                                                                    |


**200: OK Réponse réussie**


```
{'status': 'ok', 'response': {'type': 'default'}}
```


## Vote du validateur sur le taux sans risque pour les actifs de devis alignés {#validator-vote-on-risk-free-rate-for-aligned-quote-asset}

<mark style="color:green;">`POST`</mark> `https://api.hyperliquid.xyz/exchange`

#### En-têtes {#headers_31}

| Nom | Type | Description |
| ---------------------------------------------- | ------ | ------------------ |
| Content-Type<mark style="color:red;">\*</mark> | String | "application/json" |

#### Corps de la requête {#request-body_24}

| Nom | Type | Description |
| ------------------------------------------- | ------ | ---------------------------------------------------------------------------------------------------------- |
| action<mark style="color:red;">\*</mark>    | Object | <p>{</p><p>  "type": "validatorL1Stream",</p><p>  "riskFreeRate": String // e.g. "0.04" for 4%</p><p>}</p> |
| nonce<mark style="color:red;">\*</mark>     | Number | Recommandé pour utiliser l'horodatage actuel en millisecondes |
| signature<mark style="color:red;">\*</mark> | Object |                                                                                                            |


**200: OK Réponse réussie**


```
{'status': 'ok', 'response': {'type': 'default'}}
```


## Autoriser le rôle AQAv2 {#authorize-aqav2-role}

<mark style="color:green;">`POST`</mark> `https://api.hyperliquid.xyz/exchange`

#### En-têtes {#headers_32}

| Nom | Type | Description |
| ---------------------------------------------- | ------ | ------------------ |
| Content-Type<mark style="color:red;">\*</mark> | String | "application/json" |

#### Corps de la requête {#request-body_25}

| Nom | Type | Description |                        |
| ------------------------------------------- | ------ | ------------------------------------------------------------------------------------------------------------------ | ---------------------- |
| action<mark style="color:red;">\*</mark>    | Object | <p>{</p><p>  "type": "authorizeAqav2Role",</p><p>  "token": number // e.g. 0 for USDC,</p><p>  "role": "technical" | "treasury"</p><p>}</p> |
| nonce<mark style="color:red;">\*</mark>     | Number | Recommandé pour utiliser l'horodatage actuel en millisecondes |                        |
| signature<mark style="color:red;">\*</mark> | Object |                                                                                                                    |                        |


**200: OK Réponse réussie**


```
{'status': 'ok', 'response': {'type': 'default'}}
```


## Réclamer des récompenses {#claim-rewards}

<mark style="color:green;">`POST`</mark> `https://api.hyperliquid.xyz/exchange`

#### En-têtes {#headers_33}

| Nom | Type | Description |
| ---------------------------------------------- | ------ | ------------------ |
| Content-Type<mark style="color:red;">\*</mark> | String | "application/json" |

#### Corps de la requête {#request-body_26}

| Nom | Type | Description |
| ------------------------------------------- | ------ | -------------------------------------------------------- |
| action<mark style="color:red;">\*</mark>    | Object | <p>{</p><p>  "type": "claimRewards"</p><p>}</p> |
| nonce<mark style="color:red;">\*</mark>     | Number | Recommandé pour utiliser l'horodatage actuel en millisecondes |
| signature<mark style="color:red;">\*</mark> | Object |                                                          |


**200: OK Réponse réussie**


```json
{'status': 'ok', 'response': {'type': 'default'}}
```
