{"openapi":"3.0.3","info":{"title":"sunucu.com API","version":"1.6.0","description":"REST API for sunucu.com — manage cloud servers, web hosting, domains, billing and support tickets, and subscribe to event webhooks. Every endpoint is scope-gated via API-key permissions (`account:read`, `servers:read`, `servers:write`, `servers:destroy`, `hosting:read`, `hosting:write`, `domains:read`, `domains:write`, `billing:read`, `tickets:read`, `tickets:write`, `webhooks:read`, `webhooks:write`).","contact":{"name":"sunucu.com Support","url":"https://sunucu.com/account/tickets"},"license":{"name":"Proprietary"}},"servers":[{"url":"https://api.sunucu.com/v1","description":"Production"}],"security":[{"bearerAuth":[]}],"tags":[{"name":"Account"},{"name":"Servers"},{"name":"Hosting"},{"name":"Domains"},{"name":"Billing"},{"name":"Support tickets"},{"name":"Webhooks"}],"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"API Key (snc_...)","description":"Mint an API key from your dashboard at https://sunucu.com/account/api-keys"}},"schemas":{"Error":{"type":"object","properties":{"statusCode":{"type":"integer"},"message":{"type":"string"},"error":{"type":"string"}}}},"responses":{"Unauthorized":{"description":"Missing or invalid API key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"Forbidden":{"description":"API key lacks the required scope","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"NotFound":{"description":"Resource not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"paths":{"/account":{"get":{"operationId":"getAccount","summary":"Get account","description":"Returns the authenticated account profile.","tags":["Account"],"security":[{"bearerAuth":["account:read"]}],"responses":{"200":{"description":"Success","content":{"application/json":{"example":{"id":"ee0d1f04-…","email":"you@example.com","name":"Jane Doe","country":"TR","email_verified":true,"created_at":"2026-01-01T00:00:00.000Z"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"}}}},"/servers":{"get":{"operationId":"getServers","summary":"List servers","description":"List every server on the account.","tags":["Servers"],"security":[{"bearerAuth":["servers:read"]}],"responses":{"200":{"description":"Success","content":{"application/json":{}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"}}}},"/servers/{id}":{"get":{"operationId":"getServersId","summary":"Get server","description":"Server detail (backbone-scrubbed — no upstream provider, no provisioning logs).","tags":["Servers"],"security":[{"bearerAuth":["servers:read"]}],"responses":{"200":{"description":"Success","content":{"application/json":{}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"}},"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}]},"delete":{"operationId":"deleteServersId","summary":"Terminate server","description":"DESTRUCTIVE — permanently terminate the server.","tags":["Servers"],"security":[{"bearerAuth":["servers:destroy"]}],"responses":{"200":{"description":"Success","content":{"application/json":{}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"}},"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}]}},"/servers/{id}/stats":{"get":{"operationId":"getServersIdStats","summary":"Live stats","description":"Live CPU / memory / network / disk usage.","tags":["Servers"],"security":[{"bearerAuth":["servers:read"]}],"responses":{"200":{"description":"Success","content":{"application/json":{}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"}},"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}]}},"/servers/{id}/snapshots":{"get":{"operationId":"getServersIdSnapshots","summary":"List snapshots","description":"Disk snapshots (restore points) for the server.","tags":["Servers"],"security":[{"bearerAuth":["servers:read"]}],"responses":{"200":{"description":"Success","content":{"application/json":{}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"}},"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}]},"post":{"operationId":"postServersIdSnapshots","summary":"Create snapshot","description":"Take a disk snapshot. Honours an optional Idempotency-Key header.","tags":["Servers"],"security":[{"bearerAuth":["servers:write"]}],"responses":{"200":{"description":"Success","content":{"application/json":{}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"}},"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"example":{"name":"pre-upgrade","description":"before kernel bump"}}}}}},"/servers/{id}/power/{action}":{"post":{"operationId":"postServersIdPowerAction","summary":"Power action","description":"Power the server start, stop, or reboot. `:action` ∈ {start,stop,reboot}.","tags":["Servers"],"security":[{"bearerAuth":["servers:write"]}],"responses":{"200":{"description":"Success","content":{"application/json":{}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"}},"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"name":"action","in":"path","required":true,"schema":{"type":"string"}}]}},"/servers/{id}/snapshots/{snapshotId}":{"delete":{"operationId":"deleteServersIdSnapshotsSnapshotId","summary":"Delete snapshot","description":"Remove a snapshot (non-destructive to the live disk).","tags":["Servers"],"security":[{"bearerAuth":["servers:write"]}],"responses":{"200":{"description":"Success","content":{"application/json":{}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"}},"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"name":"snapshotId","in":"path","required":true,"schema":{"type":"string"}}]}},"/servers/{id}/reinstall":{"post":{"operationId":"postServersIdReinstall","summary":"Reinstall OS","description":"DESTRUCTIVE — wipe the disk and rebuild from an OS template. Honours Idempotency-Key.","tags":["Servers"],"security":[{"bearerAuth":["servers:destroy"]}],"responses":{"200":{"description":"Success","content":{"application/json":{}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"}},"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"example":{"osTemplate":"ubuntu-22.04","os":"ubuntu"}}}}}},"/servers/{id}/snapshots/{snapshotId}/revert":{"post":{"operationId":"postServersIdSnapshotsSnapshotIdRevert","summary":"Revert snapshot","description":"DESTRUCTIVE — roll the live disk back to a snapshot.","tags":["Servers"],"security":[{"bearerAuth":["servers:destroy"]}],"responses":{"200":{"description":"Success","content":{"application/json":{}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"}},"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"name":"snapshotId","in":"path","required":true,"schema":{"type":"string"}}]}},"/hosting":{"get":{"operationId":"getHosting","summary":"List hosting","description":"List web-hosting accounts.","tags":["Hosting"],"security":[{"bearerAuth":["hosting:read"]}],"responses":{"200":{"description":"Success","content":{"application/json":{}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"}}}},"/hosting/{id}":{"get":{"operationId":"getHostingId","summary":"Get hosting","description":"Hosting account detail (connection info, backbone-scrubbed).","tags":["Hosting"],"security":[{"bearerAuth":["hosting:read"]}],"responses":{"200":{"description":"Success","content":{"application/json":{}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"}},"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}]}},"/hosting/{id}/custom-domain":{"put":{"operationId":"putHostingIdCustomDomain","summary":"Set custom domain","description":"Attach a custom domain to a hosting account.","tags":["Hosting"],"security":[{"bearerAuth":["hosting:write"]}],"responses":{"200":{"description":"Success","content":{"application/json":{}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"}},"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"example":{"domain":"example.com"}}}}},"delete":{"operationId":"deleteHostingIdCustomDomain","summary":"Remove custom domain","description":"Detach the custom domain from the hosting account.","tags":["Hosting"],"security":[{"bearerAuth":["hosting:write"]}],"responses":{"200":{"description":"Success","content":{"application/json":{}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"}},"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}]}},"/hosting/{id}/custom-domain/verify":{"post":{"operationId":"postHostingIdCustomDomainVerify","summary":"Verify custom domain","description":"Re-check DNS and attach the custom domain once it points to us.","tags":["Hosting"],"security":[{"bearerAuth":["hosting:write"]}],"responses":{"200":{"description":"Success","content":{"application/json":{}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"}},"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}]}},"/domains":{"get":{"operationId":"getDomains","summary":"List domains","description":"List registered domains.","tags":["Domains"],"security":[{"bearerAuth":["domains:read"]}],"responses":{"200":{"description":"Success","content":{"application/json":{}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"}}}},"/domains/{id}":{"get":{"operationId":"getDomainsId","summary":"Get domain","description":"Domain detail.","tags":["Domains"],"security":[{"bearerAuth":["domains:read"]}],"responses":{"200":{"description":"Success","content":{"application/json":{}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"}},"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}]},"patch":{"operationId":"patchDomainsId","summary":"Update domain","description":"Update auto-renew, transfer lock, WHOIS privacy, or nameservers.","tags":["Domains"],"security":[{"bearerAuth":["domains:write"]}],"responses":{"200":{"description":"Success","content":{"application/json":{}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"}},"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"example":{"auto_renew":true,"transfer_lock":true,"nameservers":["ns1.example.com","ns2.example.com"]}}}}}},"/billing/invoices":{"get":{"operationId":"getBillingInvoices","summary":"List invoices","description":"Paginated invoice list. Query: page, limit.","tags":["Billing"],"security":[{"bearerAuth":["billing:read"]}],"responses":{"200":{"description":"Success","content":{"application/json":{}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"}}}},"/billing/invoices/{id}":{"get":{"operationId":"getBillingInvoicesId","summary":"Get invoice","description":"Single invoice with line items.","tags":["Billing"],"security":[{"bearerAuth":["billing:read"]}],"responses":{"200":{"description":"Success","content":{"application/json":{}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"}},"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}]}},"/billing/wallet":{"get":{"operationId":"getBillingWallet","summary":"Get wallet","description":"Prepaid wallet balance and state.","tags":["Billing"],"security":[{"bearerAuth":["billing:read"]}],"responses":{"200":{"description":"Success","content":{"application/json":{}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"}}}},"/billing/wallet/transactions":{"get":{"operationId":"getBillingWalletTransactions","summary":"Wallet transactions","description":"Recent wallet transactions. Query: limit.","tags":["Billing"],"security":[{"bearerAuth":["billing:read"]}],"responses":{"200":{"description":"Success","content":{"application/json":{}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"}}}},"/tickets":{"get":{"operationId":"getTickets","summary":"List tickets","description":"List support tickets.","tags":["Support tickets"],"security":[{"bearerAuth":["tickets:read"]}],"responses":{"200":{"description":"Success","content":{"application/json":{}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"}}},"post":{"operationId":"postTickets","summary":"Open ticket","description":"Open a support ticket. Honours Idempotency-Key.","tags":["Support tickets"],"security":[{"bearerAuth":["tickets:write"]}],"responses":{"200":{"description":"Success","content":{"application/json":{}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"}},"requestBody":{"required":true,"content":{"application/json":{"example":{"subject":"Need help","message":"…","department":"technical","priority":"medium"}}}}}},"/tickets/{id}":{"get":{"operationId":"getTicketsId","summary":"Get ticket","description":"Ticket detail with the message thread.","tags":["Support tickets"],"security":[{"bearerAuth":["tickets:read"]}],"responses":{"200":{"description":"Success","content":{"application/json":{}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"}},"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}]}},"/tickets/{id}/reply":{"post":{"operationId":"postTicketsIdReply","summary":"Reply to ticket","description":"Post a customer reply on a ticket.","tags":["Support tickets"],"security":[{"bearerAuth":["tickets:write"]}],"responses":{"200":{"description":"Success","content":{"application/json":{}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"}},"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"example":{"body":"Thanks, that worked."}}}}}},"/tickets/{id}/close":{"post":{"operationId":"postTicketsIdClose","summary":"Close ticket","description":"Close the ticket.","tags":["Support tickets"],"security":[{"bearerAuth":["tickets:write"]}],"responses":{"200":{"description":"Success","content":{"application/json":{}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"}},"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}]}},"/webhooks":{"get":{"operationId":"getWebhooks","summary":"List webhooks","description":"List webhook subscriptions.","tags":["Webhooks"],"security":[{"bearerAuth":["webhooks:read"]}],"responses":{"200":{"description":"Success","content":{"application/json":{}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"}}},"post":{"operationId":"postWebhooks","summary":"Create webhook","description":"Subscribe a URL to events. Secret returned ONCE.","tags":["Webhooks"],"security":[{"bearerAuth":["webhooks:write"]}],"responses":{"200":{"description":"Success","content":{"application/json":{}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"}},"requestBody":{"required":true,"content":{"application/json":{"example":{"url":"https://example.com/hooks","events":["*"],"description":"prod"}}}}}},"/webhooks/{id}":{"get":{"operationId":"getWebhooksId","summary":"Get webhook","description":"Webhook subscription detail (secret masked).","tags":["Webhooks"],"security":[{"bearerAuth":["webhooks:read"]}],"responses":{"200":{"description":"Success","content":{"application/json":{}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"}},"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}]},"patch":{"operationId":"patchWebhooksId","summary":"Update webhook","description":"Change url, events, description, or pause/resume (isActive).","tags":["Webhooks"],"security":[{"bearerAuth":["webhooks:write"]}],"responses":{"200":{"description":"Success","content":{"application/json":{}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"}},"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}]},"delete":{"operationId":"deleteWebhooksId","summary":"Delete webhook","description":"Delete a subscription.","tags":["Webhooks"],"security":[{"bearerAuth":["webhooks:write"]}],"responses":{"200":{"description":"Success","content":{"application/json":{}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"}},"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}]}},"/webhooks/{id}/rotate-secret":{"post":{"operationId":"postWebhooksIdRotateSecret","summary":"Rotate secret","description":"Issue a fresh signing secret (returned ONCE). Old secret stops immediately.","tags":["Webhooks"],"security":[{"bearerAuth":["webhooks:write"]}],"responses":{"200":{"description":"Success","content":{"application/json":{}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"}},"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}]}},"/webhooks/{id}/deliveries":{"get":{"operationId":"getWebhooksIdDeliveries","summary":"Delivery log","description":"Recent delivery attempts. Query: limit.","tags":["Webhooks"],"security":[{"bearerAuth":["webhooks:read"]}],"responses":{"200":{"description":"Success","content":{"application/json":{}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"}},"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}]}},"/webhooks/{id}/deliveries/{deliveryId}/redeliver":{"post":{"operationId":"postWebhooksIdDeliveriesDeliveryIdRedeliver","summary":"Redeliver","description":"Re-queue a past delivery for another attempt.","tags":["Webhooks"],"security":[{"bearerAuth":["webhooks:write"]}],"responses":{"200":{"description":"Success","content":{"application/json":{}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"}},"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"name":"deliveryId","in":"path","required":true,"schema":{"type":"string"}}]}}}}