Core API Reference
API Endpoints
https://api.staging.galoy.io/graphql
The staging API endpoint is:
https://api.staging.galoy.io/graphql
To get a new JWT:
- 1.Use
userRequestAuthCode
to receive an auth code via SMS - 2.Call
userLogin
using the same phone number and auth code
All other methods require a valid JWT set in the header as a bearer token -
Authorization: Bearer
query
export URI=https://api.staging.galoy.io/graphql
export PHONE='+12025550148'
curl --location --request POST $URI --header 'Content-Type: application/json' --data-raw '{"query":"mutation userRequestAuthCode ($input: UserRequestAuthCodeInput!) {\n userRequestAuthCode (input: $input) {\n errors {\n message\n path\n }\n success\n }\n}","variables":{"input":{"phone":"'"$PHONE"'"}}}'
response
{
"data": {
"userRequestAuthCode": {
"errors": [],
"success": true
}
}
}
query
export CODE='012345'
curl --location --request POST $URI --header 'Content-Type: application/json' --data-raw '{"query":"mutation userLogin ($input: UserLoginInput!) {\n userLogin (input: $input) {\n errors {\n message\n path\n }\n authToken\n }\n}","variables":{"input":{"phone":"'"$PHONE"'","code":"'"$CODE"'"}}}'
response
{
"data": {
"userLogin": {
"errors": [],
"authToken": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1aWQiOiI1ZjkwMTY3ODM2MmZmNjIzMjVkZmFmYjciLCJuZXR3b3JrIjoicmVndGVzdCIsImN1cnJlbmN5IjoiQlRDIiwiaWF0IjoxNjAzMjc4NDU2fQ.-im7fJS_andM32zNXDVqSDPPoQtCtCE22X-hUclT3u0"
}
}
}
query
export AUTH_TOKEN='Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1aWQiOiI1ZjkwMTY3ODM2MmZmNjIzMjVkZmFmYjciLCJuZXR3b3JrIjoicmVndGVzdCIsImN1cnJlbmN5IjoiQlRDIiwiaWF0IjoxNjAzMjc4NDU2fQ.-im7fJS_andM32zNXDVqSDPPoQtCtCE22X-hUclT3u0'
export AMOUNT=12345
export MEMO='tipping'
curl --location --request POST $URI --header "$AUTH_TOKEN" --header 'Content-Type: application/json' --data-raw '{"query":"mutation lnInvoiceCreate ($input: LnInvoiceCreateInput!) {\n lnInvoiceCreate (input: $input) {\n errors {\n message\n path\n }\n invoice {\n paymentRequest\n paymentHash\n paymentSecret\n satoshis\n }\n }\n}","variables":{"input":{"amount":"'"$AMOUNT"'","memo":"'"$MEMO"'"}}}'
response
{
"data": {
"lnInvoiceCreate": {
"errors": [],
"invoice": {
"paymentRequest": "lntb123450n1pscxulepp59x872uskmr0a4r3wnr3vkmr297zm53smw8j4efevpknuwm8vs5yqdq5w35hqurfdenjq6nsdamscqzpuxqyz5vqsp5yzmznk5z7xszkgfk5xstuh8j5gg4srerelv58pph5wjan2kd8rqs9qyyssqe5l376x893374kqsr5lc8tesudg4jryaqlzmx44mfr87nds83margfa09ggd92sy0rudl6r79sat4rxqml5yfdhmm7yk9jc0ugzw7hgpdfxfzk",
"paymentHash": "298be57216d8dfda8e2e88e2cb6c6a2f85ba461b71e55ca72c0da7c76cec8508",
"paymentSecret": "20b629da82f1a02b2136a1a0be5cf2a211580f23cfd8438437a3a5d9aacd38c1",
"satoshis": 12345
}
}
}
}
query
export PAYMENT_REQUEST='lntb123450n1pscxulepp59x872uskmr0a4r3wnr3vkmr297zm53smw8j4efevpknuwm8vs5yqdq5w35hqurfdenjq6nsdamscqzpuxqyz5vqsp5yzmznk5z7xszkgfk5xstuh8j5gg4srerelv58pph5wjan2kd8rqs9qyyssqe5l376x893374kqsr5lc8tesudg4jryaqlzmx44mfr87nds83margfa09ggd92sy0rudl6r79sat4rxqml5yfdhmm7yk9jc0ugzw7hgpdfxfzk'
curl --location --request POST $URI --header "$AUTH_TOKEN" --header 'Content-Type: application/json' --data-raw '{"query":"mutation lnInvoiceFeeProbe ($input: LnInvoiceFeeProbeInput!) {\n lnInvoiceFeeProbe (input: $input) {\n errors {\n message\n path\n }\n amount\n }\n}","variables":{"input":{"paymentRequest":"'"$PAYMENT_REQUEST"'"}}}'
response
{
"data": {
"lnInvoiceFeeProbe": {
"errors": [],
"amount": 0
}
}
}
query
PAYMENT_REQUEST='lntb50u1psc8xeppp5yryt4j8ve0pvyunrp3dr0l5tj0ss4hnkuxz52hldc9nz2njpe2fqdqqxqrrss9qy9qsqsp5xduj0a8u2c7mn959045wnu8xrv63vqye2d2zw3kllahdv47np6qsrzjqwfn3p9278ttzzpe0e00uhyxhned3j5d9acqak5emwfpflp8z2cng85uzyqqqdsqqqqqqqlgqqqqqeqqjqjwcuu47akd6qggafxy403zk9f67xh86huv6r0fkngvkuwrxuadv8dd3u5gfeurshh3q6jr5jvu05z7f63xz5ac8v4pk3tjfv46jt5dcprr9d4z'
curl --location --request POST $URI --header "$AUTH_TOKEN" --header 'Content-Type: application/json' --data-raw '{"query":"mutation lnInvoicePaymentSend ($input: LnInvoicePaymentInput!) {\n lnInvoicePaymentSend (input: $input) {\n errors {\n message\n path\n }\n status\n }\n}","variables":{"input":{"paymentRequest":"'"$PAYMENT_REQUEST"'","memo":"'"$MEMO"'"}}}'
response
{
"data": {
"lnInvoicePaymentSend": {
"errors": [],
"status": "ALREADY_PAID"
}
}
}
If you use Postman, we have a collection you can import to test the API.
Response
Arguments
Name | Description |
---|---|
| |
|
Example
Query
query accountDefaultWallet(
$username: Username!,
$walletCurrency: WalletCurrency
) {
accountDefaultWallet(
username: $username,
walletCurrency: $walletCurrency
) {
id
walletCurrency
}
}
Variables
{"username": Username, "walletCurrency": "BTC"}
Response
{"data": {"accountDefaultWallet": {"id": 4, "walletCurrency": "BTC"}}}
Example
Query
query btcPrice {
btcPrice {
base
currencyUnit
formattedAmount
offset
}
}
Response
{
"data": {
"btcPrice": {
"base": 9007199254740991,
"currencyUnit": "BTCSAT",
"formattedAmount": "xyz789",
"offset": 123
}
}
}
Response
Arguments
Name | Description |
---|---|
|
Example
Query
query btcPriceList($range: PriceGraphRange!) {
btcPriceList(range: $range) {
price {
...PriceFragment
}
timestamp
}
}
Variables
{"range": "FIVE_YEARS"}
Response
{
"data": {
"btcPriceList": {
"price": Price,
"timestamp": 1592577642
}
}
}
Response
Example
Query
query businessMapMarkers {
businessMapMarkers {
mapInfo {
...MapInfoFragment
}
username
}
}
Response
{
"data": {
"businessMapMarkers": {
"mapInfo": MapInfo,
"username": Username
}
}
}
Response
Example
Query
query globals {
globals {
buildInformation {
...BuildInformationFragment
}
nodesIds
}
}
Response
{
"data": {
"globals": {
"buildInformation": BuildInformation,
"nodesIds": ["abc123"]
}
}
}
Example
Query
query me {
me {
contactByUsername {
...UserContactFragment
}
contacts {
...UserContactFragment
}
createdAt
defaultAccount {
...AccountFragment
}
id
language
phone
quizQuestions {
...UserQuizQuestionFragment
}
twoFAEnabled
username
}
}
Response
{
"data": {
"me": {
"contactByUsername": UserContact,
"contacts": [UserContact],
"createdAt": 1592577642,
"defaultAccount": Account,
"id": 4,
"language": Language,
"phone": Phone,
"quizQuestions": [UserQuizQuestion],
"twoFAEnabled": false,
"username": Username
}
}
}
Response
Example
Query
query mobileVersions {
mobileVersions {
currentSupported
minSupported
platform
}
}
Response
{
"data": {
"mobileVersions": {
"currentSupported": 987,
"minSupported": 123,
"platform": "abc123"
}
}
}
Response
Arguments
Name | Description |
---|---|
| |
| |
Default = 1 | |
|
Example
Query
query onChainTxFee(
$address: OnChainAddress!,
$amount: SatAmount!,
$targetConfirmations: TargetConfirmations,
$walletId: WalletId!
) {
onChainTxFee(
address: $address,
amount: $amount,
targetConfirmations: $targetConfirmations,
walletId: $walletId
) {
amount
targetConfirmations
}
}
Variables
{
"address": OnChainAddress,
"amount": SatAmount,
"targetConfirmations": 1,
"walletId": WalletId
}
Response
{
"data": {
"onChainTxFee": {
"amount": SatAmount,
"targetConfirmations": TargetConfirmations
}
}
}
Response
Example
Query
query quizQuestions {
quizQuestions {
earnAmount
id
}
}
Response
{
"data": {
"quizQuestions": {
"earnAmount": SatAmount,
"id": "4"
}
}
}
will be migrated to AccountDefaultWalletId
Response
Arguments
Name | Description |
---|---|
|
Example
Query
query userDefaultWalletId($username: Username!) {
userDefaultWalletId(username: $username)
}
Variables
{"username": Username}
Response
{"data": {"userDefaultWalletId": WalletId}}
Response
Arguments
Name | Description |
---|---|
|
Example
Query
query usernameAvailable($username: Username!) {
usernameAvailable(username: $username)
}
Variables
{"username": Username}
Response
{"data": {"usernameAvailable": false}}
Response
Arguments
Name | Description |
---|---|
|
Example
Query
mutation accountUpdateDefaultWalletId($input: AccountUpdateDefaultWalletIdInput!) {
accountUpdateDefaultWalletId(input: $input) {
account {
...ConsumerAccountFragment
}
errors {
...ErrorFragment
}
}
}
Variables
{"input": AccountUpdateDefaultWalletIdInput}
Response
{
"data": {
"accountUpdateDefaultWalletId": {
"account": ConsumerAccount,
"errors": [Error]
}
}
}
Response
Example
Query
mutation captchaCreateChallenge {
captchaCreateChallenge {
errors {
...ErrorFragment
}
result {
...CaptchaCreateChallengeResultFragment
}
}
}
Response
{
"data": {
"captchaCreateChallenge": {
"errors": [Error],
"result": CaptchaCreateChallengeResult
}
}
}
Response
Arguments
Name | Description |
---|---|
|
Example
Query
mutation captchaRequestAuthCode($input: CaptchaRequestAuthCodeInput!) {
captchaRequestAuthCode(input: $input) {
errors {
...ErrorFragment
}
success
}
}
Variables
{"input": CaptchaRequestAuthCodeInput}
Response
{
"data": {
"captchaRequestAuthCode": {
"errors": [Error],
"success": false
}
}
}
Response
Arguments
Name | Description |
---|---|
|
Example
Query
mutation deviceNotificationTokenCreate($input: DeviceNotificationTokenCreateInput!) {
deviceNotificationTokenCreate(input: $input) {
errors {
...ErrorFragment
}
success
}
}
Variables
{"input": DeviceNotificationTokenCreateInput}
Response
{
"data": {
"deviceNotificationTokenCreate": {
"errors": [Error],
"success": true
}
}
}
Description
Actions a payment which is internal to the ledger e.g. it does not use onchain/lightning. Does not currently support payments to or from USD wallets. Returns payment status (success, failed, pending, already_paid).
Response
Arguments
Name | Description |
---|---|
|
Example
Query
mutation intraLedgerPaymentSend($input: IntraLedgerPaymentSendInput!) {
intraLedgerPaymentSend(input: $input) {
errors {
...ErrorFragment
}
status
}
}
Variables
{"input": IntraLedgerPaymentSendInput}
Response
{
"data": {
"intraLedgerPaymentSend": {
"errors": [Error],
"status": "ALREADY_PAID"
}
}
}
Description
Returns a lightning invoice for an associated wallet. When invoice is paid the value will be credited to a BTC wallet. Expires after 24 hours.
Response
Arguments
Name | Description |
---|---|
|
Example
Query
mutation lnInvoiceCreate($input: LnInvoiceCreateInput!) {
lnInvoiceCreate(input: $input) {
errors {
...ErrorFragment
}
invoice {
...LnInvoiceFragment
}
}
}
Variables
{"input": LnInvoiceCreateInput}
Response
{
"data": {
"lnInvoiceCreate": {
"errors": [Error],
"invoice": LnInvoice
}
}
}
Description
Returns a lightning invoice for an associated wallet. When invoice is paid the value will be credited to a BTC wallet. Expires after 24 hours.
Response
Arguments
Name | Description |
---|---|
|
Example
Query
mutation lnInvoiceCreateOnBehalfOfRecipient($input: LnInvoiceCreateOnBehalfOfRecipientInput!) {
lnInvoiceCreateOnBehalfOfRecipient(input: $input) {
errors {
...ErrorFragment
}
invoice {
...LnInvoiceFragment
}
}
}
Variables
{"input": LnInvoiceCreateOnBehalfOfRecipientInput}
Response
{
"data": {
"lnInvoiceCreateOnBehalfOfRecipient": {
"errors": [Error],
"invoice": LnInvoice
}
}
}
Response
Arguments
Name | Description |
---|---|
|
Example
Query
mutation lnInvoiceFeeProbe($input: LnInvoiceFeeProbeInput!) {
lnInvoiceFeeProbe(input: $input) {
amount
errors {
...ErrorFragment
}
}
}
Variables
{"input": LnInvoiceFeeProbeInput}
Response
{
"data": {
"lnInvoiceFeeProbe": {
"amount": SatAmount,
"errors": [Error]
}
}
}
Description
Pay a lightning invoice using a balance from a wallet which is owned by the account of the current user. Provided wallet can be USD or BTC and must have sufficient balance to cover amount in lightning invoice. Returns payment status (success, failed, pending, already_paid).
Response
Arguments
Name | Description |
---|---|
|
Example
Query
mutation lnInvoicePaymentSend($input: LnInvoicePaymentInput!) {
lnInvoicePaymentSend(input: $input) {
errors {
...ErrorFragment
}
status
}
}
Variables
{"input": LnInvoicePaymentInput}
Response
{
"data": {
"lnInvoicePaymentSend": {
"errors": [Error],
"status": "ALREADY_PAID"
}
}
}
Description
Returns a lightning invoice for an associated wallet. Can be used to receive any supported currency value (currently USD or BTC). Expires after 24 hours.
Response
Arguments
Name | Description |
---|---|
|
Example
Query
mutation lnNoAmountInvoiceCreate($input: LnNoAmountInvoiceCreateInput!) {
lnNoAmountInvoiceCreate(input: $input) {
errors {
...ErrorFragment
}
invoice {
...LnNoAmountInvoiceFragment
}
}
}
Variables
{"input": LnNoAmountInvoiceCreateInput}
Response
{
"data": {
"lnNoAmountInvoiceCreate": {
"errors": [Error],
"invoice": LnNoAmountInvoice
}
}
}
Description
Returns a lightning invoice for an associated wallet. Can be used to receive any supported currency value (currently USD or BTC). Expires after 24 hours.
Response
Arguments
Name | Description |
---|---|
|
Example
Query
mutation lnNoAmountInvoiceCreateOnBehalfOfRecipient($input: LnNoAmountInvoiceCreateOnBehalfOfRecipientInput!) {
lnNoAmountInvoiceCreateOnBehalfOfRecipient(input: $input) {
errors {
...ErrorFragment
}
invoice {
...LnNoAmountInvoiceFragment
}
}
}
Variables
{"input": LnNoAmountInvoiceCreateOnBehalfOfRecipientInput}
Response
{
"data": {
"lnNoAmountInvoiceCreateOnBehalfOfRecipient": {
"errors": [Error],
"invoice": LnNoAmountInvoice
}
}
}
Response
Arguments
Name | Description |
---|---|
|
Example
Query
mutation lnNoAmountInvoiceFeeProbe($input: LnNoAmountInvoiceFeeProbeInput!) {
lnNoAmountInvoiceFeeProbe(input: $input) {
amount
errors {
...ErrorFragment
}
}
}
Variables
{"input": LnNoAmountInvoiceFeeProbeInput}
Response
{
"data": {
"lnNoAmountInvoiceFeeProbe": {
"amount": SatAmount,
"errors": [Error]
}
}
}
Description
Pay a lightning invoice using a balance from a wallet which is owned by the account of the current user. Provided wallet must be BTC and must have sufficient balance to cover amount specified in mutation request. Returns payment status (success, failed, pending, already_paid).
Response
Arguments
Name | Description |
---|---|
|
Example
Query
mutation lnNoAmountInvoicePaymentSend($input: LnNoAmountInvoicePaymentInput!) {
lnNoAmountInvoicePaymentSend(input: $input) {
errors {
...ErrorFragment
}
status
}
}
Variables
{"input": LnNoAmountInvoicePaymentInput}
Response
{
"data": {
"lnNoAmountInvoicePaymentSend": {
"errors": [Error],
"status": "ALREADY_PAID"
}
}
}
Response
Arguments
Name | Description |
---|---|
|
Example
Query
mutation lnNoAmountUsdInvoiceFeeProbe($input: LnNoAmountUsdInvoiceFeeProbeInput!) {
lnNoAmountUsdInvoiceFeeProbe(input: $input) {
amount
errors {
...ErrorFragment
}
}
}
Variables
{"input": LnNoAmountUsdInvoiceFeeProbeInput}
Response
{
"data": {
"lnNoAmountUsdInvoiceFeeProbe": {
"amount": CentAmount,
"errors": [Error]
}
}
}
Description
Pay a lightning invoice using a balance from a wallet which is owned by the account of the current user. Provided wallet must be USD and have sufficient balance to cover amount specified in mutation request. Returns payment status (success, failed, pending, already_paid).