Skip to content

Create and deploy a virtual service

You need a PDC to deploy to: either a shared system PDC (always available, zero setup) or a self-hosted PDC you’ve connected with an Outpost agent. You can create a virtual service and define its transactions without a PDC, but you cannot deploy until you choose one.

  1. Open Virtual services in the left navigation, and click New virtual service.
  2. Give it a name and select or create the transaction group that becomes its home group (transactions you build on the fly land there by default; see Compose & transaction groups).
  3. Save. MaxoPerf creates the virtual service in a stopped, undeployed state. No workload runs yet, and it has no live endpoint.
Create a virtual service: name it and choose its home transaction group.
Terminal window
curl -X POST https://app.maxoperf.com/v1/virtual-services \
-H "Authorization: Bearer mpak_example_key" \
-H "X-Account-Id: acn-1234567890" \
-H "Content-Type: application/json" \
-d '{
"workspaceId": "ws_01J...",
"serviceId": "vssvc_01J...",
"name": "payments-sandbox-mock",
"placement": { "privateDatacenterId": "pdc-1163a00001" },
"noMatch": { "policy": "notFound" },
"idleShutdownMinutes": 30
}'

placement.privateDatacenterId is required. Every virtual service runs as its own pod on the private datacenter you pick, so a service created without a usable datacenter could never deploy. If you omit it, or name a datacenter your account cannot use, the API returns 400 VS_CONFIG_INCOMPLETE and creates nothing. List the ids you can use with GET /v1/private-datacenters.

The 201 response includes state:"draft", the placement you chose, and a reserved (not-yet-live) hostname/endpointUrl on the generated *.vs.maxoperf.com domain.

Open the virtual service’s Transactions tab to add the request/response pairs it should answer. Each transaction matches on method + path (with parameter placeholders) and returns a templated response: status code, headers, and a body built from the request or from data variables. See Compose & transaction groups for how transactions, groups, and composition fit together on a single virtual service.

Open the Deployment tab.

Deployment tab: status + Deploy/Stop, the grouped PDC placement selector, and the no-match fallback configuration.
  1. Under Configuration, open the Private datacenter selector. The selector groups PDCs into Shared (MaxoPerf) (the system catalog, no setup required) and Self-hosted (PDCs your workspace has connected). Pick one.

  2. Set the no-match policy. It decides what the virtual service does with a request that matches none of its transactions:

    PolicyBehavior
    404 Not Found (default)Returns a plain 404.
    Respond with a fixed statusReturns a status code and body template you choose.
    Proxy to a real originForwards the request to a real origin URL. Mock the transactions you care about and pass everything else through unchanged.
    Reject the connectionDrops the connection instead of returning an HTTP response.
  3. Save the configuration.

  4. Click Deploy. The virtual service moves to deploying while MaxoPerf provisions a dedicated runtime pod on the selected PDC and wires its route. This starts a real workload, so it takes a few moments the first time. When it is ready, the status changes to running and the endpoint at the top of the page goes live.

Terminal window
curl -X POST https://app.maxoperf.com/v1/virtual-services/<id>/deploy \
-H "Authorization: Bearer mpak_example_key" -H "X-Account-Id: acn-1234567890"
curl -X POST https://app.maxoperf.com/v1/virtual-services/<id>/stop \
-H "Authorization: Bearer mpak_example_key" -H "X-Account-Id: acn-1234567890"

Both return { "id": "...", "state": "running" | "stopped" } right away. The transition itself is asynchronous. Poll GET /v1/virtual-services/<id> (or watch the console) for the final running/stopped/error state.

Set Idle-shutdown (minutes) on the virtual service’s Settings tab. It is the number of minutes without traffic before MaxoPerf stops the workload and frees its PDC resources. The default is 30 minutes. Set it to 0 to turn idle-shutdown off, and the deployed virtual service runs with no time limit. There is no separate lifetime cap. A deployed virtual service runs until it goes idle, you stop it by hand, or you redeploy it later.

By default a virtual service is reachable at its generated *.vs.maxoperf.com hostname. To front it with your own domain:

  1. On the Deployment tab, upload a custom TLS certificate for your domain (MaxoPerf encrypts the private key at rest, and the API never returns it).
  2. Set Custom domain on the Settings tab to your hostname.

To clear the custom domain, set it back to empty. The virtual service falls back to its generated hostname.