> ## Documentation Index
> Fetch the complete documentation index at: https://docs.engine.usesophic.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Error codes

> Learn more about error codes and how to resolve them.

export const errorCodes = [{
  "code": "buy_order_forbidden",
  "detail": "Buy orders are not enabled for this account."
}, {
  "code": "client_request_id_too_long",
  "detail": "The Client-Request-Id header value exceeds the maximum length."
}, {
  "code": "currency_not_supported",
  "detail": "The requested currency is not supported for this account."
}, {
  "code": "deposit_advance_forbidden",
  "detail": "Deposit advances are not enabled for this account."
}, {
  "code": "deposit_forbidden",
  "detail": "Deposits are not enabled for this account."
}, {
  "code": "duplicate_funding_account",
  "detail": "A funding account with the same IBAN and bank code already exists for this account."
}, {
  "code": "duplicate_webhook",
  "detail": "A webhook with the same URL already exists."
}, {
  "code": "email_forbidden",
  "detail": "The email address is not allowed for this operation."
}, {
  "code": "file_not_uploaded",
  "detail": "The file has not been uploaded to the storage yet."
}, {
  "code": "forbidden",
  "detail": "The credentials are not authorized to perform this operation."
}, {
  "code": "idempotency_key_too_long",
  "detail": "The Idempotency-Key header value exceeds the maximum length."
}, {
  "code": "instrument_not_trading",
  "detail": "The instrument is not currently tradable."
}, {
  "code": "insufficient_funds",
  "detail": "The account does not have sufficient available cash balance."
}, {
  "code": "insufficient_scope",
  "detail": "The token does not have the required scope for this operation."
}, {
  "code": "insufficient_units",
  "detail": "The account does not have sufficient available units to sell."
}, {
  "code": "invalid_client",
  "detail": "The OAuth client is invalid, inactive, or not authorized for this request."
}, {
  "code": "invalid_param",
  "detail": "A parameter is invalid."
}, {
  "code": "invalid_request",
  "detail": "The request parameters are invalid."
}, {
  "code": "invalid_token",
  "detail": "The authentication credentials are invalid or expired."
}, {
  "code": "invalid_trading_currency",
  "detail": "The instrument is not tradable in the requested currency."
}, {
  "code": "method_not_allowed",
  "detail": "This HTTP method is not allowed for this endpoint."
}, {
  "code": "missing_param",
  "detail": "A required parameter is missing."
}, {
  "code": "missing_price",
  "detail": "Pricing data is not available for this operation."
}, {
  "code": "missing_token",
  "detail": "The request is missing authentication credentials."
}, {
  "code": "not_found",
  "detail": "The requested resource does not exist."
}, {
  "code": "order_cancel_forbidden",
  "detail": "The order cannot be cancelled in its current state."
}, {
  "code": "order_fill_forbidden",
  "detail": "The order cannot be marked as filled in its current state."
}, {
  "code": "payment_completion_forbidden",
  "detail": "The payment cannot be completed in its current state."
}, {
  "code": "professional_trader_required",
  "detail": "This operation requires a professional trader authorization."
}, {
  "code": "refund_exceeds_refundable_amount",
  "detail": "The requested refund amount exceeds the refundable amount."
}, {
  "code": "sell_order_forbidden",
  "detail": "Sell orders are not enabled for this account."
}, {
  "code": "server_error",
  "detail": "An unexpected internal error occurred."
}, {
  "code": "signed_upload_expired",
  "detail": "The signed upload has expired."
}, {
  "code": "webhook_not_active",
  "detail": "The webhook is not active."
}, {
  "code": "withdrawal_forbidden",
  "detail": "Withdrawals are not enabled for this account."
}];

export const errorCodesTableColumns = [{
  "key": "code",
  "header": "Code",
  render: value => <code className="font-mono text-[13px] font-regular">{value}</code>
}, {
  "key": "detail",
  "header": "Description"
}];

export const Table = ({columns, data, rowKey, title}) => {
  const keyField = rowKey || columns[0]?.key;
  const getColWidth = (col, index) => {
    if (col.width) return col.width;
    return index === 0 ? "auto" : "minmax(0, 1fr)";
  };
  const gridTemplate = columns.map(getColWidth).join(" ");
  return <div className="w-full text-sm border border-gray-200 rounded-lg overflow-hidden" style={{
    display: "grid",
    gridTemplateColumns: gridTemplate
  }}>
      {}
      {title && <div className="py-3 px-4 font-semibold text-md text-gray-700 border-b border-gray-200" style={{
    gridColumn: "1 / -1"
  }}>
          {title}
        </div>}
      {}
      {columns.map(col => <div key={`header-${col.key}`} className="py-3 px-4 font-semibold text-[12px] text-gray-600 uppercase whitespace-nowrap bg-gray-50 border-b border-gray-200">
          {col.header}
        </div>)}
      {}
      {data.map((row, rowIndex) => columns.map((col, colIndex) => <div key={`${row[keyField]}-${col.key}`} id={colIndex === 0 ? row[keyField] : undefined} className={`py-3 px-4 text-gray-600 leading-relaxed border-b border-gray-100 ${colIndex === 0 ? "whitespace-nowrap" : ""} ${rowIndex % 2 === 0 ? "bg-white" : "bg-gray-50"}`}>
            {col.render ? col.render(row[col.key]) : row[col.key]}
          </div>))}
    </div>;
};

All error responses include a machine-readable error code. These codes can help you handle errors programmatically, as well as display friendly error messages to your users.
The following is a list of the error codes returned by the API, their descriptions, and occasionally information about how to resolve them.

<Table columns={errorCodesTableColumns} data={errorCodes} rowKey="code" />
