Automating X-Road administration with the management REST API

Teams running several X-Road Security Servers can script configuration changes through the management REST API instead of working through the admin UI each time. This page covers when that pays off, how API keys and roles limit what a script can do, and what to confirm before production use.

On this page

When scripting the X-Road management REST API pays off

Scripting the management REST API pays off when one team makes the same configuration change on several Security Servers or on the Central Server and must get the same result each time. The API lets the team script the steps that would otherwise be repeated by hand in the admin UI, and it beats the UI when a change must run identically across servers, be re-run after a partial failure, or be kept as a reviewable file. The UI remains the better choice for one-off inspection and for changes nobody has scripted yet. Before committing to scripts, confirm in the API reference for your installed release which operations exist on each server type, because coverage can differ between the Security Server and the Central Server.

The API keys and roles decide what a script can do, so give each key one job and scope it to the role that job needs. Confirm which roles your release lets an API key hold, and keep them aligned with the roles your team already separates in the admin UI, such as Security Officer, Registration Officer and System Administrator. Scripts also meet request limits and rate limiting, so build handling for throttled responses and retries into the script and do not assume every call succeeds. Attach a correlation ID to each request so one change run can be traced through the server logs. Finally, treat warning responses as results: log them, and stop the run or flag it for review when a warning points to a configuration problem.

Scripting does not replace human approval, role separation or reviewed change records. A change still needs an approver who is not the person who wrote the script or holds its API key, and the approval should reference the exact script version that ran. Keep the API key holder separate from the approver so that no single account can both request and sign off a change. Store each run's output, warnings and correlation IDs with the approved change ticket so auditors and your own security team can reconstruct what changed and when. DeployOpen builds these scripts and tests them against your Security Servers and Central Server inside your own infrastructure, so the first runs happen in an environment you control and the approval path is in place before production use.

Which access pattern fits each automation job

This table compares four ways to run Security Server and Central Server changes through the management REST API on repeatability, audit clarity and key exposure. Match each row to the change in front of you, since a one-off fix and a routine role change carry different risks. The main takeaway is that narrower keys and an approval gate before production writes cost speed but make each change easier to trace. Confirm which API keys and roles your installed version supports before you choose.

PatternWhen it fitsRepeatability and audit clarityKey exposure
Admin UI for one-off changesA single fix during an incident, or a change a named administrator must make by handLow repeatability. Steps depend on the operator, and the audit trail reflects the signed-in user. Confirm how your version records UI changes.No API key is created. Access depends on administrator logins protected by PAM or LDAP controls.
Scripted client with one narrow API keyRepeated reads, or a routine low-risk write that one role can perform on several serversHigh repeatability. Correlation IDs let you trace each call if the script logs them, so logging design matters.The key sits in a script or secret store. A leaked key carries its role's rights until it is revoked.
Pipeline that stages changes in a lab firstChanges that must be proven on a non-production instance before production, such as a configuration migration or new access rulesHigh repeatability. The pipeline can record the change set and the lab test result for each release.Two sets of keys to protect. Keep the production key away from any job that has not passed the lab stage.
Pipeline that waits for Security Officer approvalProduction writes that change trust, membership or access, where a Security Officer must sign off firstRepeatability holds for steps before approval, but manual sign-off sets the pace. Where approval is recorded separately, the trail is clearest.The pipeline holds a key that can write once approval is given, so the gate must sit outside the pipeline's own control.
Any pattern that uses a keyEvery automated job, whichever pattern you chooseConfirm which API keys and roles your installed version supports, and what each may write, before you design the job.Give each job its own key, record its owner, and revoke the key when the job changes or retires.

How a scripted change reaches a Security Server

The diagram starts on the automation host, either a CI runner or an admin workstation, which holds an API key and sends requests to the management REST API of a Security Server. The request crosses the trust boundary into the internal admin network, where the Security Server writes the change to its PostgreSQL database and records it in the audit trail. A human reviewer checks that trail as a gate on the change. Central Server configuration follows a separate path, so confirm in your version's API reference which calls cover each path, which API key roles they need, and whether they can be scripted at all before you design the pipeline.

Trust boundary, request path, data store and review step for one scripted change.

How API keys and the five X-Road roles limit a script

The Security Server defines five user roles: Security Officer, Registration Officer, Service Administrator, System Administrator and Security Server Observer. Each role covers a different part of administration, so the role a person holds decides what they can change. Admin users authenticate through PAM, so the local account and PAM configuration on the Security Server control who can sign in to the admin interface. If your identity source is LDAP, SSSD can carry those accounts onto the server, and LDAP groups can be mapped to X-Road roles. Access then follows group membership, so removing someone from a directory group also removes their administrative rights on the server.

