Repository navigation
chore(HOST-4274): contracts route - #983
Open
ronan-vast wants to merge 2 commits into
Open
ronan-vast wants to merge 2 commits into
ronan-vast wants to merge 2 commits into
Conversation
Contributor
|
Preview deployment for your docs. Learn more about Mintlify Previews.
💡 Tip: Enable Automations to automatically generate PRs for you. |
Contributor
|
@ronan-vast this pr could also use a description and a copilot review.. |
There was a problem hiding this comment.
🟡 Changes recommended
The sla_confidence enum excludes null despite being declared nullable in both OpenAPI specifications, causing responses containing sla_confidence: null to fail schema validation.
1 open issue
What changed in this PR
Adds contract lookup documentation to the API reference for hosts viewing machine rentals and clients fetching their own contracts.
Changes:
- Documents machine contracts, including host earnings, storage behavior, response limits, and degraded responses.
- Documents client contract lookup by ID with optional label filtering.
- Adds both endpoints to the combined OpenAPI specification and permissions mapping.
| File | Description |
|---|---|
api-reference/permissions.mdx |
Maps machine contracts to machine_read and contract fetching to misc. |
api-reference/openapi/yaml/show_machine_contracts.yaml |
Defines the host-facing machine contracts endpoint and response schema. |
api-reference/openapi/yaml/fetch_contracts.yaml |
Defines client contract lookup, filtering, and response fields. |
api-reference/openapi.yaml |
Incorporates both endpoints and the machine contract schema. |
Review effort: Balanced
Comment on lines
+250
to
+253
| enum: | ||
| - high | ||
| - medium | ||
| - low |
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Summary
Adds API reference docs for two contract endpoints and lists them on the permissions page.
GET /api/v0/machines/{machine_id}/contracts (show machine contracts, under Machines). Lists the active client contracts on a machine the host owns: running instances, stopped (storage-only) instances, and standalone storage and volume contracts. The page covers:
Ordering by end_date (contracts with no end date first), and that all prices are host earnings after the platform fee.
How standalone disk and volume contracts show up compared with network volumes attached to an instance.
How earn_day is calculated: previous full UTC day, an estimate for contracts that started today, null when billing data isn't available yet.
Incomplete responses: the 500-contract cap with truncated, plus omitted_contract_ids, billing_degraded and aggregation_degraded.
Errors: 400, 401, 403, 404 and 429.
POST /api/v0/contracts/fetch (fetch contracts, under Instances). Returns the caller's own rented contracts by ID, optionally filtered by label. IDs that don't exist or belong to someone else are skipped silently, and at most 4096 contracts come back. The description warns that this returns the full stored record and points to show instance for a stable view. It also links to show machine contracts for hosts.
Permissions: Show Machine Contracts goes under machine_read (its table row now mentions machine contracts), and Fetch Contracts goes under misc.