Skip to main content
Support
0
Contact us
Nederlands
Deutsch
Español
Dedicated serversFlexible VPSCloud TechnologyColocationChallenges in ITSectorsCareers
Cloud Compute

With Cloud Compute, you have access anytime and anywhere to a portal through which you can configure your entire IT environment from wherever you are in the world.

Cloud Storage

Reliable access to your files, infrastructure, and applications at all times – with no interruptions or delays. At Worldstream, we offer a variety of storage solutions.

Flexible cloud icon
Flexible cloud
Private cloud icon
Private cloud
Bare metal icon
Bare Metal Compute
Hollow cube icon
Object storage
Hollow cube icon
File storage
Block storage icon
Block storage
Backup storage icon
Backup storage
Need support?

With experienced engineers and an average response time track record on 7 minutes, you can expect a solid technical support solution in next to no time.

All Servers

Choose your Dedicated Server now. Custom or Instant Delivery. Powerhouse servers built for your use case.

Use Cases

Whatever your use case, we’re here to help you find the ideal solution.

Deal servers icon
Deals
AMD servers icon
AMD Processors
AI servers icon
Intel Processors
Hollow cube icon
Virtualisation, Containerisation and Orchestration
Hollow cube icon
Websites and Applications
Hollow cube icon
Gaming and Streaming Infrastructure

24/7/365 support with an average response time of just 7 minutes. Thanks to our own data centers, our engineers can go directly to your server for fast, hands-on assistance. Email or call us anytime.

Smart outsourcing

Some IT creates added value, while other types are supportive. Use that as a starting point for outsourcing.

Cost Efficiency

Complete IT packages may seem like the safe option, but when you consider the costs, other choices often make more sense.

IT flexibility & control

Outsourcing doesn’t mean losing control; it actually provides more flexibility and control.

Cloud repatriation

The cloud is not a final destination: You should continuously evaluate and adjust your cloud environment as needs evolve.

Financial services
Logistics & Transportation
Retail & E-commerce
Media & Entertainment
Tech & Software Development
Security
Managed Service Providers
Need support?

With experienced engineers and an average response time track record on 7 minutes, you can expect a solid technical support solution in next to no time.

Chat with usContact us
About WorldstreamAbout the technologyCasesKnowledge base
About usMeet the teamJobsBecome a resellerCertificationsOur data centersOur networkDDoS ProtectionAMD EPYC serversTechnology PartnersOperating SystemsAll casesEasyTerraDutch Drone CompanyPerfGridArticlesFAQNews and BlogsProducts and Services
Contact us

Call +31 (0) 174 – 712 117

Industriestraat 53, Naaldwijk

Nederlands
Deutsch
Español
0
Dedicated serversFlexible VPSCloud TechnologyColocationChallenges in ITSectorsCareersAbout WorldstreamAbout the technologyCasesKnowledge baseMy Worldstream
Contact
Support
NederlandsDeutschEspañol
  1. HomeHome
  2. Knowledge Base
  3. API & Automation
  4. Common API automation recipes

Common API automation recipes

Applies to All productsAudience Developers, operatorsLast reviewed September 2026

Quick answer

Four patterns cover most day-to-day API automation: polling status on a schedule, rotating an API key before it expires, sending a Slack alert through a webhook, and forwarding webhook events into your own systems. All of them authenticate the same way, with an X-API-Key header, and all of them need to respect the API's rate limit of 200 requests per minute per IP address.

On this page
  • 1. Check server status on a schedule
  • 2. Rotate an API key before it expires
  • 3. Send a Slack alert when an event fires
  • 4. Forward webhook events into your own monitoring or ticketing system

The API returns HTTP 429 with a Retry-After header once you go over 200 requests per minute per IP. Any script that polls on a schedule, like the one below, should check for a 429 and back off for the duration in that header rather than retrying immediately.

1. Check server status on a schedule

A cron job that polls an endpoint and reacts to the result is the simplest form of automation, and often the first thing teams set up. This example checks a server's status every five minutes and writes a line to a log file if it isn't running.

# crontab -e
*/5 * * * * /usr/local/bin/check-server-status.sh >> /var/log/server-status.log 2>&1
#!/usr/bin/env bash
# check-server-status.sh
# Illustrative pattern only, take the exact endpoint path from Portal's API reference.
set -euo pipefail

API_KEY="<your-api-key>"
SERVER_ID="<server-id>"
STATUS_URL="https://api.worldstream.com/<family>/v1/<command>/$SERVER_ID"

status=$(curl -s -H "X-API-Key: $API_KEY" \
  "$STATUS_URL" | jq -r '.status')

echo "$(date -u +%FT%TZ) server=$SERVER_ID status=$status"