An API key is a separate credential from any admin login. Its permitted actions must be checked against the five roles in the version you install, because the mapping between a key and a role determines whether a script can only read status, can change settings or can modify members and services. Confirm the exact role mapping for keys in the documentation for your installed release and on a test Security Server before you write any automation. Do not assume a key inherits every right of the role that created it.

Give each script only the privilege its job needs. A script that reports configuration status should not hold a key that can change services, access rights or members, and a script that onboards members should not share a key with a read-only job. Use one key per script so you can rotate or revoke one without disrupting the others, and record which role each key was verified against. Before the script runs in production, send it a request outside its intended scope on a test instance and confirm the Security Server refuses it. A refused request is the evidence that the limit works.

Setting up the management REST API for scripted changes

This sequence takes a team from a confirmed X-Road release line to a scripted change that has been tested in a lab, traced end to end and approved before it reaches production. Each step closes with a check you can record, so the production key and script go live only after the lab evidence exists.

  1. Confirm the release line and API reference

    Confirm which X-Road release line your Security Servers run before you write any code. The current release is 7.8.3, and 7.7.4 and 7.6.5 are also supported, so a fleet on an older line needs the reference for that line. Check the X-Road releases page, then open the API reference for the exact version and note the endpoints, request limits, rate limiting and warning responses it documents. Done when the team has a written version record that names the release, the reference location and the owner who approved it.

  2. Build a lab Security Server

    Build a lab Security Server that matches production as closely as your budget and infrastructure allow. Use a supported platform from the installation guide, either Ubuntu Server 22.04 or 24.04 LTS on x86-64, or Red Hat Enterprise Linux 8 or 9. Plan for at least 3 GB RAM (4 GB with monitoring add-ons) and 3 GB free disk, and provide PostgreSQL, either local or remote. Register the server in a test configuration your team controls, and confirm the registration steps in the version's installation documentation. Done when the admin UI loads on TCP 4000 from your internal network and the displayed version matches the release line you recorded.

  3. Create a dedicated API key

    Create one API key for the script, separate from any personal administrator account. Give it the narrowest role that covers the calls the script makes. Confirm in the version's documentation which roles an API key can hold and the exact key creation steps, since these can change between releases. Name the key for its purpose and owner, and do not share one key across scripts. Done when a test call made with the new key succeeds, and a call outside its role is refused, which shows the role is enforced.

  4. Store the key in a secrets manager

    Place the key in your secrets manager and have the script read it at run time. Keep it out of source control, shell history, job definitions and log output. Restrict read access to the service account that runs the script, and record who can read or rotate the key. Done when a search of the script repository and the CI logs finds no copy of the key, and the script runs successfully after pulling the key from the secrets manager.

  5. Run read-only calls and record responses

    Run the read-only calls the script depends on, starting with those that describe server and configuration state. Save each request and response, with timestamps and the release version, as a baseline in version control or your evidence store. Compare the responses against the API reference for that version, including any warning responses or rate limit signals, and note any behavior the reference does not explain. Done when a repeat run of the same calls returns responses that match the baseline, apart from expected fields such as timestamps.

  6. Run one traced write in the lab

    Make one small, reversible write in the lab, such as a single non-production configuration change that a second call can undo. Attach a correlation ID to the request using the header name the version's API reference gives, and confirm that name in the documentation rather than assuming it. Record the correlation ID alongside the request. Done when you can find the same correlation ID in the response, in the server logs and in the audit trail, and the change appears in server state as expected.

  7. Check the audit trail and logs

    Review the audit trail and system logs for the lab write, the refused call from the role test and the read-only calls. Confirm that each entry shows which key made the request, what it changed and when, and that no entry contains the key value. Check where the logs are kept and how long they are retained in your environment, and confirm both with the version's documentation and your logging team. Done when the team can reconstruct the lab write from the logs alone and has confirmed the key value appears nowhere in them.

  8. Promote to production through an approval gate

    Promote to production only after an approver reviews the lab evidence: the recorded release version, the role test, the read-only baseline, the traced write and the audit check. Issue a separate production key under the same role rules, store it in the production secrets manager, and assign a rotation owner. Run the read-only calls against production first, then the approved write with its own correlation ID. Done when the approver's sign-off is recorded in the change ticket and the first production write has its own trace in the logs.

