> ## Documentation Index
> Fetch the complete documentation index at: https://rain-sandbox-trial.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# MXN Onramps

> Enable users to onramp MXN to crypto using payment routes with SPEI transfers.

<Info>
  **Endpoint Migration**

  The `/v1/automations` endpoints have been renamed to `/v1/payment-routes`. The old `/v1/automations` paths remain available as deprecated aliases during migration. Update your integrations to use `/v1/payment-routes` as the deprecated endpoints will be removed in a future release.
</Info>

MXN onramps follow the same flow as standard [onramps](/docs/onramps), but with MXN as the source currency and SPEI as the rail. This guide covers only the differences. Refer to the [onramps guide](/docs/onramps) for the full integration flow, managing payment routes, webhooks, and settlement details.

## Differences from USD onramps

### Create payment route request

When creating an MXN onramp payment route, set `source.currency` to `mxn` and `source.rail` to `mx_spei`:

```bash theme={null}
curl -X POST https://api.rain.xyz/v1/payment-routes \
  -H "Api-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "userId": "11111111-1111-1111-1111-111111111111",
    "source": {
      "currency": "mxn",
      "rail": "mx_spei"
    },
    "destination": {
      "currency": "usdc",
      "rail": "base",
      "address": {
        "type": "onchain",
        "address": "0x1234567890abcdef1234567890abcdef12345678"
      }
    }
  }'
```

### Deposit address

The key difference is the deposit address returned in the response. For MXN onramps, the fiat deposit address contains a `clabeNumber` (CLABE, Clave Bancaria Estandarizada) and a `transferMessage` reference instead of a US bank account number and routing number:

```json theme={null}
{
  "id": "d290f1ee-6c54-4b01-90e6-d701748f0851",
  "userId": "11111111-1111-1111-1111-111111111111",
  "status": "active",
  "source": {
    "currency": "mxn",
    "rail": "mx_spei"
  },
  "destination": {
    "currency": "usdc",
    "rail": "base",
    "address": {
      "type": "onchain",
      "address": "0x1234567890abcdef1234567890abcdef12345678"
    }
  },
  "depositAddress": {
    "type": "fiat",
    "clabeNumber": "032180000118359719",
    "transferMessage": "REF10421"
  },
  "createdAt": "2025-01-15T10:30:00Z",
  "updatedAt": "2025-01-15T10:30:00Z"
}
```

The user initiates a SPEI transfer to the provided CLABE number, including the `transferMessage` as the transfer's *concepto* so Rain can match the deposit. Once Rain receives the MXN deposit, it converts the funds to the destination stablecoin and delivers them to the specified onchain address.
