Get the organization's provider earnings
API keyWhat the organization's hosts have earned from usage, what Ambient took back from those earnings (earnings_, after payment fraud the provider was implicated in), what Ambient has paid out to it, and what is still owed (earned minus recovered minus paid out, negative after an overpayment or advance). Zero for an organization with no hosts. Requires billing..
Send an API key as Authorization: Bearer lgn_…. Authentication
https://api.legion.ambient.xyz/v1/billing/earningscurl -s "https://api.legion.ambient.xyz/v1/billing/earnings" \
-H "Authorization: Bearer $LEGION_API_KEY"{
"earned": {
"amount_minor": -250,
"currency": "USD"
},
"storage_earned": {
"amount_minor": -250,
"currency": "USD"
},
"recovered": {
"amount_minor": -250,
"currency": "USD"
},
"paid_out": {
"amount_minor": -250,
"currency": "USD"
},
"owed": {
"amount_minor": -250,
"currency": "USD"
}
}Example values.
Responses
200The earnings.The earnings.
earnedSignedMoneyRequiredAn amount of money in minor units (cents for USD) that may be negative: a debit, a balance below zero, or an overpaid provider.
Child fields · 2
amount_minorinteger (int64)RequiredcurrencyMoneyCurrencyRequiredISO 4217 currency code. Only USD is supported.
one of: "USD"
storage_earnedSignedMoneyRequiredThe part of
earnedthat came from the storage charges of stopped rentals on the organization's hosts (ledger causestorage); the rest is GPU time.Child fields · 2
amount_minorinteger (int64)RequiredcurrencyMoneyCurrencyRequiredISO 4217 currency code. Only USD is supported.
one of: "USD"
recoveredSignedMoneyRequiredAn amount of money in minor units (cents for USD) that may be negative: a debit, a balance below zero, or an overpaid provider.
Child fields · 2
amount_minorinteger (int64)RequiredcurrencyMoneyCurrencyRequiredISO 4217 currency code. Only USD is supported.
one of: "USD"
paid_outSignedMoneyRequiredAn amount of money in minor units (cents for USD) that may be negative: a debit, a balance below zero, or an overpaid provider.
Child fields · 2
amount_minorinteger (int64)RequiredcurrencyMoneyCurrencyRequiredISO 4217 currency code. Only USD is supported.
one of: "USD"
owedSignedMoneyRequiredAn amount of money in minor units (cents for USD) that may be negative: a debit, a balance below zero, or an overpaid provider.
Child fields · 2
amount_minorinteger (int64)RequiredcurrencyMoneyCurrencyRequiredISO 4217 currency code. Only USD is supported.
one of: "USD"
401Missing, unknown, expired or revoked credentials.Missing, unknown, expired or revoked credentials.
typestringRequiredURI reference identifying the problem type: the code's entry in the public error reference,
https:/. Branch on/ legion. ambient. xyz/ docs/ errors#<code> code, never ontype.titlestringRequiredstatusintegerRequiredcodestringRequiredStable machine-readable error code.
detailstringinstancestringThe request path that produced the problem.
resource_idstring (uuid)The resource a conflict refers to, when there is one (
egress_: the request already waiting;request_ exists export_: the pending workspace export).in_ progress accessMeAccessWhether a signed-in person may use Legion during the closed beta, decided on their verified email (case-insensitive):
approved(a member of an organization, holding a pending invitation, or Legion),waitlisted(on the waitlist, not approved yet) ornot_(not on the waitlist). Carried byrequested Me(alwaysapprovedfor a member) and by the problem of a 403access_, and ofnot_ approved getMe's 403no_.organization Child fields · 2
statestringRequiredone of: "approved", "waitlisted", "not_requested"
emailstring (email)RequiredThe verified email the state was decided on.
legalMeLegalThe caller's consent to Legion's legal documents.
requiredlists every document the consent step shows andacceptLegalDocumentstakes, at its current version.acceptedis true when the caller accepted the current version of everyagreedocument; while it is false, every operation exceptgetMe,acceptLegalDocuments,joinMyWaitlistand the wind-down operations (listing, stopping and deleting rentals; listing hosts, stopping new rentals on them and removing them) answers 403terms_.not_ accepted Child fields · 2
requiredarray of LegalDocumentRequiredChild fields · 6
keyLegalDocumentKeyRequiredA legal document:
terms(Terms of Use),acceptable_(Acceptable Use Policy),use privacy(Privacy Policy),data_(Data Handling).handling one of: "terms", "acceptable_use", "privacy", "data_handling"
versionstringRequiredThe current version. A new version of an
agreedocument must be accepted again.effectivestring (date)RequiredThe date the current version took effect.
titlestringRequiredurlstring (uri)RequiredThe document's public page.
acceptancestringRequiredagree: the person agrees to it, and the API is refused until the current version is accepted.acknowledge: the person confirms having read it, in the same step.one of: "agree", "acknowledge"
acceptedbooleanRequired
blocking_rentalsarray of HostRemovalBlockingRentalSorted by ID.
at most 1000 items
Child fields · 6
idstring (uuid)RequirednameFriendlyNameA host's or rental's friendly name: a lowercase DNS label that starts with a letter and does not end with a hyphen. Unique across all hosts and rentals and never reused. A host's is generated as adjective-noun (
amber-falcon) and can be changed by its owner; a rental's is generated as adjective-noun plus four base36 characters (quiet-river-7k2f) and never changes.2–63 characters · pattern ^[a-z][a-z0-9-]{0,61}[a-z0-9]$
stateRentalStateRequiredstarting: GPUs allocated, waiting for the agent to start the container. Not billed. While the rental'simage_isphase fetchingthe agent does not know it yet.running: the container runs. Billed per second.exited: the host reports the container is not running, for example after a crash; the host is restarting it. GPUs stay reserved. Not billed; returns torunningwhen the host reports it running again.stopping: stop requested, waiting for the agent. Not billed. Becomesstoppedwithout the agent once the host has been offline for 90 seconds.stopped: GPUs released, workspace kept on the host. GPU time is not billed. Storage is billed per GiB while the organization has credit, except for aninterruption_rental, which never stops with data.behavior: delete host_: the host stopped syncing. Not billed; returns tooffline runningwhen the host syncs again, and becomesfailedonce the host has not synced forHOST_(24 hours;).STALE_ AFTER deleting: delete requested, waiting for the agent. Not billed. Becomesdeletedwithout the agent once the host has been offline for 90 seconds.deleted: container and workspace removed. Final.failed: the agent could not start or keep running the container. GPUs released. The rental can only be deleted.one of: "starting", "running", "exited", "stopping", "stopped", "host_offline", "deleting", "deleted", "failed"
endablebooleanRequiredRemoving the host anyway (
removeHostwithforcetrue) would end it: it ishost_on a host that is offline, and not on a preservation hold. A rental that runs, or that the host still has to act on, is never endable.offline heldbooleanOn a preservation hold.
rented_by_youbooleanThe caller's own organization rented it, so the caller can open it (
getRental). Only fromremoveHost; absent means false.
stored_data_rentalsarray of HostStoredDataRental. Sorted by ID.
at most 1000 items
Child fields · 8
idstring (uuid)RequirednameFriendlyNameA host's or rental's friendly name: a lowercase DNS label that starts with a letter and does not end with a hyphen. Unique across all hosts and rentals and never reused. A host's is generated as adjective-noun (
amber-falcon) and can be changed by its owner; a rental's is generated as adjective-noun plus four base36 characters (quiet-river-7k2f) and never changes.2–63 characters · pattern ^[a-z][a-z0-9-]{0,61}[a-z0-9]$
stateRentalStateRequiredstarting: GPUs allocated, waiting for the agent to start the container. Not billed. While the rental'simage_isphase fetchingthe agent does not know it yet.running: the container runs. Billed per second.exited: the host reports the container is not running, for example after a crash; the host is restarting it. GPUs stay reserved. Not billed; returns torunningwhen the host reports it running again.stopping: stop requested, waiting for the agent. Not billed. Becomesstoppedwithout the agent once the host has been offline for 90 seconds.stopped: GPUs released, workspace kept on the host. GPU time is not billed. Storage is billed per GiB while the organization has credit, except for aninterruption_rental, which never stops with data.behavior: delete host_: the host stopped syncing. Not billed; returns tooffline runningwhen the host syncs again, and becomesfailedonce the host has not synced forHOST_(24 hours;).STALE_ AFTER deleting: delete requested, waiting for the agent. Not billed. Becomesdeletedwithout the agent once the host has been offline for 90 seconds.deleted: container and workspace removed. Final.failed: the agent could not start or keep running the container. GPUs released. The rental can only be deleted.one of: "starting", "running", "exited", "stopping", "stopped", "host_offline", "deleting", "deleted", "failed"
estimated_size_bytesinteger (int64)RequiredThe size of its files on the host; with
estimate_basis disk_an upper bound.share estimate_basisBackupEstimateBasisRequired. What a backup's quote was computed on.
disk_: the size the rental's host last reported its workspace uses (used disk_).used_ gib disk_: the host does not report it (a host whose disk quota is not enforced, for example not on XFS), so the quote is the rental's whole disk share (share resources.): an upper bound, "up to" this price, trued down to the real size when the backup is ready. Either way the charge never exceeds the quote: a backup larger than its estimate (a staledisk_ gib disk_) is charged the quote, not more.used_ gib one of: "disk_used", "disk_share"
delete_afterstring (date-time)When its files are deleted (its
delete_); absent while held.after backup_stateBackupStateIts renter's newest backup, when it has one.
rented_by_youbooleanThe caller's own organization rented it. Only on the public listener; absent means false.
available_untilstring (date-time). On 409
host_frommaintenance createRental(whatever the window's state), when the host's window starts. Nothing more about the window: its end and reason are only for the renters of rentals on the host.maintenanceMaintenanceSummary. On 409
host_frommaintenance startRentalof the renter's own rental, the window that keeps it stopped.Child fields · 4
startstring (date-time)RequiredWhen the window starts: the host's rentals stop then (after a 5-minute notice).
endstring (date-time)RequiredThe planned end. The provider may end the window earlier.
reasonMaintenanceReasonRequired. Why a provider takes a host down, shown to the renters of rentals on it. The list grows: accept a value you do not know.
one of: "hardware", "software", "network", "power", "facility", "other"
stateMaintenanceStateRequired.
scheduled(announced, renters told),closing(the last 5 minutes before the start: the penalty-free outcome is decided, nothing can start, rentals in their notice),active(the host is in maintenance, its rentals stopped),overrun(the planned end passed and the host has not synced back),completed,cancelled. The list grows: accept a value you do not know.one of: "scheduled", "closing", "active", "overrun", "completed", "cancelled"
test_switchAdminOrgTestSwitchChild fields · 5
test_orgbooleanRequiredallowedbooleanRequiredblocking_rentalsarray of AdminOrgTestBlockingRentalRequiredat most 100 items
Child fields · 7
idstring (uuid)RequirednameFriendlyNameA host's or rental's friendly name: a lowercase DNS label that starts with a letter and does not end with a hyphen. Unique across all hosts and rentals and never reused. A host's is generated as adjective-noun (
amber-falcon) and can be changed by its owner; a rental's is generated as adjective-noun plus four base36 characters (quiet-river-7k2f) and never changes.2–63 characters · pattern ^[a-z][a-z0-9-]{0,61}[a-z0-9]$
stateRentalStateRequiredstarting: GPUs allocated, waiting for the agent to start the container. Not billed. While the rental'simage_isphase fetchingthe agent does not know it yet.running: the container runs. Billed per second.exited: the host reports the container is not running, for example after a crash; the host is restarting it. GPUs stay reserved. Not billed; returns torunningwhen the host reports it running again.stopping: stop requested, waiting for the agent. Not billed. Becomesstoppedwithout the agent once the host has been offline for 90 seconds.stopped: GPUs released, workspace kept on the host. GPU time is not billed. Storage is billed per GiB while the organization has credit, except for aninterruption_rental, which never stops with data.behavior: delete host_: the host stopped syncing. Not billed; returns tooffline runningwhen the host syncs again, and becomesfailedonce the host has not synced forHOST_(24 hours;).STALE_ AFTER deleting: delete requested, waiting for the agent. Not billed. Becomesdeletedwithout the agent once the host has been offline for 90 seconds.deleted: container and workspace removed. Final.failed: the agent could not start or keep running the container. GPUs released. The rental can only be deleted.one of: "starting", "running", "exited", "stopping", "stopped", "host_offline", "deleting", "deleted", "failed"
renter_orgOrgRequiredChild fields · 2
idstring (uuid)RequirednamestringRequired
provider_orgOrgRequiredChild fields · 2
idstring (uuid)RequirednamestringRequired
host_idstring (uuid)Requiredhost_nameFriendlyNameA host's or rental's friendly name: a lowercase DNS label that starts with a letter and does not end with a hyphen. Unique across all hosts and rentals and never reused. A host's is generated as adjective-noun (
amber-falcon) and can be changed by its owner; a rental's is generated as adjective-noun plus four base36 characters (quiet-river-7k2f) and never changes.2–63 characters · pattern ^[a-z][a-z0-9-]{0,61}[a-z0-9]$
blocking_rental_countintegerRequiredat least 0
unpaid_earningsMoneyRequiredChild fields · 2
amount_minorinteger (int64)RequiredAmount in minor units (cents for USD).
at least 0
currencyMoneyCurrencyRequiredISO 4217 currency code. Only USD is supported.
one of: "USD"
current_price_per_gpu_hourMoneyThe host's price per GPU-hour now, on 409
price_fromchanged createRental, the price a bid would win now on 409bid_, or the floor on 409too_ low bid_; all-in, as the renter sees prices.below_ floor Child fields · 2
amount_minorinteger (int64)RequiredAmount in minor units (cents for USD).
at least 0
currencyMoneyCurrencyRequiredISO 4217 currency code. Only USD is supported.
one of: "USD"
next_available_atstring (date-time)When the action is allowed again, on 429
benchmark_fromrequest_ limited requestHostBenchmark.reasonPromoIneligibleReasonWhy the organization may not redeem the promo code, on 403
promo_.code_ not_ eligible registryRegistrySignInRegistry. The registry a sign-in would be for, on 422
image_of an image on a registry Legion takes sign-ins for (offer to add one withprivate putRegistrySignIn), and on 422registry_(the sign-in the registry refused). Only ever one of these four;sign_ in_ rejected registry_names any host.host registry_hoststring. The registry host a credential is or would be for: on 422
image_(offer to add one withprivate createRegistryCredential),registry_,sign_ in_ rejected registry_, and the refusals of a registry (credential_ rejected registry_,ecr_ unsupported registry_,auth_ unsupported registry_,host_ not_ allowed registry_).realm_ not_ allowed at most 253 characters
registry_credential_idstring (uuid). The credential the registry refused, on 422
registry_.sign_ in_ rejected registry_credential_rentalsarray of RegistryCredentialRental. The rentals that still use a registry credential, on 409
registry_fromcredential_ in_ use deleteRegistryCredentialanddeleteRegistrySignIn. Oldest first.at most 100 items
Child fields · 3
idstring (uuid)RequirednamestringRequiredstateRentalStateRequiredstarting: GPUs allocated, waiting for the agent to start the container. Not billed. While the rental'simage_isphase fetchingthe agent does not know it yet.running: the container runs. Billed per second.exited: the host reports the container is not running, for example after a crash; the host is restarting it. GPUs stay reserved. Not billed; returns torunningwhen the host reports it running again.stopping: stop requested, waiting for the agent. Not billed. Becomesstoppedwithout the agent once the host has been offline for 90 seconds.stopped: GPUs released, workspace kept on the host. GPU time is not billed. Storage is billed per GiB while the organization has credit, except for aninterruption_rental, which never stops with data.behavior: delete host_: the host stopped syncing. Not billed; returns tooffline runningwhen the host syncs again, and becomesfailedonce the host has not synced forHOST_(24 hours;).STALE_ AFTER deleting: delete requested, waiting for the agent. Not billed. Becomesdeletedwithout the agent once the host has been offline for 90 seconds.deleted: container and workspace removed. Final.failed: the agent could not start or keep running the container. GPUs released. The rental can only be deleted.one of: "starting", "running", "exited", "stopping", "stopped", "host_offline", "deleting", "deleted", "failed"
invited_emailstring. The address an invitation is for, masked (
g•••y@example.), on 403com invitation_fromfor_ another_ account getMyInvitation.at most 320 characters
403The caller lacks the permission this operation requires (`forbidden`), or signed in without having joined an organization yet (`no_organization`; `getOnboarding` and the invitation and organization operations under it work), or could not sign in (`email_unverified`, `account_conflict`, and `domain_not_allowed`). `not_invited` is no longer returned to session tokens.The caller lacks the permission this operation requires (
forbidden), or signed in without having joined an organization yet (no_;organization getOnboardingand the invitation and organization operations under it work), or could not sign in (email_,unverified account_, andconflict domain_).not_ allowed not_is no longer returned to session tokens.invited access_: a signed-in person who is not approved for the beta yet. Every operation that takes a credential answers it to them, exceptnot_ approved getMeandjoinMyWaitlist; the problem carriesaccess(waitlistedornot_, and the email). Approved means a member of an organization, holding a pending invitation, or Legion; an API key always belongs to a member.requested oauth_: the caller sent an OAuth access token (token_ mcp_ only lgo_), which is accepted only bymcpMessageand the tool calls it dispatches. Every other operation answers it, whatever the token's scope. Use an API key or the Legion web app.org_: the caller's organization is suspended. Every operation that takes a credential answers it, by session or API key, exceptsuspended getMe(which showsorg.andsuspended_ at org.) and the support operations undersuspension_ reason /.v1/ support/ terms_: an approved caller who has not accepted the current version of the Terms of Use and the Acceptable Use Policy. Every operation that takes a credential answers it, exceptnot_ accepted getMe,acceptLegalDocuments,joinMyWaitlistand the wind-down operations (listRentals,stopRental,deleteRental,listHosts,updateListingwithlistedfalse,removeHost); the problem carrieslegal. An API key acts for the person who created it, so it is refused until that person accepts. Terminal operations also returnsession_(called with an API key) andrequired step_(neither a sign-in nor a step-up challenge within the step-up window).up_ required typestringRequiredURI reference identifying the problem type: the code's entry in the public error reference,
https:/. Branch on/ legion. ambient. xyz/ docs/ errors#<code> code, never ontype.titlestringRequiredstatusintegerRequiredcodestringRequiredStable machine-readable error code.
detailstringinstancestringThe request path that produced the problem.
resource_idstring (uuid)The resource a conflict refers to, when there is one (
egress_: the request already waiting;request_ exists export_: the pending workspace export).in_ progress accessMeAccessWhether a signed-in person may use Legion during the closed beta, decided on their verified email (case-insensitive):
approved(a member of an organization, holding a pending invitation, or Legion),waitlisted(on the waitlist, not approved yet) ornot_(not on the waitlist). Carried byrequested Me(alwaysapprovedfor a member) and by the problem of a 403access_, and ofnot_ approved getMe's 403no_.organization Child fields · 2
statestringRequiredone of: "approved", "waitlisted", "not_requested"
emailstring (email)RequiredThe verified email the state was decided on.
legalMeLegalThe caller's consent to Legion's legal documents.
requiredlists every document the consent step shows andacceptLegalDocumentstakes, at its current version.acceptedis true when the caller accepted the current version of everyagreedocument; while it is false, every operation exceptgetMe,acceptLegalDocuments,joinMyWaitlistand the wind-down operations (listing, stopping and deleting rentals; listing hosts, stopping new rentals on them and removing them) answers 403terms_.not_ accepted Child fields · 2
requiredarray of LegalDocumentRequiredChild fields · 6
keyLegalDocumentKeyRequiredA legal document:
terms(Terms of Use),acceptable_(Acceptable Use Policy),use privacy(Privacy Policy),data_(Data Handling).handling one of: "terms", "acceptable_use", "privacy", "data_handling"
versionstringRequiredThe current version. A new version of an
agreedocument must be accepted again.effectivestring (date)RequiredThe date the current version took effect.
titlestringRequiredurlstring (uri)RequiredThe document's public page.
acceptancestringRequiredagree: the person agrees to it, and the API is refused until the current version is accepted.acknowledge: the person confirms having read it, in the same step.one of: "agree", "acknowledge"
acceptedbooleanRequired
blocking_rentalsarray of HostRemovalBlockingRentalSorted by ID.
at most 1000 items
Child fields · 6
idstring (uuid)RequirednameFriendlyNameA host's or rental's friendly name: a lowercase DNS label that starts with a letter and does not end with a hyphen. Unique across all hosts and rentals and never reused. A host's is generated as adjective-noun (
amber-falcon) and can be changed by its owner; a rental's is generated as adjective-noun plus four base36 characters (quiet-river-7k2f) and never changes.2–63 characters · pattern ^[a-z][a-z0-9-]{0,61}[a-z0-9]$
stateRentalStateRequiredstarting: GPUs allocated, waiting for the agent to start the container. Not billed. While the rental'simage_isphase fetchingthe agent does not know it yet.running: the container runs. Billed per second.exited: the host reports the container is not running, for example after a crash; the host is restarting it. GPUs stay reserved. Not billed; returns torunningwhen the host reports it running again.stopping: stop requested, waiting for the agent. Not billed. Becomesstoppedwithout the agent once the host has been offline for 90 seconds.stopped: GPUs released, workspace kept on the host. GPU time is not billed. Storage is billed per GiB while the organization has credit, except for aninterruption_rental, which never stops with data.behavior: delete host_: the host stopped syncing. Not billed; returns tooffline runningwhen the host syncs again, and becomesfailedonce the host has not synced forHOST_(24 hours;).STALE_ AFTER deleting: delete requested, waiting for the agent. Not billed. Becomesdeletedwithout the agent once the host has been offline for 90 seconds.deleted: container and workspace removed. Final.failed: the agent could not start or keep running the container. GPUs released. The rental can only be deleted.one of: "starting", "running", "exited", "stopping", "stopped", "host_offline", "deleting", "deleted", "failed"
endablebooleanRequiredRemoving the host anyway (
removeHostwithforcetrue) would end it: it ishost_on a host that is offline, and not on a preservation hold. A rental that runs, or that the host still has to act on, is never endable.offline heldbooleanOn a preservation hold.
rented_by_youbooleanThe caller's own organization rented it, so the caller can open it (
getRental). Only fromremoveHost; absent means false.
stored_data_rentalsarray of HostStoredDataRental. Sorted by ID.
at most 1000 items
Child fields · 8
idstring (uuid)RequirednameFriendlyNameA host's or rental's friendly name: a lowercase DNS label that starts with a letter and does not end with a hyphen. Unique across all hosts and rentals and never reused. A host's is generated as adjective-noun (
amber-falcon) and can be changed by its owner; a rental's is generated as adjective-noun plus four base36 characters (quiet-river-7k2f) and never changes.2–63 characters · pattern ^[a-z][a-z0-9-]{0,61}[a-z0-9]$
stateRentalStateRequiredstarting: GPUs allocated, waiting for the agent to start the container. Not billed. While the rental'simage_isphase fetchingthe agent does not know it yet.running: the container runs. Billed per second.exited: the host reports the container is not running, for example after a crash; the host is restarting it. GPUs stay reserved. Not billed; returns torunningwhen the host reports it running again.stopping: stop requested, waiting for the agent. Not billed. Becomesstoppedwithout the agent once the host has been offline for 90 seconds.stopped: GPUs released, workspace kept on the host. GPU time is not billed. Storage is billed per GiB while the organization has credit, except for aninterruption_rental, which never stops with data.behavior: delete host_: the host stopped syncing. Not billed; returns tooffline runningwhen the host syncs again, and becomesfailedonce the host has not synced forHOST_(24 hours;).STALE_ AFTER deleting: delete requested, waiting for the agent. Not billed. Becomesdeletedwithout the agent once the host has been offline for 90 seconds.deleted: container and workspace removed. Final.failed: the agent could not start or keep running the container. GPUs released. The rental can only be deleted.one of: "starting", "running", "exited", "stopping", "stopped", "host_offline", "deleting", "deleted", "failed"
estimated_size_bytesinteger (int64)RequiredThe size of its files on the host; with
estimate_basis disk_an upper bound.share estimate_basisBackupEstimateBasisRequired. What a backup's quote was computed on.
disk_: the size the rental's host last reported its workspace uses (used disk_).used_ gib disk_: the host does not report it (a host whose disk quota is not enforced, for example not on XFS), so the quote is the rental's whole disk share (share resources.): an upper bound, "up to" this price, trued down to the real size when the backup is ready. Either way the charge never exceeds the quote: a backup larger than its estimate (a staledisk_ gib disk_) is charged the quote, not more.used_ gib one of: "disk_used", "disk_share"
delete_afterstring (date-time)When its files are deleted (its
delete_); absent while held.after backup_stateBackupStateIts renter's newest backup, when it has one.
rented_by_youbooleanThe caller's own organization rented it. Only on the public listener; absent means false.
available_untilstring (date-time). On 409
host_frommaintenance createRental(whatever the window's state), when the host's window starts. Nothing more about the window: its end and reason are only for the renters of rentals on the host.maintenanceMaintenanceSummary. On 409
host_frommaintenance startRentalof the renter's own rental, the window that keeps it stopped.Child fields · 4
startstring (date-time)RequiredWhen the window starts: the host's rentals stop then (after a 5-minute notice).
endstring (date-time)RequiredThe planned end. The provider may end the window earlier.
reasonMaintenanceReasonRequired. Why a provider takes a host down, shown to the renters of rentals on it. The list grows: accept a value you do not know.
one of: "hardware", "software", "network", "power", "facility", "other"
stateMaintenanceStateRequired.
scheduled(announced, renters told),closing(the last 5 minutes before the start: the penalty-free outcome is decided, nothing can start, rentals in their notice),active(the host is in maintenance, its rentals stopped),overrun(the planned end passed and the host has not synced back),completed,cancelled. The list grows: accept a value you do not know.one of: "scheduled", "closing", "active", "overrun", "completed", "cancelled"
test_switchAdminOrgTestSwitchChild fields · 5
test_orgbooleanRequiredallowedbooleanRequiredblocking_rentalsarray of AdminOrgTestBlockingRentalRequiredat most 100 items
Child fields · 7
idstring (uuid)RequirednameFriendlyNameA host's or rental's friendly name: a lowercase DNS label that starts with a letter and does not end with a hyphen. Unique across all hosts and rentals and never reused. A host's is generated as adjective-noun (
amber-falcon) and can be changed by its owner; a rental's is generated as adjective-noun plus four base36 characters (quiet-river-7k2f) and never changes.2–63 characters · pattern ^[a-z][a-z0-9-]{0,61}[a-z0-9]$
stateRentalStateRequiredstarting: GPUs allocated, waiting for the agent to start the container. Not billed. While the rental'simage_isphase fetchingthe agent does not know it yet.running: the container runs. Billed per second.exited: the host reports the container is not running, for example after a crash; the host is restarting it. GPUs stay reserved. Not billed; returns torunningwhen the host reports it running again.stopping: stop requested, waiting for the agent. Not billed. Becomesstoppedwithout the agent once the host has been offline for 90 seconds.stopped: GPUs released, workspace kept on the host. GPU time is not billed. Storage is billed per GiB while the organization has credit, except for aninterruption_rental, which never stops with data.behavior: delete host_: the host stopped syncing. Not billed; returns tooffline runningwhen the host syncs again, and becomesfailedonce the host has not synced forHOST_(24 hours;).STALE_ AFTER deleting: delete requested, waiting for the agent. Not billed. Becomesdeletedwithout the agent once the host has been offline for 90 seconds.deleted: container and workspace removed. Final.failed: the agent could not start or keep running the container. GPUs released. The rental can only be deleted.one of: "starting", "running", "exited", "stopping", "stopped", "host_offline", "deleting", "deleted", "failed"
renter_orgOrgRequiredChild fields · 2
idstring (uuid)RequirednamestringRequired
provider_orgOrgRequiredChild fields · 2
idstring (uuid)RequirednamestringRequired
host_idstring (uuid)Requiredhost_nameFriendlyNameA host's or rental's friendly name: a lowercase DNS label that starts with a letter and does not end with a hyphen. Unique across all hosts and rentals and never reused. A host's is generated as adjective-noun (
amber-falcon) and can be changed by its owner; a rental's is generated as adjective-noun plus four base36 characters (quiet-river-7k2f) and never changes.2–63 characters · pattern ^[a-z][a-z0-9-]{0,61}[a-z0-9]$
blocking_rental_countintegerRequiredat least 0
unpaid_earningsMoneyRequiredChild fields · 2
amount_minorinteger (int64)RequiredAmount in minor units (cents for USD).
at least 0
currencyMoneyCurrencyRequiredISO 4217 currency code. Only USD is supported.
one of: "USD"
current_price_per_gpu_hourMoneyThe host's price per GPU-hour now, on 409
price_fromchanged createRental, the price a bid would win now on 409bid_, or the floor on 409too_ low bid_; all-in, as the renter sees prices.below_ floor Child fields · 2
amount_minorinteger (int64)RequiredAmount in minor units (cents for USD).
at least 0
currencyMoneyCurrencyRequiredISO 4217 currency code. Only USD is supported.
one of: "USD"
next_available_atstring (date-time)When the action is allowed again, on 429
benchmark_fromrequest_ limited requestHostBenchmark.reasonPromoIneligibleReasonWhy the organization may not redeem the promo code, on 403
promo_.code_ not_ eligible registryRegistrySignInRegistry. The registry a sign-in would be for, on 422
image_of an image on a registry Legion takes sign-ins for (offer to add one withprivate putRegistrySignIn), and on 422registry_(the sign-in the registry refused). Only ever one of these four;sign_ in_ rejected registry_names any host.host registry_hoststring. The registry host a credential is or would be for: on 422
image_(offer to add one withprivate createRegistryCredential),registry_,sign_ in_ rejected registry_, and the refusals of a registry (credential_ rejected registry_,ecr_ unsupported registry_,auth_ unsupported registry_,host_ not_ allowed registry_).realm_ not_ allowed at most 253 characters
registry_credential_idstring (uuid). The credential the registry refused, on 422
registry_.sign_ in_ rejected registry_credential_rentalsarray of RegistryCredentialRental. The rentals that still use a registry credential, on 409
registry_fromcredential_ in_ use deleteRegistryCredentialanddeleteRegistrySignIn. Oldest first.at most 100 items
Child fields · 3
idstring (uuid)RequirednamestringRequiredstateRentalStateRequiredstarting: GPUs allocated, waiting for the agent to start the container. Not billed. While the rental'simage_isphase fetchingthe agent does not know it yet.running: the container runs. Billed per second.exited: the host reports the container is not running, for example after a crash; the host is restarting it. GPUs stay reserved. Not billed; returns torunningwhen the host reports it running again.stopping: stop requested, waiting for the agent. Not billed. Becomesstoppedwithout the agent once the host has been offline for 90 seconds.stopped: GPUs released, workspace kept on the host. GPU time is not billed. Storage is billed per GiB while the organization has credit, except for aninterruption_rental, which never stops with data.behavior: delete host_: the host stopped syncing. Not billed; returns tooffline runningwhen the host syncs again, and becomesfailedonce the host has not synced forHOST_(24 hours;).STALE_ AFTER deleting: delete requested, waiting for the agent. Not billed. Becomesdeletedwithout the agent once the host has been offline for 90 seconds.deleted: container and workspace removed. Final.failed: the agent could not start or keep running the container. GPUs released. The rental can only be deleted.one of: "starting", "running", "exited", "stopping", "stopped", "host_offline", "deleting", "deleted", "failed"
invited_emailstring. The address an invitation is for, masked (
g•••y@example.), on 403com invitation_fromfor_ another_ account getMyInvitation.at most 320 characters
500An unexpected server error. Safe to retry.An unexpected server error. Safe to retry.
typestringRequiredURI reference identifying the problem type.
titlestringRequiredstatusintegerRequiredcodestringRequiredStable machine-readable error code.
detailstringinstancestringThe request path that produced the problem.
503The billing service failed or did not answer within 3 seconds (`billing_unavailable`). Nothing changed; retry with backoff.The billing service failed or did not answer within 3 seconds (
billing_). Nothing changed; retry with backoff.unavailable typestringRequiredURI reference identifying the problem type: the code's entry in the public error reference,
https:/. Branch on/ legion. ambient. xyz/ docs/ errors#<code> code, never ontype.titlestringRequiredstatusintegerRequiredcodestringRequiredStable machine-readable error code.
detailstringinstancestringThe request path that produced the problem.
resource_idstring (uuid)The resource a conflict refers to, when there is one (
egress_: the request already waiting;request_ exists export_: the pending workspace export).in_ progress accessMeAccessWhether a signed-in person may use Legion during the closed beta, decided on their verified email (case-insensitive):
approved(a member of an organization, holding a pending invitation, or Legion),waitlisted(on the waitlist, not approved yet) ornot_(not on the waitlist). Carried byrequested Me(alwaysapprovedfor a member) and by the problem of a 403access_, and ofnot_ approved getMe's 403no_.organization Child fields · 2
statestringRequiredone of: "approved", "waitlisted", "not_requested"
emailstring (email)RequiredThe verified email the state was decided on.
legalMeLegalThe caller's consent to Legion's legal documents.
requiredlists every document the consent step shows andacceptLegalDocumentstakes, at its current version.acceptedis true when the caller accepted the current version of everyagreedocument; while it is false, every operation exceptgetMe,acceptLegalDocuments,joinMyWaitlistand the wind-down operations (listing, stopping and deleting rentals; listing hosts, stopping new rentals on them and removing them) answers 403terms_.not_ accepted Child fields · 2
requiredarray of LegalDocumentRequiredChild fields · 6
keyLegalDocumentKeyRequiredA legal document:
terms(Terms of Use),acceptable_(Acceptable Use Policy),use privacy(Privacy Policy),data_(Data Handling).handling one of: "terms", "acceptable_use", "privacy", "data_handling"
versionstringRequiredThe current version. A new version of an
agreedocument must be accepted again.effectivestring (date)RequiredThe date the current version took effect.
titlestringRequiredurlstring (uri)RequiredThe document's public page.
acceptancestringRequiredagree: the person agrees to it, and the API is refused until the current version is accepted.acknowledge: the person confirms having read it, in the same step.one of: "agree", "acknowledge"
acceptedbooleanRequired
blocking_rentalsarray of HostRemovalBlockingRentalSorted by ID.
at most 1000 items
Child fields · 6
idstring (uuid)RequirednameFriendlyNameA host's or rental's friendly name: a lowercase DNS label that starts with a letter and does not end with a hyphen. Unique across all hosts and rentals and never reused. A host's is generated as adjective-noun (
amber-falcon) and can be changed by its owner; a rental's is generated as adjective-noun plus four base36 characters (quiet-river-7k2f) and never changes.2–63 characters · pattern ^[a-z][a-z0-9-]{0,61}[a-z0-9]$
stateRentalStateRequiredstarting: GPUs allocated, waiting for the agent to start the container. Not billed. While the rental'simage_isphase fetchingthe agent does not know it yet.running: the container runs. Billed per second.exited: the host reports the container is not running, for example after a crash; the host is restarting it. GPUs stay reserved. Not billed; returns torunningwhen the host reports it running again.stopping: stop requested, waiting for the agent. Not billed. Becomesstoppedwithout the agent once the host has been offline for 90 seconds.stopped: GPUs released, workspace kept on the host. GPU time is not billed. Storage is billed per GiB while the organization has credit, except for aninterruption_rental, which never stops with data.behavior: delete host_: the host stopped syncing. Not billed; returns tooffline runningwhen the host syncs again, and becomesfailedonce the host has not synced forHOST_(24 hours;).STALE_ AFTER deleting: delete requested, waiting for the agent. Not billed. Becomesdeletedwithout the agent once the host has been offline for 90 seconds.deleted: container and workspace removed. Final.failed: the agent could not start or keep running the container. GPUs released. The rental can only be deleted.one of: "starting", "running", "exited", "stopping", "stopped", "host_offline", "deleting", "deleted", "failed"
endablebooleanRequiredRemoving the host anyway (
removeHostwithforcetrue) would end it: it ishost_on a host that is offline, and not on a preservation hold. A rental that runs, or that the host still has to act on, is never endable.offline heldbooleanOn a preservation hold.
rented_by_youbooleanThe caller's own organization rented it, so the caller can open it (
getRental). Only fromremoveHost; absent means false.
stored_data_rentalsarray of HostStoredDataRental. Sorted by ID.
at most 1000 items
Child fields · 8
idstring (uuid)RequirednameFriendlyNameA host's or rental's friendly name: a lowercase DNS label that starts with a letter and does not end with a hyphen. Unique across all hosts and rentals and never reused. A host's is generated as adjective-noun (
amber-falcon) and can be changed by its owner; a rental's is generated as adjective-noun plus four base36 characters (quiet-river-7k2f) and never changes.2–63 characters · pattern ^[a-z][a-z0-9-]{0,61}[a-z0-9]$
stateRentalStateRequiredstarting: GPUs allocated, waiting for the agent to start the container. Not billed. While the rental'simage_isphase fetchingthe agent does not know it yet.running: the container runs. Billed per second.exited: the host reports the container is not running, for example after a crash; the host is restarting it. GPUs stay reserved. Not billed; returns torunningwhen the host reports it running again.stopping: stop requested, waiting for the agent. Not billed. Becomesstoppedwithout the agent once the host has been offline for 90 seconds.stopped: GPUs released, workspace kept on the host. GPU time is not billed. Storage is billed per GiB while the organization has credit, except for aninterruption_rental, which never stops with data.behavior: delete host_: the host stopped syncing. Not billed; returns tooffline runningwhen the host syncs again, and becomesfailedonce the host has not synced forHOST_(24 hours;).STALE_ AFTER deleting: delete requested, waiting for the agent. Not billed. Becomesdeletedwithout the agent once the host has been offline for 90 seconds.deleted: container and workspace removed. Final.failed: the agent could not start or keep running the container. GPUs released. The rental can only be deleted.one of: "starting", "running", "exited", "stopping", "stopped", "host_offline", "deleting", "deleted", "failed"
estimated_size_bytesinteger (int64)RequiredThe size of its files on the host; with
estimate_basis disk_an upper bound.share estimate_basisBackupEstimateBasisRequired. What a backup's quote was computed on.
disk_: the size the rental's host last reported its workspace uses (used disk_).used_ gib disk_: the host does not report it (a host whose disk quota is not enforced, for example not on XFS), so the quote is the rental's whole disk share (share resources.): an upper bound, "up to" this price, trued down to the real size when the backup is ready. Either way the charge never exceeds the quote: a backup larger than its estimate (a staledisk_ gib disk_) is charged the quote, not more.used_ gib one of: "disk_used", "disk_share"
delete_afterstring (date-time)When its files are deleted (its
delete_); absent while held.after backup_stateBackupStateIts renter's newest backup, when it has one.
rented_by_youbooleanThe caller's own organization rented it. Only on the public listener; absent means false.
available_untilstring (date-time). On 409
host_frommaintenance createRental(whatever the window's state), when the host's window starts. Nothing more about the window: its end and reason are only for the renters of rentals on the host.maintenanceMaintenanceSummary. On 409
host_frommaintenance startRentalof the renter's own rental, the window that keeps it stopped.Child fields · 4
startstring (date-time)RequiredWhen the window starts: the host's rentals stop then (after a 5-minute notice).
endstring (date-time)RequiredThe planned end. The provider may end the window earlier.
reasonMaintenanceReasonRequired. Why a provider takes a host down, shown to the renters of rentals on it. The list grows: accept a value you do not know.
one of: "hardware", "software", "network", "power", "facility", "other"
stateMaintenanceStateRequired.
scheduled(announced, renters told),closing(the last 5 minutes before the start: the penalty-free outcome is decided, nothing can start, rentals in their notice),active(the host is in maintenance, its rentals stopped),overrun(the planned end passed and the host has not synced back),completed,cancelled. The list grows: accept a value you do not know.one of: "scheduled", "closing", "active", "overrun", "completed", "cancelled"
test_switchAdminOrgTestSwitchChild fields · 5
test_orgbooleanRequiredallowedbooleanRequiredblocking_rentalsarray of AdminOrgTestBlockingRentalRequiredat most 100 items
Child fields · 7
idstring (uuid)RequirednameFriendlyNameA host's or rental's friendly name: a lowercase DNS label that starts with a letter and does not end with a hyphen. Unique across all hosts and rentals and never reused. A host's is generated as adjective-noun (
amber-falcon) and can be changed by its owner; a rental's is generated as adjective-noun plus four base36 characters (quiet-river-7k2f) and never changes.2–63 characters · pattern ^[a-z][a-z0-9-]{0,61}[a-z0-9]$
stateRentalStateRequiredstarting: GPUs allocated, waiting for the agent to start the container. Not billed. While the rental'simage_isphase fetchingthe agent does not know it yet.running: the container runs. Billed per second.exited: the host reports the container is not running, for example after a crash; the host is restarting it. GPUs stay reserved. Not billed; returns torunningwhen the host reports it running again.stopping: stop requested, waiting for the agent. Not billed. Becomesstoppedwithout the agent once the host has been offline for 90 seconds.stopped: GPUs released, workspace kept on the host. GPU time is not billed. Storage is billed per GiB while the organization has credit, except for aninterruption_rental, which never stops with data.behavior: delete host_: the host stopped syncing. Not billed; returns tooffline runningwhen the host syncs again, and becomesfailedonce the host has not synced forHOST_(24 hours;).STALE_ AFTER deleting: delete requested, waiting for the agent. Not billed. Becomesdeletedwithout the agent once the host has been offline for 90 seconds.deleted: container and workspace removed. Final.failed: the agent could not start or keep running the container. GPUs released. The rental can only be deleted.one of: "starting", "running", "exited", "stopping", "stopped", "host_offline", "deleting", "deleted", "failed"
renter_orgOrgRequiredChild fields · 2
idstring (uuid)RequirednamestringRequired
provider_orgOrgRequiredChild fields · 2
idstring (uuid)RequirednamestringRequired
host_idstring (uuid)Requiredhost_nameFriendlyNameA host's or rental's friendly name: a lowercase DNS label that starts with a letter and does not end with a hyphen. Unique across all hosts and rentals and never reused. A host's is generated as adjective-noun (
amber-falcon) and can be changed by its owner; a rental's is generated as adjective-noun plus four base36 characters (quiet-river-7k2f) and never changes.2–63 characters · pattern ^[a-z][a-z0-9-]{0,61}[a-z0-9]$
blocking_rental_countintegerRequiredat least 0
unpaid_earningsMoneyRequiredChild fields · 2
amount_minorinteger (int64)RequiredAmount in minor units (cents for USD).
at least 0
currencyMoneyCurrencyRequiredISO 4217 currency code. Only USD is supported.
one of: "USD"
current_price_per_gpu_hourMoneyThe host's price per GPU-hour now, on 409
price_fromchanged createRental, the price a bid would win now on 409bid_, or the floor on 409too_ low bid_; all-in, as the renter sees prices.below_ floor Child fields · 2
amount_minorinteger (int64)RequiredAmount in minor units (cents for USD).
at least 0
currencyMoneyCurrencyRequiredISO 4217 currency code. Only USD is supported.
one of: "USD"
next_available_atstring (date-time)When the action is allowed again, on 429
benchmark_fromrequest_ limited requestHostBenchmark.reasonPromoIneligibleReasonWhy the organization may not redeem the promo code, on 403
promo_.code_ not_ eligible registryRegistrySignInRegistry. The registry a sign-in would be for, on 422
image_of an image on a registry Legion takes sign-ins for (offer to add one withprivate putRegistrySignIn), and on 422registry_(the sign-in the registry refused). Only ever one of these four;sign_ in_ rejected registry_names any host.host registry_hoststring. The registry host a credential is or would be for: on 422
image_(offer to add one withprivate createRegistryCredential),registry_,sign_ in_ rejected registry_, and the refusals of a registry (credential_ rejected registry_,ecr_ unsupported registry_,auth_ unsupported registry_,host_ not_ allowed registry_).realm_ not_ allowed at most 253 characters
registry_credential_idstring (uuid). The credential the registry refused, on 422
registry_.sign_ in_ rejected registry_credential_rentalsarray of RegistryCredentialRental. The rentals that still use a registry credential, on 409
registry_fromcredential_ in_ use deleteRegistryCredentialanddeleteRegistrySignIn. Oldest first.at most 100 items
Child fields · 3
idstring (uuid)RequirednamestringRequiredstateRentalStateRequiredstarting: GPUs allocated, waiting for the agent to start the container. Not billed. While the rental'simage_isphase fetchingthe agent does not know it yet.running: the container runs. Billed per second.exited: the host reports the container is not running, for example after a crash; the host is restarting it. GPUs stay reserved. Not billed; returns torunningwhen the host reports it running again.stopping: stop requested, waiting for the agent. Not billed. Becomesstoppedwithout the agent once the host has been offline for 90 seconds.stopped: GPUs released, workspace kept on the host. GPU time is not billed. Storage is billed per GiB while the organization has credit, except for aninterruption_rental, which never stops with data.behavior: delete host_: the host stopped syncing. Not billed; returns tooffline runningwhen the host syncs again, and becomesfailedonce the host has not synced forHOST_(24 hours;).STALE_ AFTER deleting: delete requested, waiting for the agent. Not billed. Becomesdeletedwithout the agent once the host has been offline for 90 seconds.deleted: container and workspace removed. Final.failed: the agent could not start or keep running the container. GPUs released. The rental can only be deleted.one of: "starting", "running", "exited", "stopping", "stopped", "host_offline", "deleting", "deleted", "failed"
invited_emailstring. The address an invitation is for, masked (
g•••y@example.), on 403com invitation_fromfor_ another_ account getMyInvitation.at most 320 characters
Errors
| Status | Code |
|---|---|
| 403 | no_organization |
| 503 | billing_unavailable |
Every operation can also answer the general codes on the errors page.