Gaiia GraphQL API Reference

Welcome to gaiia

API Endpoints
# Production Server:
https://api.gaiia.com/api
Headers
# Your API token. Must be included in all API calls.
x-gaiia-api-key: 1234567890
# Your organization slug. Must be included in all API calls.
apollographql-client-name: my-organization-slug

Queries

account

Response

Returns an Account!

Arguments
Name Description
id - ID!

Example

Query
query Account($id: ID!) {
  account(id: $id) {
    id
    gaiiaId
    status
    customStatus {
      ...CustomAccountStatusFragment
    }
    customFields
    primaryContact {
      ...ContactFragment
    }
  }
}
Variables
{"id": "4"}
Response
{
  "data": {
    "account": {
      "id": "4",
      "gaiiaId": 987,
      "status": "ACTIVE",
      "customStatus": CustomAccountStatus,
      "customFields": {},
      "primaryContact": Contact
    }
  }
}

billableAccount

Response

Returns a BillableAccount!

Example

Query
query BillableAccount {
  billableAccount {
    id
    productSubscriptions {
      ...ProductSubscriptionConnectionFragment
    }
  }
}
Response
{
  "data": {
    "billableAccount": {
      "id": 4,
      "productSubscriptions": ProductSubscriptionConnection
    }
  }
}

invoice

Response

Returns an InvoicePayload!

Example

Query
query Invoice {
  invoice {
    invoice {
      ...InvoiceFragment
    }
    url
  }
}
Response
{
  "data": {
    "invoice": {
      "invoice": Invoice,
      "url": "xyz789"
    }
  }
}

Mutations

createPayment

Description

This method will create a payment for a given account, increasing the balance of the account

Response

Returns a CreatePaymentPayload!

Arguments
Name Description
input - CreatePaymentInput!

Example

Query
mutation CreatePayment($input: CreatePaymentInput!) {
  createPayment(input: $input) {
    payment {
      ...PaymentFragment
    }
  }
}
Variables
{"input": CreatePaymentInput}
Response
{"data": {"createPayment": {"payment": Payment}}}

createPaymentMethod

Description

This method will create a payment method for a given account

Response

Returns a CreatePaymentMethodPayload!

Arguments
Name Description
input - CreatePaymentMethodInput!

Example

Query
mutation CreatePaymentMethod($input: CreatePaymentMethodInput!) {
  createPaymentMethod(input: $input) {
    paymentMethod {
      ...PaymentMethodFragment
    }
  }
}
Variables
{"input": CreatePaymentMethodInput}
Response
{
  "data": {
    "createPaymentMethod": {
      "paymentMethod": PaymentMethod
    }
  }
}

rechargePrepaidPlan

Description

This method will balance the account and use the remaining balance to recharge the prepaid plan

Response

Returns a RechargePrepaidPlanPayload!

Arguments
Name Description
input - RechargePrepaidPlanInput!

Example

Query
mutation RechargePrepaidPlan($input: RechargePrepaidPlanInput!) {
  rechargePrepaidPlan(input: $input) {
    quantity
  }
}
Variables
{"input": RechargePrepaidPlanInput}
Response
{"data": {"rechargePrepaidPlan": {"quantity": 123}}}

Types

Account

Fields
Field Name Description
id - ID! The uuid for the account
gaiiaId - Int! The incremental numeric id for the account
status - Status!
customStatus - CustomAccountStatus!
customFields - JSON The account's custom fields
primaryContact - Contact! The account's primary contact
Example
{
  "id": "4",
  "gaiiaId": 123,
  "status": "ACTIVE",
  "customStatus": CustomAccountStatus,
  "customFields": {},
  "primaryContact": Contact
}

BigInt

Description

Converts BigInt to string

Example
{}

BillableAccount

Fields
Field Name Description
id - ID!
productSubscriptions - ProductSubscriptionConnection!
Possible Types
BillableAccount Types

Account

Property

PropertyGroup

Example
{
  "id": "4",
  "productSubscriptions": ProductSubscriptionConnection
}

BillingScheme

Values
Enum Value Description

TIERED

PER_UNIT

