https://api.sfcompute.com/v2. All requests require a
Bearer token.
The API exposes the same resource model as the CLI. Pools hold an allocation schedule, orders buy
and sell compute time, and instances run on pools. If that model is new, start with
Instances and Pools before wiring the API into an
application.
Create an API token
Create a token with the CLI.sk_live_. Save it somewhere safe. You can’t retrieve it again.
Grant permissions
Tokens start with no permissions. Grant access to the resources your token needs. These examples use a workspace namedmy-workspace; every new organization starts with one named default.
admin role grants full access to the workspace; give production tokens a narrower role. See
Roles and Grants for how permissions work, and the
Quickstart for more on workspaces.
Make a request
Replacemy-account with your organization name (shown by sf me or in the dashboard). Replace
<token> with the token you created above.
- Create or choose a pool.
- Place a buy order to add allocation.
- Create instances on the pool.
- Read pool, order, and instance state to track what happened.