Buy a server
Creates a VPS using your personal credit and returns an operation to track deployment. Keep the same Idempotency-Key when retrying.
Access: API key: vm:write · Session: developer, admin or owner.
- Top up first. API-key purchases charge the key creator. Insufficient credit returns
402without creating a server. - Credit is reserved while provisioning. Success charges it; a confirmed failure releases it. An uncertain result keeps the reservation for review.
- Choose
ssh_key,custom_passwordorrandom_password. Password modes do not require SSH keys. - Direct USDC payment is not supported here. Omit
payment_methodor usewallet. - New purchases return
503 purchases_pausedwhen purchasing is disabled. Already accepted requests can still be replayed.
AuthorizationBearer <token>Send Authorization: Bearer <token>. A token is an API key (lb_live_…, scoped, for programs) or a session (lb_sess_…, from signup or login, for people). See Authentication above.
Idempotency-Key?stringA unique string (for example a UUID). Repeating the same request with the same key returns the original result instead of buying again.
X-Org-ID?stringSessions only: act on this organization (you must be a member). Default: your first organization.
application/json- body
currency?stringSelected personal credit balance. Never converts or combines balances.
"USD""IDR"name*stringLetters, digits, ., _, -; starts with a letter or digit; up to 63 characters.
^[a-zA-Z0-9][a-zA-Z0-9._-]{0,62}$region*stringplan*stringimage*stringterm_months*integerPrepaid term in months.
1 <= valuequote_id?stringOptional: honour the price of a quote.
ssh_key_ids?array<string>Required for SSH key login (1 to 10); omit or use an empty array for password login. The combined first-boot payload must fit the server's creation limit; oversized selections return 400 before credit is reserved. Ed25519 keys are recommended.
0 <= items <= 10auth?stringDefaults to ssh_key. Password modes require no SSH keys. Random passwords are generated by Layerbeat and retrieved explicitly after provisioning.
"ssh_key""custom_password""random_password"password?stringRequired only for custom_password. Use ASCII letters, numbers or ()`~!@#$%^&*-+=_ and at least three of uppercase, lowercase, numbers and symbols. Never returned in ordinary API responses.
12 <= length <= 30auto_renew?booleanDefault false. Explicit true authorizes renewal for this term up to the purchase price; update the limit using the renewal settings endpoint.
falsepayment_method?"wallet"Spend available Layerbeat credit. Omit this field or use wallet. Fund credit separately using the top-up endpoint.
"wallet"tags?Up to 10 free-form labels.
properties <= 10Accepted: available credit is reserved and asynchronous creation has started
application/json- response
The purchased VM and its asynchronous operation. Creation always spends available credit.
vm*operation*curl -X POST 'https://layerbeat.com/v1/vms' \ -H 'Idempotency-Key: 7c1f1b0e-6f0c-4a5e-9c33-2d0c0f1c9a11' \ -H 'Content-Type: application/json' \ -d '{ "name": "web-1", "region": "sgp", "plan": "small", "image": "ubuntu-24-04", "term_months": 1, "ssh_key_ids": [ "key_m2q8vx4zt7kd5wn3bj6hf9cpra" ]}'{ "vm": { "id": "vm_gnkrp6zuxvsqki7sqxeluvsw2y", "name": "web-1", "status": "provisioning", "region": "sgp", "plan": "small", "image": "ubuntu-24-04", "ipv4": null, "ipv6": null, "vcpu": 2, "memory_mb": 2048, "disk_gb": 60, "created_at": "2026-10-01T10:00:00Z", "expires_at": null, "auto_renew": true, "ssh_key_ids": [ "key_m2q8vx4zt7kd5wn3bj6hf9cpra" ], "tags": {} }, "operation": { "id": "op_4yw4xmradad4bstgr4d5qtreb4", "type": "vm.create", "status": "pending", "vm_id": "vm_gnkrp6zuxvsqki7sqxeluvsw2y", "steps": [ { "name": "payment_reserved", "status": "succeeded" }, { "name": "creating_instance", "status": "running" }, { "name": "booting", "status": "pending" }, { "name": "ready", "status": "pending" } ], "result": null, "error": null, "created_at": "2026-10-01T10:00:00Z", "finished_at": null }}