if [ "$status" != "running" ]; then
  echo "WARNING: $SERVER_ID is not running (status: $status)"
fi

Keep the API key out of the script itself. Read it from an environment variable or a secrets manager, and give the key only the permissions it needs, read-only status access rather than a full-access key, if your key permissions support that level of granularity.

2. Rotate an API key before it expires

Keys are created under Developers → API → Keys in Portal with a Key Name, an Expires In value (30 days, 90 days, 180 days, or 1 year), and a Permissions level (Full access, Read only, or Custom). Once that expiry date passes, the key stops working. Rather than waiting for a script to fail in production, generate the replacement key ahead of time and swap it over in your secrets store.

If your account has the API IP allowlist set to Enforce, make sure the host creating the new key is on the allowlist first, otherwise the request that creates it will be denied. Check Recent API key denials on the Keys tab if a rotation script starts failing with a 403.

#!/usr/bin/env bash
# rotate-api-key.sh
# Illustrative pattern only, check the current endpoint in Portal's API reference.
set -euo pipefail

OLD_KEY="<current-api-key>"

new_key_response=$(curl -s -X POST \
  -H "X-API-Key: $OLD_KEY" \
  -H "Content-Type: application/json" \
  -d '<request body, see the API reference in Portal>' \
  "https://api.worldstream.com/<family>/v1/<command>")

new_key=$(echo "$new_key_response" | jq -r '.secret')

# Store the new key in your secrets manager here, then update
# whatever reads it (CI variables, a systemd EnvironmentFile, etc.)
echo "New key created, store it now: $new_key"

# Only revoke the old key once every consumer has been switched over.

Treat key rotation as a two-step process: create and roll out the new key first, confirm everything that depends on it still works, then revoke the old one. Revoking the old key before the new one is in place everywhere will break anything still using it.

3. Send a Slack alert when an event fires

This one doesn't use the API directly, it uses Webhooks, a separate feature under Developers → Webhooks in Portal. Add a webhook there with a Slack-compatible destination URL and set its format to Slack, then narrow it down with the optional, comma-separated Topics field (leave it empty to receive every event type). Take the topic names from the Webhooks page in Portal. Worldstream posts to the URL when the event happens, you don't need to poll for it.

1

Create the webhook

In Portal, go to Developers → Webhooks and select Add webhook. Give it a name, paste in your Slack incoming webhook URL (it must be HTTPS), and set the format to Slack so the payload matches what Slack expects.

2

Send a test event

Use the Test action on the webhook's row to confirm it reaches Slack before relying on it.

3

Keep the signing secret

The signing secret is shown once when the webhook is created. Store it if your receiving side needs to verify that a payload genuinely came from Worldstream, rather than relying on the destination URL being HTTPS alone.

Only enable topics you actually want to act on. A webhook that fires on every event type tends to get muted or ignored, which defeats the point of using one.

4. Forward webhook events into your own monitoring or ticketing system

If Slack isn't where your team tracks things, set the webhook's format to Generic JSON instead and point it at an endpoint you control, such as a small receiver that forwards events into your monitoring stack, ticketing system, or internal chat tool.

# Illustrative receiver, adapt the framework and payload
# handling to whatever your monitoring/ticketing system expects.
# The event_type value below ("resource.event") is a placeholder.
# Use the real topic and event names shown on the Webhooks page in Portal.
from flask import Flask, request

app = Flask(__name__)

@app.route("/webhooks/worldstream", methods=["POST"])
def worldstream_webhook():
    payload = request.get_json()
    event_type = payload.get("event")

    if event_type == "resource.event":
        # forward into your own system here
        pass

    return "", 204

Verify incoming requests against the signing secret before acting on them, so a request that merely knows your endpoint URL can't trigger anything on its own. Take the exact verification method (which header carries the signature, and how it is computed) from the Webhooks documentation in Portal.

Related articles

  • Using the Worldstream API
  • Object Storage: CLI and SDK reference
  • API & Automation overview
Was this article helpful?

Solid IT. No Surprises

Sparring partner for IT maturity
Eliminating barriers so you can run
Predictable and transparant costs

Contact

  • Industriestraat 53, Naaldwijk
  • Payment Methods
  • Abuse
  • Developers Resources
  • Network Operations Center
  • About us
  • Meet the team
  • Jobs
  • Become a reseller
  • Certifications
  • Our data centers
  • Our network
  • DDoS Protection
  • AMD EPYC servers
  • Technology Partners
  • Operating Systems
  • Overview
  • FAQ
  • Cases
  • News & Blogs
  • Use Cases
Nederlands
Deutsch
Español
Nederlands
Deutsch
Español
  • Legal
  • Disclosure