Handling request limits, rate limiting and warning responses

The management REST API will reject, slow down or annotate some requests, and a script that treats every response the same will fail in quiet ways. The four cards cover the limits to confirm, how to retry safely, how to trace one change across the script, logs and server, and how to handle warnings. Confirm each point against the API reference for the X-Road version you run.

Request limits and payload size

The management REST API sets limits on how large a request body can be and how much a single call can carry. Before the script goes live, confirm the body size limit, any limits on list or batch sizes, and how long-running calls behave in the API reference for your exact X-Road version. Split bulk changes into batches that stay under those limits, such as many members or access rules at once. When the API rejects a payload, have the script stop with a clear message and never resend the same payload unchanged.

Rate limiting and retry backoff

Throttling tends to appear during bulk runs, and a script that retries immediately makes the problem worse. Confirm in the reference whether throttled responses are documented and whether they include a wait hint the script can read. Use exponential backoff with jitter, cap the number of attempts, and log every retry. Retry only calls that are safe to repeat: a create call retried after a timeout can produce a duplicate unless the script first checks whether the object already exists.

Correlation IDs for tracing changes

A single change often touches the script, the API, the Security Server logs and the audit trail, and matching those records is hard without a shared identifier. Confirm in the API reference whether requests can carry a correlation or request identifier and whether responses return one, and use the exact name the reference gives. Generate one identifier per change run, attach it to every call the script makes, and write it into the script's own log. When the API offers no identifier, record timestamps, endpoints and response details so entries can still be matched.

Warning responses that need review

Some successful responses carry warnings. The change went through, but a reviewer still needs to see the warning. Confirm in the reference how warnings appear for each endpoint, whether in the body, a header or a separate status, and which calls can produce them. The script should parse warnings on every call, write each one to its log with the change identifier, and place it in a review queue with a named owner. Warnings must never be silently skipped, and a successful status code alone does not prove the change was clean.

What changes for each team that touches the API

Security Server administrators own each member's gateway, including its installed packages, the keys and certificates it uses, the service descriptions and access rights it publishes, and the API keys their scripts use to change those settings. Scripts change their day-to-day work by turning manual UI steps into repeatable calls, so a change that once took a sequence of clicks becomes a reviewed file in version control. Their main job is to keep each scripted change inside the permissions its key was granted.

  • One key per job: Issue a separate API key for each task, such as a nightly sync of service descriptions, so that revoking one key stops one job and leaves the others running.
  • Role scope: Confirm each key carries only the role its job needs. A key for service administration should carry no system administrator rights.
  • Limits and warnings: Build scripts to read request limit and warning responses, and to back off and retry at a slower pace instead of retrying in a tight loop.
  • Correlation IDs: Attach a correlation ID to every request and store it in the job log, so a failed change can be traced to its audit entry.
  • Hardening baseline: Apply the account lock, password and SSH settings from the security hardening guidelines to the accounts the scripts run under.

Before the first scripted change runs in production, check that every key is recorded with its owner, role and purpose in the change record.

Security risks of scripting administration

Scripts that call the management REST API hold administrator reach, so their risks sit alongside the server's own. The four cards cover how keys are stored and rotated, how far each key reaches, where the admin interface can be reached from, and how the host itself is hardened. Each one is a separate control you can check on its own.

API key storage and rotation

An API key that can change Security Server configuration carries administrator reach, so store it with the same care as an administrator password. Keep keys out of script bodies and version control, and load them at runtime from a secrets store your team already audits. Set a rotation date when each key is created, and on that date issue a new key, update the script and revoke the old one. Rehearse rotation on a non-production Security Server so a changed key does not break a scheduled job mid-run. Confirm in the X-Road documentation how keys expire and whether revocation takes effect immediately.

Least-privilege keys per script

A single shared key gives every script the power of the most privileged job in the set. Issue one key per script and bind it to the narrowest role that script needs. The Security Server user guide defines five roles: Security Officer, Registration Officer, Service Administrator, System Administrator and Security Server Observer. Confirm which of them an API key can hold before you map jobs to roles. Reporting jobs should never hold a key that can change configuration. Review each key's role when a script changes scope or is retired.

Security Server user guide

Network reach to the admin interface