Example
"TIERED"

BillingThreshold

Fields
Field Name Description
id - String! The id of the billing threshold
valueRemaining - Int! The value remaining before the threshold is reached
valueUsed - Int! The value used since the threshold was created
createdAt - DateTime! The date at which the threshold was created
updatedAt - DateTime! The date at which the threshold was last updated
recoveredAt - DateTime The date at which the threshold was recovered
Example
{
  "id": "abc123",
  "valueRemaining": 987,
  "valueUsed": 123,
  "createdAt": "2007-12-03T10:15:30Z",
  "updatedAt": "2007-12-03T10:15:30Z",
  "recoveredAt": "2007-12-03T10:15:30Z"
}

Boolean

Description

The Boolean scalar type represents true or false.

Example
true

Contact

Fields
Field Name Description
id - ID! Unique ID.
firstName - String! First name of the account.
lastName - String! Last name of the account.
email - String! Email address of the account.
homePhone - String Home phone number of the account.
mobilePhone - String Mobile phone number of the account.
Example
{
  "id": "4",
  "firstName": "abc123",
  "lastName": "xyz789",
  "email": "abc123",
  "homePhone": "abc123",
  "mobilePhone": "xyz789"
}

CreatePaymentInput

Fields
Input Field Description
accountId - UUID! The billable account uuid
paymentMethodId - UUID! The payment method uuid
amount - Int! The amount in the lowest fraction of the currency
idempotencyKey - String The idempotency uuid you can pass to make sure network retries will not create multiple payments
internalNote - String A free text field you can use to add details on the payment
currency - Currency The currency of the amount
processorTransactionId - String The payment processor transaction id
paymentDateTime - DateTime The date of the payment if it was created at a different date than now
Example
{
  "accountId": "e48f697f-83f1-4946-bbee-db30f0a0fcaf",
  "paymentMethodId": "e48f697f-83f1-4946-bbee-db30f0a0fcaf",
  "amount": 987,
  "idempotencyKey": "abc123",
  "internalNote": "abc123",
  "currency": "CAD",
  "processorTransactionId": "abc123",
  "paymentDateTime": "2007-12-03T10:15:30Z"
}

CreatePaymentMethodInput

Fields
Input Field Description
accountId - UUID! The billable account uuid
type - PaymentMethodType The payment method type
autoPaymentEnabled - Boolean Whether the payment method is enabled for auto payments
Example
{
  "accountId": "e48f697f-83f1-4946-bbee-db30f0a0fcaf",
  "type": "CREDIT_CARD",
  "autoPaymentEnabled": false
}

CreatePaymentMethodPayload

Fields
Field Name Description
paymentMethod - PaymentMethod!
Example
{"paymentMethod": PaymentMethod}

CreatePaymentPayload

Fields
Field Name Description
payment - Payment!
Example
{"payment": Payment}

Credit

Fields
Field Name Description
id - String! The uuid of the credit
transaction - CreditableTransaction! The credit transaction
totalAmount - Int! The total credit amount (in the smallest currency unit).
invoiceId - String! The invoice id
createdAt - DateTime! The creation timestamp.
updatedAt - DateTime! The timestamp of the last update.
voidedAt - DateTime The moment when the credit has been voided.
Example
{
  "id": "xyz789",
  "transaction": CreditableTransaction,
  "totalAmount": 987,
  "invoiceId": "xyz789",
  "createdAt": "2007-12-03T10:15:30Z",
  "updatedAt": "2007-12-03T10:15:30Z",
  "voidedAt": "2007-12-03T10:15:30Z"
}

CreditableTransaction

