Verify a provider from Apiome
Pact verification normally runs inside the provider's own test suite, with a Pact library. With hosted verification, Apiome does it for you. One request selects the pacts the provider must honour, replays every interaction against a running copy of the provider, and publishes a verification result for each pact. The results show in the matrix and in can-i-deploy, exactly like results from a Pact verifier.
Use it when a provider has no Pact library, or when you want verification to run where the contracts live. If verification already runs in your own CI, send its report instead.
Before you start
- A consumer has published a pact with the provider.
- The provider runs somewhere Apiome can reach, and that deployment is registered as a
verification target. The target holds the base URL, the protocol, the credentials and the
policy: timeouts, retries, and whether mutating methods are allowed. Use an
httptarget for HTTP interactions, and agrpcorconnecttarget for gRPC calls (see gRPC and GraphQL pacts). See Contract testing and CI gates and the Contract assurance REST reference. - Your API key belongs to a member who holds Pacts → Create and Verification evidence → Create. Create one on API keys.
Run a verification from the app
Contracts → Verification opens Run a verification. Open it for one provider from
/ade/dashboard/pacts/verification/new?provider=<handle>. The same form gives you a hosted run, or
the command for a pipeline that Apiome cannot reach.


/ade/dashboard/pacts/verification/new- The provider under test. Choose the Provider, type the Version being verified
(results are recorded against it) and the Branch. Then choose who runs it:
- Apiome runs it. Choose the Target, the running copy of the provider that Apiome calls. Sign in with shows the credential the target names. With no target yet, choose Add a target… and give a name, the base URL, a workspace secret to sign in with, and This is production if it is one. A production target is created read-only. Adding a target needs Verification targets → Create.
- Your pipeline runs it. For a provider only your pipeline can reach. Set everything below, then copy the Pact verifier command from the right. It fetches the same pacts from Apiome and publishes its results back.
- Which pacts to verify. Each rule is a consumer-version selector written as a sentence, with the number of pacts it chooses. Recommended is each consumer's main branch, everything deployed or released, and the consumer branch named like the provider's. Everything adds each consumer's latest pact. Custom lets you remove rules and Add a rule by branch, tag, environment, consumer or latest. A pact two rules choose is verified once. Turn on Pending pacts cannot fail this run and Include work-in-progress pacts as you need (see Pending and WIP pacts).
- Getting the provider into the right state. Choose Apiome's state handlers (the registry; the line says how many states have a handler and names the missing ones), The provider's own setup endpoint, or No setup. Turn on Allow requests that change data only for a target that can take them. See Mutating interactions.
The preview on the right is the run's own selection, read before anything is sent: the pacts it will verify, their interactions, and those skipped because they already have a result for this exact version. When every pact is skipped, the page says so and offers Run anyway. Every reason the run would not start is listed there too.
More options holds the Build URL, the CI context, Publish the results (off is a dry run) and Skip pacts already verified for this version.
Select Run verification. The run starts at once and the run drawer opens beside the page: progress for each consumer, the failing interaction with what the pact expected beside what the provider returned, and the run's log. Closing the drawer does not stop the run. See Watch a run as it happens. Save as a schedule stores the provider's cadence and target, so scheduled runs keep its pacts verified.
Ran a verifier yourself? Upload results attaches its report to the pact it verified. See Upload a report in the app.
Run a verification with the REST API
Send a POST with the target and the provider version you are verifying:
curl -X POST \
"$APIOME/v1/tenants/acme/pact-verifier/pacts/provider/ledger-api/verify" \
-H "Authorization: Bearer $APIOME_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"target_ref": "ledger-staging",
"provider_version": "4f1e2d0",
"provider_branch": "main",
"build_url": "https://ci.example.com/builds/77",
"selection": {
"consumerVersionSelectors": [{ "mainBranch": true }, { "deployedOrReleased": true }],
"includePendingStatus": true
}
}'
| Field | Required | What it does |
|---|---|---|
target_ref | Yes | The slug or id of the verification target to replay against: http, grpc or connect. The response echoes its protocol under target. |
provider_version | Yes | The provider version being verified, usually the commit SHA. Results are recorded against it. |
provider_branch | No | The branch of that version. It is recorded on the version before a result is published, and used for matchingBranch selectors and pending pacts. |
build_url | No | The CI build, stored on each result. |
selection | No | Which pacts to verify. It is the body of for-verification, unchanged. Leave it out to get what a Pact verifier gets by default. |
verification | No | What the run may send. See Mutating interactions and Provider states. |
publish | No | true by default. false is a dry run: everything is replayed and reported, and nothing is published. |
skip_already_verified | No | false by default. true skips every pact that already has a result for provider_version. Each one is listed under skipped with pact-verify-already-verified. |
context | No | Non-secret CI details (commit, workflow URL) stored with the evidence. |
One run verifies at most 25 pacts. If your selectors choose more, the request is refused with
pact-verify-too-many-pacts. Add a consumer to each selector and run once per consumer.
Read the result
The answer is 200 for any run that happened, whatever it found. Read success and outcome:
{
"provider": "ledger-api",
"provider_version": "4f1e2d0",
"provider_branch": "main",
"success": false,
"outcome": "failed",
"pacts": [
{
"consumer": "billing-service",
"consumer_version": "2.4.0",
"pact_version_sha": "3f1c…",
"outcome": "failed",
"counts": { "interactions": 2, "passed": 1, "failed": 1, "skipped": 0, "errored": 0, "unsupported": 0 },
"interactions": [
{
"description": "a request for invoice 1042",
"operation": "GET /invoices/1042",
"outcome": "failed",
"code": "pact-body-mismatch",
"mismatches": [
{
"attribute": "body",
"field": "/lines/1/sku",
"rule": "regex",
"expected": "a value matching /^SKU-\\d+$/",
"actual": "\"bad\"",
"description": "$.lines[1].sku: expected a value matching /^SKU-\\d+$/, got string \"bad\" (rule: regex)"
}
]
}
],
"published": true,
"result": { "number": 3, "success": false, "url": "…/verification-results/3" },
"evidence_run_id": "0b6f…"
}
]
}
outcome | Meaning |
|---|---|
passed | Every pact that is not pending passed. success is true. |
failed | A pact that is not pending failed. |
incomplete | Nothing failed, but at least one pact could not be fully replayed. |
could-not-connect | No request reached the target: every one ended in a transport error or a timeout. connection_error says so, for example Could not connect to billing.staging.example (timeout). This is not a failed verification, and nothing is published. |
already-verified | With skip_already_verified, every selected pact already has a result for this version. success is true when those results passed. |
no-pacts | The selectors chose no pact. |
Exit your CI job on success. A pending or work-in-progress pact that
fails is reported and published as failed, but it does not turn success to false. A pact is
treated as pending only when you send "includePendingStatus": true, as with a Pact verifier.
Each mismatch names the interaction, the field (the header, or the JSON Pointer of the value in the response body), the rule that failed, and the expected and actual values.
What gets published
Each pact gets its own outcome:
| Pact outcome | When | Published |
|---|---|---|
passed | Every interaction was replayed and matched. | A successful verification result. |
failed | A replayed interaction did not match. | A failed verification result, with every mismatch. |
incomplete | Nothing failed, but an interaction was skipped, the target could not be reached, or the pact has an interaction Apiome cannot replay. | Nothing. not_published_reason is run-incomplete. |
An incomplete run publishes nothing because it proves nothing. A success that skipped an interaction would let can-i-deploy approve a deployment that was never checked.
Every pact's run is also stored as verification evidence, published or not. evidence_run_id
names the run, with each request's assertions. Read it with GET …/verification-runs/{run_id}
(see the Contract assurance REST reference).
A Pact 4 interaction the consumer marked pending is replayed and reported, but it never decides
the pact's outcome.
Each published result records how it came to be (trigger: hosted), how long the run took
(duration_ms) and its evidence run (evidence_run_id). They show on the provider's
Verification page, which can also Re-run one pact and Verify all
stale pacts with this verifier, from the app or with POST …/reverify and POST …/verify-stale.
How responses are matched
Apiome replays each request exactly as the consumer recorded it, then compares the response:
- Status. The recorded status, or the classes a Pact 4
statusCoderule allows. - Headers. Each recorded header must be present. Without a rule the value must be equal,
ignoring the spaces after commas.
Content-TypeandAcceptare compared as media types: the provider may add parameters such ascharset, and parameter values ignore case. Other response headers are ignored. - JSON body. The response may have extra fields but not fewer. Without a rule a value must be
equal, and an array must have the same length. The most specific rule wins, and a
typerule also applies to everything beneath it. - Empty body. A pact that records an empty body (
""ornull) accepts only an empty response body. A pact that records no body at all accepts any body. - Binary body. An image, a PDF or another binary body is judged by a
contentTyperule on$. Apiome reads the bytes the provider sends, not itsContent-Typeheader, so any JPEG matchesimage/jpeg. - Other bodies. Compared as text, or by a rule on the whole body (
$). XML is compared as text too.
Supported matching rules
Every matching rule of Pact specifications 2, 3 and 4 is applied. Rules combine with AND or
OR, as the pact says.
| Matcher | Pact | What the verifier checks |
|---|---|---|
equality | 2, 3, 4 | The value equals the example; stops a type cascade. |
type | 2, 3, 4 | The value has the example's JSON type; cascades to every value beneath it, and an array may have any length with every item like the first example item. |
minType | 2, 3, 4 | A type match, and an array has at least min items. |
maxType | 2, 3, 4 | A type match, and an array has at most max items. |
minMaxType | 3, 4 | A type match with both bounds. |
regex | 2, 3, 4 | The value, as text, matches the whole expression. |
include | 3, 4 | The value, as text, contains the string. |
number | 3, 4 | The value is a JSON number. |
integer | 3, 4 | The value is a number written without a decimal point (2, not 2.0). |
decimal | 3, 4 | The value is a number written with a decimal point (2.5, 2.0). |
boolean | 3, 4 | The value is true or false. |
null | 3, 4 | The value is null. |
date | 3, 4 | The value has the shape of the rule's Java date format (default yyyy-MM-dd). |
time | 3, 4 | Likewise for a time format (default HH:mm:ss). |
timestamp | 3, 4 | Likewise for a timestamp format (default yyyy-MM-dd'T'HH:mm:ss). |
datetime | 4 | The Pact 4 name of timestamp. |
values | 3, 4 | An object whose keys are free and whose values match the example values. |
eachKey | 4 | Every key of the object satisfies the nested rules. |
eachValue | 4 | Every value of the object satisfies the nested rules. |
arrayContains | 4 | For every variant, some item of the array matches it under its own rules. |
notEmpty | 4 | The value is not empty ("", [], {}, null) and has the example's type. |
semver | 4 | The value is a semantic version (1.2.3, 1.2.3-rc.1). |
contentType | 3, 4 | The content's type, detected from its bytes (magic number, then JSON / XML / text), is the one named. On $ it reads the whole body; a non-JSON body is then judged by it alone. |
statusCode | 4 | The status is in the named class (success, clientError …) or list of codes. |
A contentType rule recognises these types from their bytes: PNG, JPEG, GIF, WebP, BMP, TIFF,
ICO, AVIF, HEIC, PDF, ZIP, gzip, bzip2, 7-Zip, WebAssembly, WOFF, WOFF2, MP3, WAV, Ogg, FLAC,
MP4 and QuickTime. Bytes with no known signature are JSON, XML or plain text when they are UTF-8
text, and application/octet-stream otherwise. A type ending in +json or +xml matches JSON or
XML content, and any text/… type matches text.
Generators are ignored on verification. They tell a mock server or a consumer test how to fill a value in; the matching rules alone decide what the provider may return.
The engine is tested against every response case of the Pact specification test suite, versions 1 to 4, and agrees with all of them except XML cases that expect a match: because XML is compared as text, a reordered attribute or an extra element fails. It never passes an XML case the suite expects to fail.
Rules that cannot be applied
A rule Apiome cannot apply fails the interaction and names the rule. It never passes silently. This covers:
- a date format with a letter Apiome does not read;
- a regular expression that does not compile, or that runs longer than one second;
- a rule on a field of a body that is not JSON, including an element of an XML body;
- a
contentTyperule that names no type, or another rule on a binary body that is not text; - a matcher no Pact specification defines.
gRPC and GraphQL pacts
A pact can hold gRPC calls recorded by the Pact protobuf plugin, and GraphQL operations recorded as HTTP interactions. Both are replayed. See gRPC and GraphQL interactions for how each is compiled.
gRPC calls
A gRPC call is sent only to a grpc or connect verification target:
connect— Apiome posts the request as protobuf JSON to/{package.Service}/{Method}over HTTP, with the Connect protocol.grpc— Apiome opens a native gRPC channel. The server must have server reflection turned on, so Apiome can encode the request and decode the reply.
Apiome then compares the reply with what the consumer recorded:
- Status. The recorded
grpc-status, orokwhen none is recorded. - Message. For an
okreply, the message is compared with the recorded one under the pact's matching rules, exactly as a JSON body is. A mismatch names the field as a JSON Pointer into the message, such as/totalCents, and the rule.
Request metadata is not sent, and response metadata and grpc-message are not compared. The
compiled suite reports each one as a PACT_PLUGIN_PARTIAL finding. A streaming method cannot be
replayed and is listed under unsupported.
A gRPC call is mutating unless its method declares idempotency_level = NO_SIDE_EFFECTS. Any
other call needs the mutating opt-in.
GraphQL operations
A GraphQL operation is replayed on the recorded path, such as /graphql, on an http target.
Two things differ from a plain HTTP interaction:
- Mutating. A
queryis not mutating, although it is sent as aPOST. Amutationis, and needs the mutating opt-in. - Errors. A reply that carries an
errorsarray the consumer did not record fails withgraphql-errors-present, even whendatamatches. When the consumer recordederrors, the matching rules judge them.
One target per protocol
A target speaks one protocol, so a pact that mixes HTTP interactions and gRPC calls is replayed in
part on each target. What the target cannot speak is skipped with
pact-interaction-protocol-mismatch, and the pact is incomplete on that run, so nothing is
published. Verify such a pact on an http target and a grpc target in two runs, or ask the
consumer to split it.
Mutating interactions
By default a run sends only GET, HEAD and OPTIONS. An interaction with POST, PUT,
PATCH or DELETE is sent only when both of these are true:
- The verification target's policy allows mutating methods.
- The request sets
"verification": { "allow_mutating": true }.
A run cannot widen the target's policy. If the target forbids mutating methods, the interaction
is skipped with mutating-method-blocked whatever the request says, and the pact is incomplete.
Requests that change data are never sent to a production target. A run that sets
allow_mutating against a target whose environment is production is refused with
pact-verify-mutating-production before anything is sent, whatever the target's policy says. The
rule holds for every run: the app, apiome pact verify, a re-run, Verify all stale and
scheduled runs. Run read-only against production, or verify against a staging or test target.
To send something safer than the consumer recorded, add a fixture. It replaces the query, the headers or the body of the request, and never changes what is expected:
{
"verification": {
"allow_mutating": true,
"fixtures": [
{ "operation_key": "POST /invoices", "body": { "customer": "verification-sandbox", "total": 1 } }
]
}
}
Fixture headers may not carry credentials. Authentication always comes from the target.
Provider states
An interaction can assume a provider state, such as "invoice 1042 exists". Register the provider's states, with how each one is set up, in the provider-state registry. The run then sets each interaction's states up before it is replayed and tears them down after.
Before anything is sent, an interaction whose states cannot be set up is held back: a state that
is not registered, a required parameter the interaction leaves out, or a setup the target's policy
forbids. Check a provider's pacts for these with POST …/provider-states/check before you run
(see Check before a run). A provider that has
registered no state at all skips every interaction with a state, with provider-state-not-set-up.
If the provider has its own state endpoint, as a Pact verifier's --provider-states-setup-url
uses, set "verification": { "provider_states_setup_url": "/_pact/provider-states" }. Before each
interaction, every state is sent to it as POST with {"state", "params", "action": "setup"}, and
again with "action": "teardown" afterwards. The registry is not used. A path is joined onto the
target and sent with the target's credential. Because it is a POST, the target's policy must allow
mutating methods. An absolute http(s) URL is checked by the SSRF guard and gets no credential.
If your target already holds the data the pacts assume, set
"verification": { "replay_without_state_setup": true }. The interactions that could not be set
up are then replayed anyway, and each one is marked "states_set_up": false in the response and
in the published result.
A teardown that fails does not change the result. It is listed in the pact's
state_teardown_failures.
Why an interaction was not replayed
An interaction that is not replayed has outcome skipped or errored, a code and a message:
| Code | Meaning | What to do |
|---|---|---|
mutating-method-blocked | The method is mutating, and the target's policy or the run does not allow it. A GraphQL mutation and a gRPC call without NO_SIDE_EFFECTS count as mutating. | See Mutating interactions. |
pact-interaction-protocol-mismatch | A gRPC call on an http target, or an HTTP interaction on a grpc or connect target. | Run again against a target of the other protocol. See One target per protocol. |
provider-state-not-set-up | The interaction assumes a provider state, and the provider has registered none. | Register its states. |
provider-state-not-registered | The interaction names a state the provider has not registered. | Register the state, or ask the consumer to use a registered name. |
provider-state-param-missing | The interaction leaves out a parameter the state requires. | Give the parameter a default, or ask the consumer to add it. |
provider-state-setup-blocked | Setting the state up sends a mutating request to a target that forbids it. | Use a state-change URL off the target, or a target that allows it. |
provider-state-setup-failed | A setup call answered outside 2xx or could not be sent. The message names the state and the call. | Check the state-change endpoint or the fixture, then run again. |
pact-request-path-not-on-target | The recorded path names a scheme or a host, or does not start with /. It is never sent, because it would leave the target. | Fix the path in the consumer's test. |
transport-error, timeout | The target could not be reached or did not answer in time. | Check the target, then run again. |
Interactions Apiome cannot replay at all are listed under the pact's unsupported with a reason:
message interactions, plugins other than protobuf (such as CSV), streaming gRPC methods, gRPC calls
whose .proto definitions are missing from the pact, and GraphQL subscriptions. Asynchronous
messages are verified without running the provider, against its AsyncAPI document: see
Message pacts. Replaying synchronous messages that are not gRPC calls
against a message handler is not available yet.
What can stop a run
| Status | Code | Meaning |
|---|---|---|
400 | pact-selector-invalid | A selector in selection is malformed or ambiguous. |
400 | pacticipant-invalid-version, pacticipant-invalid-branch, pacticipant-invalid-url | The provider version, branch or build URL is malformed. |
404 | pacticipant-not-found | No such provider in this workspace. |
404 | target-not-found | No such verification target in this workspace. |
422 | target-disabled, target-protocol-mismatch | The target is disabled, or it is not an http, grpc or connect target (a graphql target, for example). |
422 | pact-verify-target-auth-unavailable | The target's credential could not be read. |
422 | pact-verify-too-many-pacts | The selectors chose more than 25 pacts. |
422 | pact-verify-mutating-production | allow_mutating against a target whose environment is production. |
Nothing is sent to the target when a run is stopped.
Preview a run
POST …/pact-verifier/pacts/provider/{provider}/verify/preview takes the same body. target_ref
and provider_version are optional. It says what the run would do, and sends nothing to any
target and stores nothing:
rules: how many pacts each selector chooses on its own.pacts: every pact the selection chooses. Each one lists its interactions, how many change data, how many would be held back, its newest result, and whether it isalready_verifiedfor this version.states: the provider states those interactions name, and how many the chosen way of setting them up can handle (missingnames the rest).target: its environment class, and whether it isproduction.refusals: every reason the run would not start, with the run's own code, such aspact-verify-mutating-production.
It needs Pacts → View, and a pact:read key is enough.
Who can do what
| Action | Needs | Viewer | Editor | Admin | Owner |
|---|---|---|---|---|---|
| Verify a provider from Apiome | pacts:create and verification_evidence:create | — | ✓ | ✓ | ✓ |
| Preview a run | pacts:view | ✓ | ✓ | ✓ | ✓ |
Related
- Compile a pact into a contract suite: the cases a run replays.
- Provider states: register the states a run sets up.
- Verification results and re-runs: read the results, re-run a pact, verify the stale ones.
- Choose pacts with selectors: what goes in
selection. - Publish verification results: how a result is stored and read, and
how to send a
pact_verifier_clior JUnit report from your own CI. - Pact Broker REST reference: the full request and response schema.