{"openapi":"3.1.0","info":{"title":"Cryptain API","version":"1.0.0","description":"Every request carries X-Api-Key, X-Timestamp, X-Signature-Version: 2 and X-Signature = hex HMAC-SHA256 of timestamp, method, path with query and raw body joined by newlines, keyed with your secret key. Full guide: https://cryptain.net/docs"},"servers":[{"url":"https://cryptain.net/api/v1"}],"security":[{"ApiKey":[],"Timestamp":[],"Signature":[],"SignatureVersion":[]}],"paths":{"/ping":{"get":{"summary":"Check your API keys","tags":["General"],"operationId":"getPing","responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"422":{"$ref":"#/components/responses/Invalid"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/invoices":{"post":{"summary":"Create an invoice","tags":["Invoices"],"operationId":"postInvoices","parameters":[{"name":"Idempotency-Key","in":"header","required":false,"description":"Retry safely: the same key returns the same invoice","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/InvoiceCreate"}}}},"responses":{"201":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/Invoice"}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"422":{"$ref":"#/components/responses/Invalid"},"429":{"$ref":"#/components/responses/RateLimited"}}},"get":{"summary":"List invoices","tags":["Invoices"],"operationId":"getInvoices","parameters":[{"name":"status","in":"query","required":false,"description":"Filter by status","schema":{"type":"string"}},{"name":"order_id","in":"query","required":false,"description":"Filter by your order reference","schema":{"type":"string"}},{"name":"page","in":"query","required":false,"description":"Page number, from 1","schema":{"type":"integer"}},{"name":"limit","in":"query","required":false,"description":"1 to 100, default 25","schema":{"type":"integer"}}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/Invoice"}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"422":{"$ref":"#/components/responses/Invalid"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/invoices/{id}":{"get":{"summary":"Get an invoice","tags":["Invoices"],"operationId":"getInvoicesById","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/Invoice"}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"422":{"$ref":"#/components/responses/Invalid"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/invoices/{id}/cancel":{"post":{"summary":"Cancel an unpaid invoice","tags":["Invoices"],"operationId":"postInvoicesByIdCancel","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/Invoice"}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"422":{"$ref":"#/components/responses/Invalid"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/payment-links":{"post":{"summary":"Create a payment link","tags":["Payment links"],"operationId":"postPaymentLinks","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PaymentLinkCreate"}}}},"responses":{"201":{"description":"Success","content":{"application/json":{"schema":{"type":"object"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"422":{"$ref":"#/components/responses/Invalid"},"429":{"$ref":"#/components/responses/RateLimited"}}},"get":{"summary":"List payment links","tags":["Payment links"],"operationId":"getPaymentLinks","responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"422":{"$ref":"#/components/responses/Invalid"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/payment-links/{slug}":{"get":{"summary":"Get a payment link","tags":["Payment links"],"operationId":"getPaymentLinksBySlug","parameters":[{"name":"slug","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"422":{"$ref":"#/components/responses/Invalid"},"429":{"$ref":"#/components/responses/RateLimited"}}},"post":{"summary":"Update a payment link","tags":["Payment links"],"operationId":"postPaymentLinksBySlug","parameters":[{"name":"slug","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PaymentLinkUpdate"}}}},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"422":{"$ref":"#/components/responses/Invalid"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/payment-links/{slug}/invoices":{"get":{"summary":"Invoices started from a link","tags":["Payment links"],"operationId":"getPaymentLinksBySlugInvoices","parameters":[{"name":"slug","in":"path","required":true,"schema":{"type":"string"}},{"name":"status","in":"query","required":false,"description":"Filter by status","schema":{"type":"string"}}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"422":{"$ref":"#/components/responses/Invalid"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/subscriptions":{"post":{"summary":"Create a recurring invoice","tags":["Recurring invoices"],"operationId":"postSubscriptions","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SubscriptionCreate"}}}},"responses":{"201":{"description":"Success","content":{"application/json":{"schema":{"type":"object"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"422":{"$ref":"#/components/responses/Invalid"},"429":{"$ref":"#/components/responses/RateLimited"}}},"get":{"summary":"List recurring invoices","tags":["Recurring invoices"],"operationId":"getSubscriptions","parameters":[{"name":"status","in":"query","required":false,"description":"active, paused, cancelled or completed","schema":{"type":"string"}},{"name":"customer_email","in":"query","required":false,"description":"Filter by customer","schema":{"type":"string"}}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"422":{"$ref":"#/components/responses/Invalid"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/subscriptions/{id}":{"get":{"summary":"Get a recurring invoice","tags":["Recurring invoices"],"operationId":"getSubscriptionsById","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"422":{"$ref":"#/components/responses/Invalid"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/subscriptions/{id}/{action}":{"post":{"summary":"Pause, resume, cancel or bill now","tags":["Recurring invoices"],"operationId":"postSubscriptionsByIdByAction","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"name":"action","in":"path","required":true,"schema":{"type":"string","enum":["pause","resume","cancel","send"]}}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"422":{"$ref":"#/components/responses/Invalid"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/currencies":{"get":{"summary":"Coins your store accepts","tags":["Reference"],"operationId":"getCurrencies","responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"422":{"$ref":"#/components/responses/Invalid"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/rates":{"get":{"summary":"Current price of one coin","tags":["Reference"],"operationId":"getRates","parameters":[{"name":"currency","in":"query","required":false,"description":"Fiat currency, e.g. USD","schema":{"type":"string"}}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"422":{"$ref":"#/components/responses/Invalid"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/balance":{"get":{"summary":"Balances per coin","tags":["Reporting"],"operationId":"getBalance","responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"422":{"$ref":"#/components/responses/Invalid"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/withdrawals":{"get":{"summary":"Withdrawals, refunds and payouts","tags":["Reporting"],"operationId":"getWithdrawals","responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"422":{"$ref":"#/components/responses/Invalid"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/stats":{"get":{"summary":"Volume and fees for a date range","tags":["Reporting"],"operationId":"getStats","parameters":[{"name":"from","in":"query","required":false,"description":"YYYY-MM-DD, default first day of this month","schema":{"type":"string"}},{"name":"to","in":"query","required":false,"description":"YYYY-MM-DD, default today","schema":{"type":"string"}}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"type":"object"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"422":{"$ref":"#/components/responses/Invalid"},"429":{"$ref":"#/components/responses/RateLimited"}}}}},"components":{"securitySchemes":{"ApiKey":{"type":"apiKey","in":"header","name":"X-Api-Key","description":"Your public key (pk_...)"},"Timestamp":{"type":"apiKey","in":"header","name":"X-Timestamp","description":"Unix time in seconds, within 5 minutes"},"SignatureVersion":{"type":"apiKey","in":"header","name":"X-Signature-Version","description":"Always 2"},"Signature":{"type":"apiKey","in":"header","name":"X-Signature","description":"HMAC-SHA256 signature, see the description above"}},"schemas":{"InvoiceCreate":{"type":"object","required":["amount"],"properties":{"amount":{"type":"string","description":"Price as a string, e.g. \"49.00\""},"currency":{"type":"string","description":"Fiat currency such as USD, EUR or INR. Defaults to the store currency."},"order_id":{"type":"string","description":"Your order reference (up to 120 characters)"},"description":{"type":"string","description":"Shown to the customer"},"customer_email":{"type":"string","description":"We email the customer a receipt when paid"},"pay_currency":{"type":"string","description":"Skip the coin picker, e.g. USDT_TRC20"},"success_url":{"type":"string","description":"Where \"Back to store\" goes after payment"},"cancel_url":{"type":"string","description":"Where \"Back to store\" goes if the customer gives up"},"callback_url":{"type":"string","description":"Webhook URL for this invoice only"},"metadata":{"type":"object","description":"Any JSON up to 4 KB, returned in webhooks"}}},"PaymentLinkCreate":{"type":"object","required":["title"],"properties":{"title":{"type":"string","description":"Shown on the payment page"},"amount":{"type":"string","description":"Leave empty to let the payer choose"},"min_amount":{"type":"string","description":"Smallest amount when the payer chooses"},"currency":{"type":"string","description":"Fiat currency"},"type":{"type":"string","description":"payment or donation","enum":["payment","donation"]},"description":{"type":"string","description":"Shown on the payment page"},"max_uses":{"type":"integer","description":"Turn the link off after this many payments"}}},"PaymentLinkUpdate":{"type":"object","properties":{"title":{"type":"string","description":"New title"},"description":{"type":"string","description":"New description"},"amount":{"type":"string","description":"New amount"},"max_uses":{"type":"integer"},"success_message":{"type":"string","description":"Shown after payment"},"active":{"type":"boolean"}}},"SubscriptionCreate":{"type":"object","required":["customer_email","description","amount"],"properties":{"customer_email":{"type":"string","description":"Where each invoice is emailed"},"customer_name":{"type":"string","description":"Customer name"},"description":{"type":"string","description":"What the customer pays for"},"amount":{"type":"string","description":"Amount per period"},"currency":{"type":"string","description":"Fiat currency"},"period":{"type":"string","description":"Billing period","enum":["weekly","monthly","quarterly","yearly"]},"pay_days":{"type":"integer","minimum":1,"maximum":30,"description":"Days the customer has to pay each invoice"},"max_cycles":{"type":"integer","description":"Stop after this many invoices"},"start":{"type":"string","description":"First invoice date, YYYY-MM-DD"},"locale":{"type":"string","description":"Customer language: en, hi, es, ar, tr, ru or pt"}}},"Invoice":{"type":"object","properties":{"id":{"type":"string","description":"Invoice ID"},"store_id":{"type":"string","description":"Store ID"},"order_id":{"type":"string","description":"Your reference"},"status":{"type":"string","description":"Invoice status","enum":["new","waiting","partially_paid","paid","paid_over","paid_late","expired","cancelled","refunded"]},"amount":{"type":"string","description":"Fiat amount"},"currency":{"type":"string","description":"Fiat currency"},"pay_currency":{"type":"string","description":"Coin code"},"network":{"type":"string","description":"Network code"},"pay_amount":{"type":"string","description":"Crypto amount to pay"},"paid_amount":{"type":"string","description":"Crypto amount received"},"rate":{"type":"string","description":"Locked rate"},"address":{"type":"string","description":"Deposit address"},"memo":{"type":"string","description":"Memo or tag, when the network needs one"},"fee_amount":{"type":"string","description":"Fee in the paid coin"},"merchant_amount":{"type":"string","description":"Credited to you"},"is_late":{"type":"boolean"},"checkout_url":{"type":"string","description":"Send the customer here"},"transactions":{"type":"array","items":{"type":"object"}},"metadata":{"type":["object","null"]},"expires_at":{"type":"string","description":"UTC"},"paid_at":{"type":"string","description":"UTC"},"created_at":{"type":"string","description":"UTC"}}},"Error":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string","description":"Machine-readable code"},"message":{"type":"string","description":"What went wrong and how to fix it"}}}}}},"responses":{"Unauthorized":{"description":"Missing or wrong keys, timestamp or signature","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"Invalid":{"description":"A field is missing or invalid","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"RateLimited":{"description":"More than 120 requests a minute","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}}