Fields
Field Name Description
id - String! The uuid of the transaction
transactionType - TransactionType! The type of transaction
amount - Int! The amount (in the smallest currency unit).
description - String The description displayed on invoices.
currency - Currency! The currency.
createdAt - DateTime! The creation timestamp.
updatedAt - DateTime! The timestamp of the last update.
discount - DiscountLink The discount linked to the transaction.
payment - PaymentLink The debit linked to the transaction.
createdBy - String! The user’s email who created the transaction or gaiia-bot when it has been automatically created by the billing system.
taxTransaction - [TaxTransactionLink!]! The transaction taxes details
Example
{
  "id": "abc123",
  "transactionType": "PAYMENT",
  "amount": 987,
  "description": "abc123",
  "currency": "CAD",
  "createdAt": "2007-12-03T10:15:30Z",
  "updatedAt": "2007-12-03T10:15:30Z",
  "discount": DiscountLink,
  "payment": PaymentLink,
  "createdBy": "xyz789",
  "taxTransaction": [TaxTransactionLink]
}

Currency

Values
Enum Value Description

CAD

USD

ARS

COP

BMD

GBP

Example
"CAD"

CustomAccountStatus

Fields
Field Name Description
id - String!
type - Status!
name - String!
default - Boolean!
archived - Boolean!
Example
{
  "id": "xyz789",
  "type": "ACTIVE",
  "name": "xyz789",
  "default": true,
  "archived": true
}

Date

Description

Date custom scalar type

Example
"2007-12-03"

DateTime

Description

A date and time, represented as an ISO-8601 string

Example
"2007-12-03T10:15:30Z"

Debit

Fields
Field Name Description
id - String! The uuid of the debit
transaction - Transaction! The debit transaction
productVersionId - String The debit product version id
subscriptionId - String The debit subscription id
quantity - Int! The quantity that has been debited.
proratedFrom - DateTime The start date of the proration.
proratedTo - DateTime The end date of the proration.
voidedAt - DateTime Timestamp of when the debit has been voided.
invoiceId - String The debit invoice id
Example
{
  "id": "abc123",
  "transaction": Transaction,
  "productVersionId": "abc123",
  "subscriptionId": "xyz789",
  "quantity": 987,
  "proratedFrom": "2007-12-03T10:15:30Z",
  "proratedTo": "2007-12-03T10:15:30Z",
  "voidedAt": "2007-12-03T10:15:30Z",
  "invoiceId": "abc123"
}

ID

Description

The ID scalar type represents a unique identifier, often used to refetch an object or as key for a cache. The ID type appears in a JSON response as a String; however, it is not intended to be human-readable. When expected as an input type, any string (such as "4") or integer (such as 4) input value will be accepted as an ID.

Example
"4"

Int

Description

The Int scalar type represents non-fractional signed whole numeric values. Int can represent values between -(2^31) and 2^31 - 1.

Example
987

Invoice

Fields
Field Name Description
id - String! The uuid of the invoice
accountId - String! The uuid of the account owning the invoice
totalDebits - Int! The total amount of debits (in the smallest currency unit).
totalDiscounts - Int! The total amount of discounts (in the smallest currency unit).
totalTaxes - Int! The total amount of taxes (in the smallest currency unit).
dueDate - Date! The due date
autoPayAttempts - Int! The number of auto payment attempts made to pay this invoice.
fromDate - Date! The invoice billing period from date.
toDate - Date! The invoice billing period to date.
createdAt - DateTime! The creation timestamp.
updatedAt - DateTime! The timestamp of the last update.
debits - [Debit!]! The invoice debits
credits - [Credit!]! The invoice credits
amountDue - Int! The amount due (in the smallest currency unit)
amountPaid - Int! The amount paid on the invoice (in the smallest currency unit)
amountRemaining - Int! The amount remaining to pay on this invoice (in the smallest currency unit)
subtotal - Int! The subtotal. This is the amount due before taxes (in the smallest currency unit).
total - Int! The total. This is the total amount due on the invoice (in the smallest currency unit).
startingBalance - Int! The starting balance. This number is the account’s total balance prior to opening this invoice (in the smallest currency unit).
invoiceNumber - BigInt! The invoice number
s3Key - String
createdBy - String! The user’s email who created the invoice or gaiia-bot when it has been automatically created by the billing system.
voidedBy - String The user’s email who voided the invoice.
currency - Currency! The invoice currency
nextAutoPayDate - DateTime The date at which the billing system will try an automatic payment for this invoice.
taxGeoZones - [TaxGeoZone!]! The invoice tax details
Example
{
  "id": "abc123",
  "accountId": "xyz789",
  "totalDebits": 987,
  "totalDiscounts": 987,
  "totalTaxes": 987,
  "dueDate": "2007-12-03",
  "autoPayAttempts": 987,
  "fromDate": "2007-12-03",
  "toDate": "2007-12-03",
  "createdAt": "2007-12-03T10:15:30Z",
  "updatedAt": "2007-12-03T10:15:30Z",
  "debits": [Debit],
  "credits": [Credit],
  "amountDue": 987,
  "amountPaid": 987,
  "amountRemaining": 123,
  "subtotal": 987,
  "total": 987,
  "startingBalance": 123,
  "invoiceNumber": {},
  "s3Key": "abc123",
  "createdBy": "xyz789",
  "voidedBy": "abc123",
  "currency": "CAD",
  "nextAutoPayDate": "2007-12-03T10:15:30Z",
  "taxGeoZones": [TaxGeoZone]
}

