Skip to main content

Goal

Automate VPS networking with an API token.

Prerequisites

  • An API token with access to the server.
  • The server id from GET /api/v1/compute/instances.

Workflow

1
Read the current state with GET /api/v1/compute/instances/{id}/edge.
2
Add forwards and domains with POST, change them with PATCH and remove them with DELETE.
3
Verify a domain with POST …/edge/domains/{domainId}/verify after adding its records.

Addresses and forwards

  • GET /api/v1/compute/instances/{id}/edge returns edge_hostname, public_ipv4, ipv6, ssh_port, forwards and domains.
  • POST /api/v1/compute/instances/{id}/edge/forwards with protocol (tcp or udp), internal_port and allowed_cidrs. The response includes the external_port StackShift picked.
  • PATCH …/edge/forwards/{forwardId} with allowed_cidrs, including the SSH forward. DELETE removes a custom forward; the SSH forward cannot be removed.
  • Instance responses also carry edge_hostname, ssh_port and node_public_ipv4.
Forward PostgreSQL on TCP

Domains

  • POST /api/v1/compute/instances/{id}/edge/domains with hostname, tls_mode (terminate or passthrough; passthrough when omitted), target_port (required for terminate) and proxy_protocol (passthrough only). Returns the domain and verification_name.
  • PATCH …/edge/domains/{domainId} changes tls_mode, target_port, proxy_protocol or allowed_cidrs. DELETE removes it; the platform names return 409.
  • POST …/edge/domains/{domainId}/verify checks the TXT record and, for a terminate wildcard, the CNAME in acme_cname_name and acme_cname_target.
  • Domain fields include verification_token, verified_at, certificate_status (pending, issued or failed), certificate_error and certificate_expires_at.
Add a domain with StackShift handling HTTPS

Dedicated IPv4 and mail

  • GET /api/v1/compute/instances/{id}/ipv4 returns the offer: availability, message, currency, monthly_minor, setup_minor, charge_now_minor and any existing add-on.
  • POST …/ipv4 with provider starts payment, or joins the waitlist when none is free. POST …/ipv4/checkout pays for an add-on that is ready. DELETE …/ipv4 cancels a request or removes the address.
  • Add-on status moves through waitlisted, offered, awaiting_payment, allocating, attaching and attached; detaching, released and cancelled end it.
  • At order time, POST /api/v1/compute/instances accepts dedicated_ipv4: true.
  • POST /api/v1/compute/instances/{id}/smtp-requests with reason sends a mail request; GET lists them. Without a dedicated IPv4 it returns 409.

Expected result

Your scripts manage the same routes the Networking tab shows.

Domains and HTTPS

Point your own domain at a VPS, prove it with a TXT record, and choose per domain whether StackShift handles HTTPS or forwards it untouched.

SSH and forwarded ports

Log in over the shared IPv4 on the server’s SSH port or over IPv6 on port 22, and forward up to 10 more TCP or UDP ports on the shared IPv4.

Dedicated IPv4 add-on

Attach an IPv4 address that only your VPS uses, for a fixed IP partners can allow-list, well-known ports on IPv4, or a mail server.