Overview
The API is read-only. It returns what the site already shows publicly, and, with a personal access token, what belongs to your account.
Every response is JSON encoded in UTF-8. Dates follow ISO 8601 in UTC, prices are in cents with their currency, and page links point to the English pages of the site.
Every path starts with https://foundationnw.dev/api/v1
curl https://foundationnw.dev/api/v1/resources?type=package
Authentication
Public endpoints need no token. For your own data, create a personal access token in your account and send it in the Authorization header. A token sent to a public endpoint also gives you the higher rate limit.
- Every token expires: choose 7, 30, 90, 365 days.
- You can have up to 25 active tokens at a time.
- The value is shown once. The site keeps only a fingerprint of it and emails you each time a token is created.
- Tokens start with fpt_, which lets secret scanners spot one pushed to a repository by mistake. Revoke it right away if that happens.
curl -H "Authorization: Bearer $FOUNDATION_TOKEN" https://foundationnw.dev/api/v1/me
Scopes
Each token only grants the scopes you ticked when you created it.
| Scope | Grants |
|---|---|
| profile:read | Your username, display name, language and whether your profile is public. Never your email address. |
| library:read | The paid resources you own, with the date you got them and the order reference. |
| library:download | Download the versions of paid resources you own or publish. Free resources need no token. |
| resources:read | The resources you publish alone or with your organizations, including drafts and resources in review. |
Endpoints
Every endpoint answers GET requests. Download the OpenAPI 3.1 description.
Releases and builds
| Endpoint | Description | Access |
|---|---|---|
| GET /api/v1/releases | Latest build on each channel of a product. Query parameters: product | Public |
| GET /api/v1/releases/{channel}/latest | Latest build on one channel. Query parameters: product | Public |
| GET /api/v1/builds/{product}/{buildNumber} | One build, with its files, checksums and provenance. | Public |
| GET /api/v1/builds/{product}/{buildNumber}/manifest | BuildKit manifest attached to a Foundation build. | Public |
| GET /api/v1/builds/{product}/{buildNumber}/sha256sums | SHA-256 checksums of a build, in the sha256sum format. | Public |
| GET /api/v1/compatibility | Which Foundation builds work with which nanos world and BuildKit versions. | Public |
Marketplace
| Endpoint | Description | Access |
|---|---|---|
| GET /api/v1/resources | Published marketplace resources, 24 per page. Query parameters: q, type, tag, foundation, price, rating, sort, page | Public |
| GET /api/v1/resources/{resource} | One resource, with its description and the compatibility of its latest version. | Public |
| GET /api/v1/resources/{resource}/versions | Published and withdrawn versions of a resource, newest first. | Public |
| GET /api/v1/resources/{resource}/versions/{version}/download | Redirects to a short-lived address for the file of a version. | Public for free resources, library:download for paid ones |
Profiles
| Endpoint | Description | Access |
|---|---|---|
| GET /api/v1/users/{username} | A member's public profile, organizations and published resources. | Public |
| GET /api/v1/organizations/{organization} | An organization, its members with a public profile and its published resources. | Public |
Your account
| Endpoint | Description | Access |
|---|---|---|
| GET /api/v1/me | Your account and the token in use. | profile:read |
| GET /api/v1/me/library | The paid resources you own. | library:read |
| GET /api/v1/me/resources | The resources you publish, whatever their status. | resources:read |
Reference
| Endpoint | Description | Access |
|---|---|---|
| GET /api/v1/openapi.json | This reference as an OpenAPI 3.1 document. | Public |
Pagination
Lists return a data array, a meta object with page, per_page, total and last_page, and a links object with the next and previous pages, or null. Ask for another page with ?page=2.
Rate limits
Without a token, each address can make 120 requests a minute. With a token, each member can make 600 requests a minute, whichever address they come from. Downloads are also limited to 60 a minute per address. Responses carry X-RateLimit-Limit and X-RateLimit-Remaining headers; past the limit you get a 429 with a Retry-After header in seconds.
Errors
Errors use the HTTP status and a JSON body with an error code. Invalid query parameters return 422 with the fields at fault.
| Code | Meaning |
|---|---|
| unauthenticated | 401. This endpoint needs a token and none was sent. |
| invalid_token | 401. The token is unknown, revoked or expired. |
| insufficient_scope | 403. The token does not grant the scope named in the response. |
| account_suspended | 403. The account that owns the token is suspended. |
| purchase_required | 403. The resource is paid and your account does not own it. The response links to the checkout page. |
| not_found | 404. Nothing public matches this address. |
| version_not_found | 404. The resource has no published version with this number. |
| version_withdrawn | 410. The publisher withdrew this version. |
| no_release | 404. Nothing has been published on this channel yet. |
| too_many_requests | 429. Wait for the number of seconds in the Retry-After header. |
Versions and changes
Version 1 of the API only grows: new fields and endpoints can appear, so ignore what you do not know. Removing or renaming a field would come with a new version, announced in the news beforehand.
The API does not write anything yet. Publishing resources and versions still happens on the site, where every file is scanned and reviewed.