InvoicePayload

Fields
Field Name Description
invoice - Invoice!
url - String!
Example
{
  "invoice": Invoice,
  "url": "abc123"
}

JSON

Description

The JSON scalar type represents JSON values as specified by ECMA-404.

Example
{}

JSONObject

Description

The JSONObject scalar type represents JSON objects as specified by ECMA-404.

Example
{}

NotifyableEntity

Possible Types
NotifyableEntity Types

Account

PropertyGroup

Example
{}

PageInfo

Fields
Field Name Description
hasNextPage - Boolean!
hasPreviousPage - Boolean!
startCursor - String
endCursor - String
Example
{
  "hasNextPage": true,
  "hasPreviousPage": true,
  "startCursor": "abc123",
  "endCursor": "abc123"
}

Payment

Fields
Field Name Description
id - String! The uuid of the payment
transaction - TransactionLink! The transaction linked to the payment
paymentMethod - PaymentMethod! The payment method linked to the payment
paymentDateTime - DateTime! The date the payment was made on
processorTransactionId - String
amountRemaining - Int! The amount remaining on the payment
Example
{
  "id": "abc123",
  "transaction": TransactionLink,
  "paymentMethod": PaymentMethod,
  "paymentDateTime": "2007-12-03T10:15:30Z",
  "processorTransactionId": "abc123",
  "amountRemaining": 123
}

PaymentMethod

Fields
Field Name Description
id - String! The uuid of the payment method
createdAt - DateTime!
updatedAt - DateTime!
autoPaymentEnabled - Boolean! Whether the payment method is enabled for auto payments
type - PaymentMethodType! The payment method type
Example
{
  "id": "xyz789",
  "createdAt": "2007-12-03T10:15:30Z",
  "updatedAt": "2007-12-03T10:15:30Z",
  "autoPaymentEnabled": true,
  "type": "CREDIT_CARD"
}

PaymentMethodType

Values
Enum Value Description

CREDIT_CARD

BANK_ACCOUNT

WIRE_TRANSFER

CRYPTO

INTERAC_TRANSFER

RECOVERY

MERCADO_PAGO_TRANSFER

PAYVALIDA_TRANSFER

CASH

CHECK

Example
"CREDIT_CARD"

PaymentStrategy

Values
Enum Value Description

ONE_TIME

RECURRING

PREPAID

Example
"ONE_TIME"

PricingTier

Fields
Field Name Description
id - String! Unique ID.
productVersionId - String! The id of the product version.
unitAmount - Int! The price of each unit within the tier (e.g. 10$ per day until 'up_to' is reached).
upTo - Int! The maximum number of units within the tier.
flatAmount - Int! The flat fee to pay once until 'up_to' is reached.
createdAt - DateTime! Creation timestamp.
updatedAt - DateTime! Timestamp of the last update.
Example
{
  "id": "xyz789",
  "productVersionId": "xyz789",
  "unitAmount": 987,
  "upTo": 987,
  "flatAmount": 123,
  "createdAt": "2007-12-03T10:15:30Z",
  "updatedAt": "2007-12-03T10:15:30Z"
}

Product

