Skip to main content

Create order

POST /v1/sell/orders

Create a crypto sell order and get a redirect URL to the selling page.

HTTP request

https://fiat-api.changelly.com/v1/sell/orders

Request

Header parameters

NameTypeRequiredDescription
X-Api-KeystringtrueYour public API key.
X-Api-SignaturestringtrueThe query's serialized body signed by your private key according to the RSA-SHA256 method.

Body parameters

NameTypeRequiredDescription
externalOrderIdstringtrueOrder ID provided by you.
externalUserIdstringtrueUser ID provided by you.
providerCodestringtrueThe Off-Ramp provider code. Possible values.
currencyFromstringtrueTicker of the pay-in currency in uppercase.
currencyTostringtrueTicker of the payout currency in uppercase.
amountFromstringtrueAmount of currency the user is going to pay.
countrystringtrueCountry ISO 3166-1 code (Alpha-2).
statestringfalseState ISO 3166-2 code. Is required if provided country is US.
ipstringfalseUser's IP address.
refundAddressstringtrueRecipient refund address
paymentMethodstringfalseThe payment method code. Possible values.
userAgentstringfalseUser Agent.
metadataobjectfalseMetadata object, which can contain any parameters you need.

Response

Sample response

note

If any of the optional parameters are not provided in the request, they will be returned with the null value in the response.

application/json
{
"redirectUrl": "https://web-api-v2.changelly.com/public/f2c/redirect/transactions/745e2b9d-0e86-49e9-a1db-e7060bde48c7/provider",
"orderId": "b38b83f0-1c76-4356-8ed5-60c1fcb2870c",
"externalUserId": "122hd",
"externalOrderId": "71ahw34",
"providerCode": "moonpay",
"currencyFrom": "BTC",
"currencyTo": "EUR",
"amountFrom": 0.002,
"country": "IT",
"state": null,
"ip": null,
"refundAddress": null,
"paymentMethod": "card",
"userAgent": null,
"metadata": null,
"createdAt": "2024-05-09T06:06:07.845Z"
}

Response params

NameTypeRequiredDescription
redirectUrlstringtrueURL to the provider's selling page.
orderIdstringtrueInternal order ID provided by Fiat API.
externalUserIdstringtrueUser ID provided by you.
externalOrderIdstringtrueOrder ID provided by you.
providerCodestringtrueThe Off-Ramp provider code. Possible values.
currencyFromstringtrueTicker of the pay-in currency in uppercase.
currencyTostringtrueTicker of the payout currency in uppercase.
amountFromstringtrueAmount of currency the user is going to pay.
countrystringtrueCountry ISO 3166-1 code (Alpha-2).
statestringtrueState ISO 3166-2 code. Is required if provided country is US.
ipstringtrueUser's IP address.
refundAddressstringtrueRecipient refund address.
paymentMethodstringtrueThe payment method code. Possible values
userAgentstringtrueUser Agent.
metadataobjecttrueMetadata object, which can contain any parameters you need:
  • If you don't provide the metadata object in the request, null will be returned in metadata in response.
  • If you specify an empty object in the request, an empty object will be returned in the response.
createdAtdate-timetrueTime in ISO 8601 format.

Error schema

NameTypeRequiredDescription
errorTypestringtrueError type.
errorMessagestringtrueError message.
errorDetailsarraytrueIf the error contains no details, errorDetails equals null.

Possible error types:

TypeDescription
validationValidation error.
timeoutRequest to the provider was not completed in the allotted time.
unavailableRequest failed at the provider's end.
limitsSpecified pay-in amount is less than the minimum or more than the maximum value for the fiat currency.
countrySpecified country is not supported by the provider.
stateOffer requested for the United States, but the state parameter is not provided.
currencySpecified currency pair is not supported by the provider.
paymentMethodSpecified payment method is not supported by the provider.
invalidOfferOff-Ramp provider returned an invalid offer.

errorDetails item schema

NameTypeRequiredDescription
causestringtrueError cause. For example, it can equal min or max for the limits error type.
valuestringtrueError value. For example, it can equal the min or max supported value for the limits error type.

Error codes

CodeMessage
400BadRequest
401Unauthorized
429TooManyRequests
500InternalServerError
BadRequest
{
"errorType": "limits",
"errorMessage": "Limits error",
"errorDetails": [
{
"cause": "min",
"value": "20"
}
]
}