Skip to content
Console
Menu

Generated Assets

Getting Started

Authentication

KV Store

Get a revenue

Gets the org's revenue over a period: totals by day or month, split by source or product, gross or net, in one reporting currency, with the…

Gets the org's revenue over a period: totals by day or month, split by source or product, gross or net, in one reporting currency, with the basis of each bucket, the sources that report late, and what has no rate yet. Reads only the daily roll-up, bounded by a 5 second statement timeout. For example sylphx money revenue summary --period mtd --split source.

  • Path GET https://api.sylphx.com/v1/orgs/acme/revenue
  • Scope revenue:read
  • Effect read — nothing is written.
  • Collection revenue
  • Query period, month, start_day, end_day, group_by, split, amount, currency_code

#Request

FieldTypeWhat it is
namestringorgs/{org}/revenue. Required.
periodstringtoday, mtd (month to date, the default), month (with month), or range (with start_day and end_day). Days are UTC.
monthstringThe month of a month period, YYYY-MM.
start_daystringThe first day of a range, YYYY-MM-DD.
end_daystringThe last day of a range, inclusive; at most 400 days after the first.
group_bystringday (the default) or month.
splitstringnone (the default), source or product.
amountstringnet (the default) or gross.
currency_codestringThe reporting currency, ISO 4217; default USD.

#Response

FieldTypeWhat it is
namestringorgs/{org}/revenue.
uidstringThe org's id. Output only.
metaResourceMetaResource metadata. Output only.
start_daystringThe first day of the period, YYYY-MM-DD. Output only.
end_daystringThe last day of the period, inclusive. Output only.
currency_codestringThe reporting currency every converted amount is in. Output only.
amountstringnet or gross. Output only.
group_bystringday or month. Output only.
splitstringnone, source or product. Output only.
totalstringThe period's total, in minor units of the reporting currency. Output only.
bucketsRevenueBucket[]One bucket per day or month that holds revenue, oldest first. Output only.
linesRevenueLine[]The period's total per source or product, largest first; empty when split is none. Output only.
stale_sourcesStaleRevenueSource[]Sources that report late: their missing days make the period incomplete. Output only.
unconvertedUnconvertedAmount[]Amounts with no exchange rate for their day yet, in their own currency: counted here, never in total. Output only.
unconverted_countint64Daily rows that had no rate and are in unconverted. Output only.
incompleteboolA stale source has not reported some day of the period. Output only.

#ResourceMeta

FieldTypeWhat it is
generationint64Increases by one on every change to spec. Output only.
etagstringStrong ETag (AIP-154): changes on any change to spec, status, or metadata. Send it back as If-Match or etag to make Update and Delete conditional; a mismatch fails with ABORTED / 409 ETAG_MISMATCH. Output only.
create_timetimestampWhen the Resource was created. Output only.
update_timetimestampWhen the Resource last changed. Output only.
delete_timetimestampSet while the Resource is being deleted. Output only.
labelsmap<string, string>Caller-writable, indexed labels (AIP-122 label rules).
annotationsmap<string, string>Caller-writable, unindexed annotations.
display_namestringCaller-writable human-readable name.
creatorstringThe principal that created the Resource. Output only.

#RevenueBucket

FieldTypeWhat it is
start_daystringThe day, or the first day of the month.
totalstringThe bucket's total in minor units of the reporting currency.
basisstringThe weakest basis that counted in the bucket: final when every row is a source's final statement, estimated or booked otherwise.
incompleteboolA stale source has not reported this bucket yet.
unconverted_countint64Daily rows of this bucket with no rate yet.
linesRevenueLine[]The bucket per source or product; empty when split is none.

#RevenueLine

FieldTypeWhat it is
keystringThe source's name (orgs/{org}/revenue_sources/{id}), or the product as {store_kind}/{product_ref}.
labelstringThe source's display name, or the product's label; the reference itself when the product has no label.
totalstringIn minor units of the reporting currency.

#StaleRevenueSource

FieldTypeWhat it is
sourcestringorgs/{org}/revenue_sources/{id}.
display_namestringThe source's display name.
newest_daystringThe newest day it holds; empty when it holds none.

#UnconvertedAmount

FieldTypeWhat it is
currency_codestringISO 4217 code.
amountstringIn minor units of that currency.

#Errors

  • UNAUTHENTICATED — No valid key or token was presented.
  • PERMISSION_DENIED — The key lacks the method's permission.
  • RESOURCE_NOT_FOUND — The named Resource does not exist or is not visible.
  • INVALID_FIELD — A field failed validation.
  • UNAVAILABLE — The Resource store, the owning service's backend, or the key verifier's snapshot is unavailable; retry after Retry-After.

Every error arrives in the body Errors describes.

#Examples

curl "https://api.sylphx.com/v1/orgs/acme/revenue" \
  -H "Authorization: Bearer $SYLPHX_API_KEY"