Fields
Field Name Description
id - String! Unique ID.
slug - String! Formatted name of the product.
name - String! Name of the product.
description - String Human-readable description of the product.
type - ProductType! The type of the product.
createdAt - DateTime! Creation timestamp.
updatedAt - DateTime! Timestamp of the last update.
isArchived - Boolean! Whether the product is archived or not.
productCategory - ProductCategory! The product category of the product.
productVersions - [ProductVersion!]! The versions of the product.
primaryProductVersion - ProductVersion The primary version of the product.
rawSpecificationValue - JSONObject! The raw specification value of the product.
currency - Currency! The currency of the product.
taxable - Boolean! Whether the product is taxable or not.
Example
{
  "id": "xyz789",
  "slug": "abc123",
  "name": "xyz789",
  "description": "xyz789",
  "type": "DEBIT",
  "createdAt": "2007-12-03T10:15:30Z",
  "updatedAt": "2007-12-03T10:15:30Z",
  "isArchived": true,
  "productCategory": ProductCategory,
  "productVersions": [ProductVersion],
  "primaryProductVersion": ProductVersion,
  "rawSpecificationValue": {},
  "currency": "CAD",
  "taxable": false
}

ProductCategory

Fields
Field Name Description
id - String! Unique ID.
slug - String! Formatted name of the product category.
name - String! Name of the product category.
createdAt - DateTime! Creation timestamp.
updatedAt - DateTime! Timestamp of the last update.
specificationSchema - JSONObject! JSON schema defining the specifications products need to implement as part of the product category.
color - String! Hex color code that displays the label of the product category.
products - [Product!]! The products of the product category.
translations - [Translation!]! The translations of the product category.
Example
{
  "id": "abc123",
  "slug": "abc123",
  "name": "abc123",
  "createdAt": "2007-12-03T10:15:30Z",
  "updatedAt": "2007-12-03T10:15:30Z",
  "specificationSchema": {},
  "color": "xyz789",
  "products": [Product],
  "translations": [Translation]
}

ProductSubscription

Fields
Field Name Description
id - String! The id of the product subscription
priceOverrideInCents - Int The price override amount applied to the subscription, in the smallest currency unit.
priceOverrideReason - String The reason for the price override applied to the subscription.
accountId - String! The account id owning the subscription
unassignedAt - DateTime The date at which the subscription was unassigned
suspendedAt - DateTime The date at which the subscription was suspended
assignedAt - DateTime! The date at which the subscription was assigned
assignedBy - String! The user’s email that assigned the subscription.
unassignedBy - String The user’s email that unassigned the subscription.
suspendedBy - String The user’s email that suspended the subscription.
createdAt - DateTime! Creation timestamp.
updatedAt - DateTime! Timestamp of the last update.
version - ProductVersion! The product version of the subscription
billingThresholds - [BillingThreshold!]! The billing thresholds of the subscription
shareConfiguration - ShareConfiguration The share configuration of the subscription
Example
{
  "id": "abc123",
  "priceOverrideInCents": 123,
  "priceOverrideReason": "abc123",
  "accountId": "xyz789",
  "unassignedAt": "2007-12-03T10:15:30Z",
  "suspendedAt": "2007-12-03T10:15:30Z",
  "assignedAt": "2007-12-03T10:15:30Z",
  "assignedBy": "abc123",
  "unassignedBy": "xyz789",
  "suspendedBy": "xyz789",
  "createdAt": "2007-12-03T10:15:30Z",
  "updatedAt": "2007-12-03T10:15:30Z",
  "version": ProductVersion,
  "billingThresholds": [BillingThreshold],
  "shareConfiguration": ShareConfiguration
}

ProductSubscriptionConnection

Fields
Field Name Description
edges - [ProductSubscriptionEdge!]!
pageInfo - PageInfo!
Example
{
  "edges": [ProductSubscriptionEdge],
  "pageInfo": PageInfo
}

ProductSubscriptionEdge

Fields
Field Name Description
cursor - String!
node - ProductSubscription!
Example
{
  "cursor": "abc123",
  "node": ProductSubscription
}

ProductType

Values
Enum Value Description

DEBIT

DISCOUNT

FEE

