{"openapi":"3.1.0","info":{"title":"Figment Mac hosting agent API","version":"1.0.0","summary":"Rent a Mac in the cloud by the hour or the day, for AI agents.","description":"Get prices, make an agent account, buy prepaid credit with a Stripe Checkout link, order a Mac, read its access details and stop it. Guide: https://figment.so/agents.md","termsOfService":"https://figment.so/terms","contact":{"name":"Figment support","email":"support@figment.so","url":"https://figment.so/agents.md"}},"servers":[{"url":"https://figment.so/api/agent/v1"}],"paths":{"/offer":{"get":{"operationId":"getOffer","summary":"Plans, prices, limits and live availability","security":[],"responses":{"200":{"description":"The offer","content":{"application/json":{"schema":{"type":"object"}}}}}}},"/accounts":{"post":{"operationId":"createAccount","summary":"Make an agent account and get an API key (shown once)","security":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["agent_name"],"properties":{"agent_name":{"type":"string","maxLength":80},"contact_email":{"type":"string","description":"Optional email of the user, for support only. Not verified. No mail is sent to it."}}}}}},"responses":{"201":{"description":"Account created","content":{"application/json":{"schema":{"type":"object","properties":{"account_id":{"type":"string"},"api_key":{"type":"string"},"credit_cents":{"type":"integer"},"claim_url":{"type":"string"}}}}}},"400":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/account":{"get":{"operationId":"getAccount","summary":"Credit, Macs, limits and the claim link","security":[{"agentKey":[]}],"responses":{"200":{"description":"The account","content":{"application/json":{"schema":{"type":"object","properties":{"account_id":{"type":"string"},"agent_name":{"type":"string"},"credit_cents":{"type":"integer"},"macs":{"type":"array","items":{"$ref":"#/components/schemas/Mac"}},"claim":{"type":"object"}}}}}},"401":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/credit":{"post":{"operationId":"buyCredit","summary":"Get a Stripe Checkout link for prepaid credit","security":[{"agentKey":[]}],"parameters":[{"name":"Idempotency-Key","in":"header","required":false,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{16,80}$"},"description":"The same key gives the same result. Required for credit and order calls unless idempotency_key is in the body."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["amount_cents"],"properties":{"amount_cents":{"type":"integer","minimum":100,"maximum":50000,"description":"At least 2500 for the first purchase."},"idempotency_key":{"type":"string"}}}}}},"responses":{"200":{"description":"A link to pay","content":{"application/json":{"schema":{"type":"object","properties":{"checkout_url":{"type":"string"},"amount_cents":{"type":"integer"},"purchase_id":{"type":"string"}}}}}},"400":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/macs":{"post":{"operationId":"startMac","summary":"Order an hourly or daily Mac from account credit","security":[{"agentKey":[]}],"parameters":[{"name":"Idempotency-Key","in":"header","required":false,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{16,80}$"},"description":"The same key gives the same result. Required for credit and order calls unless idempotency_key is in the body."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["plan","period","accept_terms","authorization"],"properties":{"plan":{"type":"string","enum":["intel-vm","apple-silicon-vm","dedicated-m4-pro"]},"period":{"type":"string","enum":["hourly","daily"]},"accept_terms":{"type":"boolean","const":true},"authorization":{"type":"string","const":"user_authorized","description":"The user allowed this agent to rent a Mac for them."},"intel_compatibility_accepted":{"type":"boolean","description":"Required for intel-vm."},"allow_wait":{"type":"boolean","description":"Order although no Mac of the plan is free now."},"renew_daily":{"type":"boolean"},"label":{"type":"string","maxLength":60},"ssh_public_key":{"type":"string","description":"Stored for a later install. Not installed in this version."},"idempotency_key":{"type":"string"}}}}}},"responses":{"200":{"description":"The same order again","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Mac"}}}},"201":{"description":"Order accepted","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Mac"}}}},"400":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"402":{"description":"More credit is needed","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"const":"credit_required"},"needed_cents":{"type":"integer"},"credit_cents":{"type":"integer"},"minimum_purchase_cents":{"type":"integer"}}}}}},"409":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/macs/{id}":{"get":{"operationId":"getMac","summary":"State of one Mac","security":[{"agentKey":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"The Mac","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Mac"}}}},"401":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/macs/{id}/access":{"post":{"operationId":"getMacAccess","summary":"SSH details, a one-time console link and the Mac login","security":[{"agentKey":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","properties":{"console":{"type":"boolean"},"login":{"type":"boolean"}}}}}},"responses":{"200":{"description":"Access details","content":{"application/json":{"schema":{"type":"object","properties":{"ssh":{"type":"object"},"console":{"type":["object","null"]},"login":{"type":["object","null"]},"ssh_key":{"type":"string"}}}}}},"401":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"503":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/macs/{id}/stop":{"post":{"operationId":"stopMac","summary":"End the rental. Billing stops. Data is kept seven days.","security":[{"agentKey":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"The Mac after the stop","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Mac"}}}},"401":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}}},"components":{"securitySchemes":{"agentKey":{"type":"http","scheme":"bearer","description":"The api_key from POST /accounts."}},"schemas":{"Error":{"type":"object","required":["error"],"properties":{"error":{"type":"string"},"message":{"type":"string"}}},"Mac":{"type":"object","properties":{"id":{"type":"string"},"plan":{"type":"string","enum":["intel-vm","apple-silicon-vm","dedicated-m4-pro"]},"period":{"type":"string","enum":["hourly","daily"]},"label":{"type":["string","null"]},"state":{"type":"string","enum":["provisioning","ready","stopping","stopped","ended_before_setup","deleted","failed"]},"state_reason":{"type":["string","null"]},"price_cents":{"type":"integer"},"price_unit":{"type":"string","enum":["hour","day"]},"spent_cents":{"type":"integer"},"credit_returned_cents":{"type":"integer"},"renew_daily":{"type":"boolean"},"created_at":{"type":"string"},"ready_at":{"type":["string","null"]},"paid_through":{"type":["string","null"]},"data_deleted_after":{"type":["string","null"]},"access_ready":{"type":"boolean"}}}}}}