Skip to content

chore(HOST-4274): contracts route - #983

Open
ronan-vast wants to merge 2 commits into
mainfrom
docs/HOST-4274-contracts-routes
Open

ronan-vast wants to merge 2 commits into
mainfrom
docs/HOST-4274-contracts-routes

Conversation

@ronan-vast

@ronan-vast ronan-vast commented Nov 6, 2026 •

Copy link
Copy Markdown

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.

@mintlify

mintlify Bot commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

Preview deployment for your docs. Learn more about Mintlify Previews.

Project Status Preview Updated
vastai-80aa3a82 🟢 Ready View Preview Nov 16, 2026, 9:28 PM

💡 Tip: Enable Automations to automatically generate PRs for you.

@sammy-vastai

Copy link
Copy Markdown
Contributor

@ronan-vast this pr could also use a description and a copilot review..

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 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

1 active deployment
staging — 9854bb46 Deployed Nov 16, 2026 by mintlify[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants