{#snippet cp(something)} {/snippet}

Documentation

Coinos is free and open source software. The code is available at github.com/coinos

Coinos has a REST API that can be used to register accounts and make payments. The following examples show how you can call the API with curl

API Base URL

{api}
{@render cp(api)}

Auth Token

{#if user && token} This token authorizes you to use the API as {user.username}. {:else} Sign in to view your auth token here, or get one from the /login endpoint. {/if} Save it in a variable called $token to run the examples. It gives full access to your account so keep it safe.

{tokenSample}
{@render cp(tokenSample)}
{#if ro}

This read-only token has permission to create invoices and fetch payments but can't be used to make withdrawals

{roSample}
{@render cp(roSample)}
{/if}

POST /register

Register a new user account with a username and password

POST /login

Login to an account to get its auth token

GET /me

Get your account details and balance

POST /user

Update your account/settings

Request params (all optional)
username
string - letters and numbers, no spaces
display
string - spaces allowed
currency
string - three-letter ISO currency code e.g. CAD or USD
language
string - two-letter language code e.g. en, fr, es

POST /invoice

Create an invoice.

Request params
type (string, default: lightning)
bitcoin or lightning
fiat (boolean, default: false)
whether the amount is denominated in satoshis or local currency
amount (numeric)
amount to be paid
webhook (string, optional)
remote endpoint to call when the invoice is paid
secret (string, optional)
a secret value passed to the webhook to authenticate the request

Get a lightning invoice to receive funds

Get a bitcoin address to receive funds

Sample response

You can check the received field to see how much has been paid

Specify a webhook to be called when an invoice is paid

GET /invoice/:hash

Fetch an invoice by passing a bitcoin address or lightning payment hash

POST /lightning/quote

Find out what a lightning payment will cost before sending it. The routing fee comes from querying the route ahead of time and is exact; pass it as fee to POST /payments. Pass amount for an amountless invoice, or max to solve for the largest amount whose amount + fees uses the whole balance.

Sample response

POST /payments

Send a lightning payment. fee caps the routing fee; if omitted, the route is quoted and the exact fee used.

Send an internal payment to another user

POST /bitcoin/send

Send a bitcoin payment

GET /payments

Get all payments sent or received by the current user

Query params
start
only payments after this unix time
end
only payments before this unix time
limit
limit to this integer number of results
offset
start limiting from this integer offset