The admin UI listens on TCP 4000, and the installation guide lists that port as open to internal networks only. For scripts, narrow it further: run automation from a fixed management host or a small subnet, and allow TCP 4000 from that source alone in host and network firewalls. Avoid sharing one jump host across teams, and avoid placing the port behind a general-purpose load balancer. Confirm the address the service binds to on your Security Server, because a default that listens on every interface widens exposure beyond the internal segment you planned.

Security Server installation guide

Host hardening baseline

The X-Road security hardening guide, version 0.6 dated 09.01.2025, sets the host baseline: lock accounts for 15 minutes after 3 failed logins, use key-only SSH, and set the allowed-hostnames setting to guard against host header injection. Confirm whether API keys follow the same lockout behavior, because a lockout written for human logins may not cover failed key attempts from a script. Check each setting on the running host, since a guide that is followed on paper does not prove the server is configured that way. Record the results in your build documentation.

Minimum password length
16 characters
Security hardening guide

What teams ask before scripting X-Road administration

Can our own team script X-Road administration with the management REST API?

Yes, if your team already operates X-Road servers and can test changes outside production. Scripting the management REST API uses the same knowledge as running a Security Server: members, services, roles and the admin account model, plus the discipline of repeatable, version-controlled changes. Teams that have used only the admin UI should plan time to learn the request model and its limits before any script touches production. A partner typically helps with the design, the first scripts and the handover, after which your staff maintains them. Your own team should also own the approval step, since it decides which script runs are allowed. Confirm the API operations available in your release with the X-Road documentation before you design around them.

How does server count change the effort to script X-Road administration?

Server count is one of the main drivers, because each Security Server and Central Server you add multiplies the configuration to read, compare and change. Effort grows faster when servers differ in release, member configuration or network zone, since each group needs its own checks. Environments matter too: development, test and production each need the same scripts run and verified, and differences between them are where failures tend to hide. Ask for the server count, the environment list and the number of distinct configurations, then ask how design work is separated from per-environment testing. Recurring work also grows with the fleet, because each upgrade must be re-tested on every group. The written scope should name the servers and environments it covers.

How do approval flows and version differences affect scripted changes?

Approval flows and version differences add review steps and test cases, so they often set the schedule more than the script itself. If your change process needs a second person to approve each configuration change, the scripts should produce a reviewable plan showing what will change on which server before anything is applied. Version differences matter because the supported releases are 7.8.3, 7.7.4 and 7.6.5, according to the X-Road releases page, and a script written for one release may need adjustment or a separate test pass on another. Confirm which release each server runs, which releases you will support during the project and how change tickets map to script runs. Ask how dry-run output, approval gates and rollback steps will be handled and who signs off each stage.

What do we need to provide for X-Road scripting work?

Plan to provide a lab that mirrors your production setup as closely as practical, staff time from the people who own the approval process, and access to the servers and API credentials used in each environment. Lab access is needed for testing, because scripted changes should be proven on a copy of your servers before they reach production. Staff time covers workshops on your member and service model, reviews of each script and sign-off on test results. Change windows are needed for the first production runs and for any step that may require a service restart or an access rights change, so agree the calendar before the schedule is fixed. Ask the partner to list each dependency, the person who owns it and the date it must be available. Your security team should also confirm where API keys are stored and who can issue them.

Does X-Road 8 change how we should script administration?

Not for a production plan today, because X-Road 8 is still in testing and its production release is scheduled for December 2026. X-Road 8 "Spaceship" is available as 8.0.0 Beta 2, and the project positions it as a data space solution with improved monitoring and cloud compatibility. Scripts written now for the 7.x management API should be treated as release-specific, and automation should keep its configuration logic separate from the calls that apply it so it can be adapted later. Do not assume an API call or role model carries over unchanged. NIIS intends to maintain X-Road 7 with bug fixes and security patches beyond 2026, but the length of that period has not been decided, so confirm the support window before committing to a long program. The NIIS blog post on X-Road 7.8.0 explains the release context.

Does scripting the management API replace the admin UI and audit log?

No. Scripts call the management API, while the admin UI and the audit log remain the places where operators review and confirm what changed. Keeping the UI available is useful for troubleshooting, for emergency changes when scripts are unavailable and for reviewers who check state without running code. Confirm what the audit log records for API-driven changes, and whether each script run can be tied to a named person or a controlled service account. Access also needs design: the Security Server defines separate roles, including Security Officer and System Administrator, and admin users are authenticated through PAM, which can map LDAP groups to X-Road roles through SSSD. Settle role separation before automation starts, and ask your compliance team how script runs are logged, retained and presented as evidence.

What should a quote for X-Road scripting work include?

