All endpoints are located on
/api
user
orid
refers to the document ID in the database
Get a list of classes you are teaching in Google classroom.
role
(query): [Optional] your role in the classroom. One of: TEACHER
, STUDENT
, ANY
(default: ANY
)
Array of classes
{
id: string,
name: string | null,
section: string | null
}
[],
Get a list of students in a class. Requires staff role.
:class
(path): The class ID to get students for. Find using /classes
Array of students
{
googleId: string,
id: string,
name: string | null
}
[],
Get the balance for a user. Requires staff role for retrieving other users' transactions.
:user
(path): The user to get transactions for, or me
to get for the authenticated user
The user's balance
{
balance: number;
}
Returns all transactions for a user. Requires staff role for retrieving other users' transactions.
:user
(path): The user to get transactions for, or me
to get for the authenticated user
count
(query): [Optional] the number of transactions to return. Defaults to 10
page
(query): [Optional] the page of transactions to return. Defaults to 1
search
(query): [Optional] filter transactions by reason text
user
(query): [Optional] filter transactions by this user
{
page: number,
pageCount: number,
docCount: number,
transactions: ITransactionAPIResponse[]
}
see db schema for ITransactionAPIResponse
Create a transaction. Requires staff role.
amount
(body): Amount to send
reason
(body): [Optional] Reason for the transaction
user
(body): User ID or array of user IDs
Array of transactions
Bulk create transactions. Requires bulk send role.
Body should be sent as multipart/formdata
amount
(body): Amount to send
fromUser
(body): [Optional] User ID to send these transactions from. Either this or fromText
must be specified, but not both.
fromText
(body): [Optional] Text to send these transactions from. Either this or fromUser
must be specified, but not both.
reason
(body): Reason for the transaction
data
(body): CSV or Excel document of the users to send these transactions to.
The file's first column can have any header and should contain the student IDs. Any subsequent columns are ignored.
Array of transactions
Delete a transaction. Staff can delete their own transactions within the last 24 hours. Admins can delete any transaction.
None
None
Get a list of stores that you have access to.
search
(query): [Optional] search for stores by name or description. Requires admin role.
user
(query): [Optional] search as a different user. Requires admin role.
classIDs
, managers
, users
, and owner
will only be returned if you can manage this store.
IStoreAPIResponse[]
(see db schema)
Create a store. Requires staff permissions.
name
(body): The name of the store
description
(body): [Optional] The description of the store
classIDs
(body): [Optional] An array of Google Classroom IDs
public
(body): Whether the store is public or not. Public stores require admin permissions.
pinned
(body): Whether the store is pinned or not. Pinned stores require admin permissions. The store must be public to be pinned.
allowDeductions
(body): Whether deductions are allowed when selling items. Changing this setting requires admin permissions.
requests
(body): Whether purchase requests are allowed in this store.
managers
(body): An array of user IDs who can manage this store
users
(body): An array of user IDs who can access this store
classIDs
, managers
, users
, and owner
will only be returned if you can manage this store.
IStoreAPIResponse
(see db schema)
Get a list of new store items
None
IStoreItem[]
(see db schema)
Get a store's info by its ID
:id
(path): Store ID
classIDs
, managers
, users
, and owner
will only be returned if you can manage this store.
IStoreAPIResponse
(see db schema)
Update a store. Requires permission to manage this store.
:id
(path): Store ID
name
(body): The name of the store
description
(body): [Optional] The description of the store
classIDs
(body): [Optional] An array of Google Classroom IDs
public
(body): Whether the store is public or not. Changing this setting requires admin permissions.
pinned
(body): Whether the store is pinned or not. Changing this setting require admin permissions. The store must be public to be pinned.
allowDeductions
(body): Whether deductions are allowed when selling items. Changing this setting requires admin permissions.
requests
(body): Whether purchase requests are allowed in this store.
managers
(body): An array of user IDs who can manage this store
users
(body): An array of user IDs who can access this store
owner
(body): [Optional] The user ID of the new owner of the store. Changing this setting requires admin permissions or you to be the existing owner.
IStoreAPIResponse
(see db schema)
Delete a store. Only the store owner or an admin can do this.
:id
(path): Store ID
None
Get a list of people who can access a store
:id
(path): Store ID
Null or an array of student ids
Sell an item
:id
(path): Store ID
user
(body): The user ID of the person buying the item
item
(body): The ID of the item being sold
quantity
(body): [Optional] The quantity of the item being sold
deduct
(body): [Optional] Deduct this amount from the price, for example if the user is partially paying in cash.
None
Get a list of a store's items
:id
(path): Store ID
IStoreItem[]
(see db schema)
Get a store's item by its ID
:storeID
(path): Store ID
:id
(path): Item ID
IStoreItem
(see db schema)
Get a store item's image
:storeID
(path): Store ID
:id
(path): Item ID
The image if exists (webp), otherwise will return a 404
Update a store's item
:storeID
(path): Store ID
:id
(path): Item ID
name
(body): [Optional] New name
description
(body): [Optional] New description
price
(body): [Optional] New price
quantity
(body): [Optional] New quantity
pinned
(body): [Optional] New pinned status
IStoreItem
(see db schema)
Upload a store's item image
:storeID
(path): Store ID
:id
(path): Item ID
Body should contain the image as image/png
, image/jpeg
, or image/webp
(will be converted to webp)
Nothing
Delete store's item
:storeID
(path): Store ID
:id
(path): Item ID
Delete store's item image
:storeID
(path): Store ID
:id
(path): Item ID
Nothing
Create a store item
:storeID
(path): Store ID
name
(body): Name
description
(body): [Optional] Description
price
(body): Price
quantity
(body): [Optional] Quantity
pinned
(body): [Optional] Pinned status
IStoreItem
(see db schema)
Get a list of your requests
None
IStoreRequestAPIResponse[]
(see db schema)
Get a list of pending requests for a store. You must be a manager of the store.
:id
(path): Store ID
IStoreRequestAPIResponse[]
(see db schema)
Create store request
store
(body): Store ID
item
(body): Item ID
quantity
(body): [Optional] Quantity to purchase
IStoreRequestAPIResponse
(see db schema)
Approve a request. You must be a manager of the store.
:id
(path): Request ID
IStoreRequestAPIResponse
(see db schema)
Deny/Cancel a request. You must be a manager of the store or the person who created the request.
:id
(path): Request ID
IStoreRequestAPIResponse
(see db schema)
Search for users
q
(query): Search query
roles
(query): [Optional] User must have at least one these roles. Separate multiple roles with a comma.
count
(query): [Optional] Number of results to return. Defaults to 10
me
(query): [Optional] Include the authenticated user in the results. Defaults to false
withArchived
(query): [Optional] Include archived uesrs in the results. Defaults to false. Requires admin role.
{
name: string,
email: string,
id: string,
confidence: number
}
[],
Get info for authenticated user. Requires admin role for retrieving other users.
:id
(path): The user to get, or me
to get for the authenticated user
IUserAPIResponse
(see db schema)
Update a user
:id
(path): The user to update
name
(body): Name
googleID
(body): Google ID
email
(body): [Optional] Email address
schoolID
(body): [Optional] School ID
balance
(body): Balance
balanceExpires
(body): [Optional] Balance expiry date (ISO or epoch MS)
weeklyBalanceMultiplier
(body): [Optional] Weekly balance multiplier
roles
(body): [Optional] Roles to give to the user as an arry of strings
doNotSync
(body): [Optional] Do not sync this user with Google Admin
archived
(body): [Optional] Mark user as archived
IUserAPIResponse
(see db schema)
Archive a user
:id
(path): The user to update
Nothing
Create a user
name
(body): Name
googleID
(body): Google ID
email
(body): [Optional] Email address
schoolID
(body): [Optional] School ID
balance
(body): [Optional] Balance
balanceExpires
(body): [Optional] Balance expiry date (ISO or epoch MS)
weeklyBalanceMultiplier
(body): [Optional] Weekly balance multiplier
roles
(body): [Optional] Roles to give to the user as an arry of strings
doNotSync
(body): [Optional] Do not sync this user with Google Admin
archived
(body): [Optional] Mark user as archived
IUserAPIResponse
(see db schema)
Start a request to sync users with Google Admin.
None
None
All reporting routes require admin permissions
Get daily transactions report
from
(query): [Optional] Date to start from (ISO or epoch MS). Defaults to 30 days ago.
to
(query): [Optional] Date to end at (ISO or epoch MS). Defaults to today.
csv
(query): [Optional] Return CSV instead of JSON. Should be true
or false
. Defaults to false
.
{
/** Date as YYYY-MM-DD */
date: string;
/** Number of transactions */
count: number;
/** Total transaction value */
total: number;
}
[];
Or in equivalent CSV form if csv
is true
Get daily store purchases report
from
(query): [Optional] Date to start from (ISO or epoch MS). Defaults to 30 days ago.
to
(query): [Optional] Date to end at (ISO or epoch MS). Defaults to today.
csv
(query): [Optional] Return CSV instead of JSON. Should be true
or false
. Defaults to false
.
{
/** Date as YYYY-MM-DD */
date: string;
/** Number of transactions */
count: number;
/** Total transaction value */
total: number;
}
[];
Or in equivalent CSV form if csv
is true
Get top transactions by absolute value of amount
from
(query): [Optional] Date to start from (ISO or epoch MS). Defaults to none.
to
(query): [Optional] Date to end at (ISO or epoch MS). Defaults to none.
count
(query): [Optional] Number of results to return. Defaults to none (all transactions returned) if csv
is true
, and 10 otherwise.
csv
(query): [Optional] Return CSV instead of JSON. Should be true
or false
. Defaults to false
.
Array of transactions
Or in equivalent CSV form if csv
is true
Get all transactions
from
(query): [Optional] Date to start from (ISO or epoch MS). Defaults to none.
to
(query): [Optional] Date to end at (ISO or epoch MS). Defaults to none.
count
(query): [Optional] Number of results to return. Defaults to none (all transactions returned).
skip
(query): [Optional] Number of results to skip. Defaults to 0.
csv
(query): [Optional] Return CSV instead of JSON. Should be true
or false
. Defaults to false
.
Array of transactions
Get total balance of all students
None
{
balance: number;
}
Get top balances of students with balances greater than 0
count
(query): [Optional] Number of results to return. Defaults to none (all balances returned) if csv
is true
, and 10 otherwise.
csv
(query): [Optional] Return CSV instead of JSON. Should be true
or false
. Defaults to false
.
{
_id: string;
name: string;
email: string | undefined;
balance: number;
}
[];
Or in equivalent CSV form if csv
is true
Gets users who sent the most Kitcoin
from
(query): [Optional] Date to start from (ISO or epoch MS). Defaults to none.
to
(query): [Optional] Date to end at (ISO or epoch MS). Defaults to none.
count
(query): [Optional] Number of results to return. Defaults to none (all users returned) when csv
is true
, and 10 otherwise.
csv
(query): [Optional] Return CSV instead of JSON. Should be true
or false
. Defaults to false
.
{
_id: string;
name: string | undefined;
email: string | undefined;
amount: number;
count: number;
}
[];
Or in equivalent CSV form if csv
is true
Get version info.
None
[
string | null, // version
string | null, // package name
];