{"openapi":"3.1.0","info":{"title":"Agentic Compute Storefront API","version":"0.1.0","description":"API for leasing and managing temporary compute: a bare Linux machine or an H100 GPU machine, selected with product_id."},"servers":[{"url":"https://compute-store.vercel.app"}],"paths":{"/api/health":{"get":{"operationId":"health","summary":"Check service health.","responses":{"200":{"description":"Service health.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Health"}}}}}}},"/api/machines":{"post":{"operationId":"createMachine","summary":"Create a temporary bare Linux machine.","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateMachineRequest"}}}},"responses":{"202":{"description":"Machine lease accepted. The response includes management tokens once, at creation time.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MachineWithManagement"}}}},"400":{"$ref":"#/components/responses/Error"}}}},"/api/machine/mpp/orders/validate":{"post":{"operationId":"validateOrder","summary":"Preflight validate an order and return its quote and payment methods.","description":"Submit the desired lease to confirm it is valid and to read the final quote and accepted payment methods. No payment is composed and no machine is created. Reuse the same body (including request_id) on POST /api/machine/mpp/orders.","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateMachineRequest"}}}},"responses":{"200":{"description":"The order is valid. Returns the protocol, accepted payment methods, product type, and quote.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidateOrderResponse"}}}},"400":{"$ref":"#/components/responses/Error"}}}},"/api/machine/mpp/orders":{"post":{"operationId":"createOrder","summary":"Create an MPP order (and machine) after payment.","description":"Submit the desired lease with a UUID request_id. Without a valid MPP credential the response is HTTP 402 with MPP payment challenges and { order_id, status: 'unpaid' }. Retry the identical body with an MPP payment credential to settle the order and provision the machine. request_id is the idempotency key.","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateMachineRequest"}}}},"responses":{"202":{"description":"Order settled. The response includes the order, payment_status, and machine management tokens.","headers":{"Payment-Receipt":{"description":"MPP payment receipt.","schema":{"type":"string"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/MppOrder"}}}},"400":{"$ref":"#/components/responses/Error"},"402":{"description":"MPP payment required. Inspect WWW-Authenticate headers for payment challenges; body is { order_id, status: 'unpaid' }."}}}},"/api/machine/mpp/orders/{order_id}":{"get":{"operationId":"getOrder","summary":"Poll order payment status by order_id.","parameters":[{"name":"order_id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"The order payment/fulfilment status.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MppOrder"}}}},"404":{"$ref":"#/components/responses/Error"}}}},"/api/machines/{machine_id}":{"get":{"operationId":"getMachine","summary":"Read machine status using the read capability token.","security":[{"readToken":[]}],"parameters":[{"$ref":"#/components/parameters/MachineId"}],"responses":{"200":{"description":"Machine status.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Machine"}}}},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"}}},"delete":{"operationId":"terminateMachine","summary":"Terminate a machine using the terminate capability token.","security":[{"terminateToken":[]}],"parameters":[{"$ref":"#/components/parameters/MachineId"}],"responses":{"200":{"description":"Terminated machine status.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Machine"}}}},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"}}}},"/api/machines/{machine_id}/extend":{"post":{"operationId":"extendMachine","summary":"Extend a machine lease using the extend capability token.","security":[{"extendToken":[]}],"parameters":[{"$ref":"#/components/parameters/MachineId"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ExtendMachineRequest"}}}},"responses":{"200":{"description":"Extended machine status.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Machine"}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Error"},"403":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"}}}}},"components":{"securitySchemes":{"readToken":{"type":"http","scheme":"bearer","description":"Lease read_token."},"extendToken":{"type":"http","scheme":"bearer","description":"Lease extend_token."},"terminateToken":{"type":"http","scheme":"bearer","description":"Lease terminate_token."}},"parameters":{"MachineId":{"name":"machine_id","in":"path","required":true,"schema":{"type":"string","pattern":"^machine_[a-f0-9]{16}$"}}},"responses":{"Error":{"description":"Error response.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"schemas":{"Health":{"type":"object","required":["status","products"],"properties":{"status":{"type":"string","const":"ok"},"products":{"type":"array","items":{"type":"string","enum":["bare-linux-machine","gpu-h100-machine"]}}}},"CreateMachineRequest":{"type":"object","required":["request_id","product_id","duration_minutes","ssh_public_key"],"additionalProperties":false,"properties":{"request_id":{"type":"string","format":"uuid","description":"Idempotency key (UUID). Reuse the same value across validate, create, and the paid retry (with an otherwise identical body) so the same order resolves to the same payment challenge and order_id.","pattern":"^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$"},"product_id":{"type":"string","enum":["bare-linux-machine","gpu-h100-machine"],"description":"Which product to lease. Duration bounds and pricing are per product."},"duration_minutes":{"type":"integer","minimum":15,"maximum":360,"description":"Lease duration. Allowed range depends on product_id."},"ssh_public_key":{"type":"string","description":"SSH public key to install on the leased machine."}}},"ExtendMachineRequest":{"type":"object","required":["additional_minutes"],"additionalProperties":false,"properties":{"additional_minutes":{"type":"integer","minimum":1}}},"Machine":{"type":"object","required":["machine_id","product","provider","status","host","username","created_at","expires_at"],"properties":{"machine_id":{"type":"string"},"product":{"type":"string","enum":["bare-linux-machine","gpu-h100-machine"]},"provider":{"type":"string"},"status":{"type":"string","enum":["provisioning","active","terminating","terminated","failed"]},"host":{"type":["string","null"]},"username":{"type":"string"},"ssh_command":{"type":"string"},"created_at":{"type":"string","format":"date-time"},"expires_at":{"type":"string","format":"date-time"},"terminated_at":{"type":"string","format":"date-time"},"failure_reason":{"type":"string"}}},"MachineWithManagement":{"allOf":[{"$ref":"#/components/schemas/Machine"},{"type":"object","required":["management"],"properties":{"management":{"$ref":"#/components/schemas/ManagementTokens"}}}]},"MppOrder":{"type":"object","required":["order_id","status","payment_status","is_paid","current_step","order_complete_url"],"properties":{"order_id":{"type":"string"},"status":{"type":"string","enum":["unpaid","settled","settled_pending_webhook"]},"payment_status":{"type":"string","enum":["unpaid","paid","settled_pending_webhook"]},"is_paid":{"type":"boolean"},"current_step":{"type":"string"},"order_complete_url":{"type":"string","format":"uri"},"machine":{"$ref":"#/components/schemas/MachineWithManagement"}}},"CheckoutQuote":{"type":"object","required":["product_id","duration_minutes","base_fee_cents","unit_price_cents_per_minute","amount_cents","amount","currency"],"properties":{"product_id":{"type":"string","enum":["bare-linux-machine","gpu-h100-machine"]},"duration_minutes":{"type":"integer","minimum":15,"maximum":360},"base_fee_cents":{"type":"integer","minimum":0},"unit_price_cents_per_minute":{"type":"integer","minimum":1},"amount_cents":{"type":"integer","minimum":1},"amount":{"type":"string","pattern":"^\\d+\\.\\d{2}$"},"currency":{"type":"string","const":"usd"}}},"ValidateOrderResponse":{"type":"object","required":["protocol","methods","product_type","quote","request_id"],"properties":{"protocol":{"type":"string","const":"mpp"},"methods":{"type":"array","items":{"type":"string"}},"product_type":{"type":"string","const":"machine_lease"},"quote":{"$ref":"#/components/schemas/CheckoutQuote"},"request_id":{"type":"string","format":"uuid"}}},"ManagementTokens":{"type":"object","required":["read_token","extend_token","terminate_token"],"properties":{"read_token":{"type":"string"},"extend_token":{"type":"string"},"terminate_token":{"type":"string"}}},"Error":{"type":"object","required":["error"],"properties":{"error":{"type":"string"}}}}}}