A quote should split the work into design, script development, lab testing, handover and recurring work, with the written scope for each phase. Design covers the configuration model, the role and key approach and the approval flow. Script development is the code that applies changes and produces a reviewable plan. Lab testing covers repeatable runs against copies of your servers, including failure and rollback cases. Handover covers documentation, a walkthrough with your staff and transfer of repositories and credentials. Recurring work is what you pay for at each X-Road upgrade, when scripts and tests are re-checked against the new release, and it can be covered by a retainer. DeployOpen does not publish a price list, and a quote follows from the written scope. Ask which phases are fixed scope, which costs are one-time and what each upgrade requires in staff time.

Limits to confirm before production use

Four limits shape how far you can rely on the management REST API before go-live. They cover the outlook for X-Road 7 maintenance, the state of X-Road 8, per-version rate limits and headers, and API coverage by component. Confirm each one against the exact version you deploy, because a script that passes on a test instance can still fail in production.

X-Road 7 has no new features

X-Road 7.8.0 is the last new-feature release of X-Road 7, released at the beginning of February 2026. NIIS intends to maintain the 7.x line with bug fixes and security patches beyond 2026, but it has not decided how long that maintenance will last. Scripts you build now will therefore run on a line that receives fixes but no new capabilities. Record the exact release your automation targets, and schedule a review that compares a 7.x patch path with an eventual X-Road 8 upgrade. Ask your NIIS or vendor contact whether any maintenance end date has been published since the release notes.

NIIS 7.8.0 announcement

X-Road 8 API may change

X-Road 8 is available as 8.0.0 Beta 2 for testing, and its production release is scheduled for December 2026. A beta is the right place to learn the management API, but API surfaces may change before production, including endpoint paths, payload fields and authentication details. Pin the beta version in your test environment, and build a test suite that calls every endpoint your scripts use. Rerun that suite on each new beta or release candidate. Because production is close, confirm which version ships and compare its changelog with the calls in your scripts before you schedule any cutover.

X-Road releases

Rate limits differ by version

Rate limit values and the names of the headers that report them are defined per version, so numbers from an older guide or a forum post may not match your build. Read the limits and header names from the API reference for the exact version you run, and store them in your automation configuration so they can change without a code edit. Your client should read limit headers, slow down on throttled responses and record the correlation ID of every rejected call. Test what a warning response looks like under a burst of calls from one API key before any scheduled change window.

Components may expose different APIs

The Security Server and the Central Server can differ in management API coverage, and that difference can persist within one release. A script that changes security server clients, members or global configuration will fail if it targets the wrong component or assumes both expose the same calls. For each component, list every call your automation makes, then confirm each one in that component's API reference for your version. Run the list against a test instance of each component before you rely on it, and record the result as part of your change evidence.

How DeployOpen scopes and delivers API automation

DeployOpen plans, implements, documents and supports self-hosted open-source platforms inside your own infrastructure, and API automation follows the same path. Most engagements are fixed-scope, and the written scope names the Security Server and Central Server tasks to automate, the API keys and roles involved, and where the scripts will run.

How we scope

  • Inventory the configuration tasks to automate on each server and mark which ones stay manual.
  • Map each script to a named API key and role, so every call has an owner and minimal permissions.
  • Agree in writing how request limits, rate limiting and warning responses will be handled before any script goes live.

How we build

  • Build scripts in version control with idempotent calls, so a rerun after a partial failure does not duplicate configuration.
  • Log a correlation ID for every API request, so each configuration change can be traced during an incident.
  • Treat warning responses as review items: stop on errors and record warnings for an operator to read.

How we hand over

  • Deliver the scripts, a runbook for each task, and the API key and role inventory.
  • Walk your operators through a test run on a non-production Security Server before any change touches production.
  • Document credential storage, rotation steps and the owner for each key, so your compliance team can review it.

How we support

  • Ongoing support, upgrades and continuous testing are available as a retainer for scripts that must follow X-Road release changes.
  • Re-test the scripts after each X-Road upgrade, since API keys, roles and warning behavior may differ between releases.
  • Keep the API key and role inventory current as operators join, leave or change responsibilities.

Sources and further reading

Talk to our team.

Tell us what you're working on, whether it's a deployment, an audit, a security test or a cyber range. You'll speak with an engineer who can help you scope it.

  • 30-minute call: free, with no obligation.
  • NDA on request: we can sign before you share details.
  • Clear next steps: a scope and plan after the call.