Example
"DEBIT"

ProductVersion

Fields
Field Name Description
id - ID! Unique ID.
productId - String! The id of the product.
product - Product! The product.
creationReason - String! Description of why the product version was created.
isPrimary - Boolean! If the product version is active and can be purchased by customers.
price - Int! Price of the product version in the smallest currency unit.
percentage - Int
currency - Currency! The currency of the product version.
createdAt - DateTime! Creation timestamp.
updatedAt - DateTime! Timestamp of the last update.
archivedAt - DateTime Timestamp of when the product version was archived.
paymentStrategy - PaymentStrategy! Defines how the product can be debited by the billing system.
billingScheme - BillingScheme The type of usage of the product.
tiersMode - TiersMode The type of pricing applied.
tiers - [PricingTier!] The pricing tiers of the product version.
Example
{
  "id": "4",
  "productId": "abc123",
  "product": Product,
  "creationReason": "xyz789",
  "isPrimary": false,
  "price": 123,
  "percentage": 123,
  "currency": "CAD",
  "createdAt": "2007-12-03T10:15:30Z",
  "updatedAt": "2007-12-03T10:15:30Z",
  "archivedAt": "2007-12-03T10:15:30Z",
  "paymentStrategy": "ONE_TIME",
  "billingScheme": "TIERED",
  "tiersMode": "VOLUME",
  "tiers": [PricingTier]
}

Property

Example
{}

PropertyGroup

Example
{}

RechargePrepaidPlanInput

Fields
Input Field Description
accountId - UUID! The billable account uuid
Example
{
  "accountId": "e48f697f-83f1-4946-bbee-db30f0a0fcaf"
}

RechargePrepaidPlanPayload

Fields
Field Name Description
quantity - Int The quantity added to the prepaid plan
Example
{"quantity": 987}

ShareConfiguration

Example
{}

Status

Values
Enum Value Description

ACTIVE

INACTIVE

LEAD

PENDING

SUSPENDED

Example
"ACTIVE"

String

Description

The String scalar type represents textual data, represented as UTF-8 character sequences. The String type is most often used by GraphQL to represent free-form human-readable text.

Example
"abc123"

TaxGeoZone

Example
{}

TiersMode

Values
Enum Value Description

VOLUME

GRADUATED

Example
"VOLUME"

Transaction

Fields
Field Name Description
id - String! The uuid of the transaction
transactionType - TransactionType! The type of transaction
accountId - String! The uuid of the account owning the transaction
amount - Int! The amount (in the smallest currency unit).
internalNote - String The free text internal note of the transaction. This will not be displayed on the invoice.
description - String The free text description of the transaction. This will be displayed on the invoice.
archived - Boolean! Whether the transaction is archived or not.
currency - Currency! The currency.
createdAt - DateTime! The creation timestamp.
updatedAt - DateTime! The timestamp of the last update.
createdBy - String! The user’s email who created the transaction or gaiia-bot when it has been automatically created by the billing system.
discount - DiscountLink The discount linked to the transaction.
debit - DebitLink The debit linked to the transaction.
payment - PaymentLink The payment linked to the transaction.
refund - RefundLink The refund linked to the transaction.
taxTransaction - [TaxTransactionLink!]! The transaction taxes details
Example
{
  "id": "abc123",
  "transactionType": "PAYMENT",
  "accountId": "abc123",
  "amount": 987,
  "internalNote": "abc123",
  "description": "abc123",
  "archived": true,
  "currency": "CAD",
  "createdAt": "2007-12-03T10:15:30Z",
  "updatedAt": "2007-12-03T10:15:30Z",
  "createdBy": "abc123",
  "discount": DiscountLink,
  "debit": DebitLink,
  "payment": PaymentLink,
  "refund": RefundLink,
  "taxTransaction": [TaxTransactionLink]
}

TransactionType

Values
Enum Value Description

PAYMENT

DEBIT

DISCOUNT

REFUND

Example
"PAYMENT"

Translation

Example
{}

UUID

Description

A UUID custom scalar type

Example
"e48f697f-83f1-4946-bbee-db30f0a0fcaf"