Export a contract
The Export page takes a contract out of Apiome in one of four ways:
- A pact from a project — a consumer's declared surface written as a Pact v4 file
(
apiome pact export-consumer-contract). - A Postman collection — a pact replayed as Postman requests with test scripts
(
apiome pact export-postman). - A pact file — any published pact exactly as it was stored, or every pact for a provider as a zip.
- Provider test scaffolding — a ready provider verification test in TypeScript, Java, Go or
Python, with a stub for every provider state the pacts use
(
apiome pact scaffold-provider-tests). See Provider test scaffolding.
Open it from a pact's page (Export, which opens on that pact's file), from a pacticipant's
page (Export, which opens on a Postman collection of its pacts) or from Export studio
(Export a contract). Its address is /ade/dashboard/pacts/export.
Export studio itself exports an API specification; see
Export to an API client for a collection made from a spec.
Pick one of the four cards at the top. Only that kind's form shows, with its own button and its own The same, from anywhere block: the command (and REST request) that does the same from a terminal or a pipeline, updated as you fill in the form. Problems and refusals appear on one line above the cards.


/ade/dashboard/pacts/exportA pact from a project
A consumer you declared with the picker on a project's Consumers tab has no pact file of its own. This kind writes one: one interaction per operation and response status the consumer reads, carrying only the fields it declared, with the specification's own examples as sample values.
- Choose the project and the consumer. A consumer whose contract was imported from a Pact file, or that has no contract revision yet, is greyed out with the reason — publish that Pact file instead.
- Optionally give a Revision (the current one otherwise) and the Provider name to write into the pact (otherwise the pacticipant bound to the project).
- Click "Derive pact". The operation checklist fills in.
Each row of the checklist is one declared operation and says where its examples came from:
| The column reads | What it means |
|---|---|
| The spec's example | Every value came from the specification's examples. |
| Generated from the schema — review | At least one value had no example and was invented from the schema (a typed placeholder). The number says how many. Review them before you rely on the pact. |
| Left out — reason | No interaction could be written, for example no response to assert on. The box cannot be ticked. |
Under the checklist, every finding is listed with its reason code (no-example,
status-default, media-type-not-json, …): nothing is dropped without saying so.
- Untick an operation to leave its interactions out of the preview and the download. The command cannot do this — it always writes every declared operation — so The same, from anywhere lists what you left out and why. To leave an operation out of the command too, change the consumer's declared surface.
- Click "Download pact" to save it as
<consumer>-<provider>.json. The preview shows the pact while it is small; a pact over about 200 KB downloads without a preview. - Click "Review and publish" to take it to the Publish page. With every operation ticked and the current revision, the page opens on Derive from a project with the project and consumer filled in, so the pact is published as derived. Otherwise the exact file you see is handed over on Paste. Either way nothing is published until you say whose version it is and click Publish pact. The button shows only with Pacts → Create.
Fail if anything needs review only changes the command: --fail-on-findings makes it exit 1
in CI when a value had to be invented or anything was left out.
A revision with nothing to export says This revision has no operations a pact can describe., with the findings that explain why.
A Postman collection
This kind writes a pact as a Postman Collection v2.1, so a provider team can run the consumer's requests in Postman — or in CI with Newman — before any Pact tooling is set up.
- Choose which pact under Which pact: The latest pact, Latest on a branch, Latest with a tag, A consumer version, A pact version (SHA), or Upload a pact file… for one you have not published (it is sent once to make the collection and is not stored).
- For a stored pact, type the Provider and Consumer (names or handles; the workspace's pacticipants are suggested). Tick All consumers — one folder each to export the latest pact of every consumer of the provider — or, with a branch or a tag, each consumer's latest such pact.
- Set the Provider base URL, or leave it empty to fill in the
{{baseUrl}}variable later (Newman:--env-var baseUrl=http://localhost:8080). Pointing it at a hosted mock is a safe way to try the collection. - Choose the switches:
- Include provider-state setup as pre-request scripts (on by default) — each request that
needs provider states first POSTs
{"state", "params", "action": "setup"}per state, in the pact's order, to the{{stateChangeUrl}}variable: the bodypact_verifier_cli --state-change-urlsends, so the state-change endpoint your verification already uses works unchanged. Fill in State change URL, or set the variable in Postman. If it is not set, or a setup answers an error, the request stops with an error naming the state instead of running against the wrong data. - Give each request a test script (on by default) — checks the status, the expected headers and the body by Pact's default rules.
- Fail if any interaction is left out — only changes the command (
--fail-on-left-out).
- Include provider-state setup as pre-request scripts (on by default) — each request that
needs provider states first POSTs
- Click "Export collection", then Download collection.
The Result card names the file (<consumer>-<provider>.postman.json, or
every-consumer-<provider>.postman.json) and shows What the collection keeps: a bar of how many
of the pact's interactions became requests. Below it, every notice is listed with its reason:
| Outcome | For |
|---|---|
left-out | Message interactions, gRPC calls, interactions without a method, request bodies that are not text — and, with All consumers, a consumer with no such pact. Postman sends HTTP requests with text bodies only. |
not-asserted | Response values governed by a matching rule, and response bodies that are not text. |
not-applied | Request generators: the request sends the pact's example values. |
info | The provider states the requests need. |
A pair without a pact reads Orders UI has not published a pact for Billing Service. Record one from a mock, or upload a file. A pact with no HTTP interaction at all is refused, with the notices that say why.
A pact file
- Type the Consumer and Provider, and choose Which pact (as for Postman, without an upload).
- Click "Download pact.json" to save the pact exactly as it was published: the broker's
_linksandcreatedAt, which a read through the Pact Broker API adds, are taken off. - Or click "Every pact for this provider (.zip)" for one file per consumer — its latest pact,
or its latest on the branch or with the tag — and a
README.txtnaming every consumer left out and why. A version or a SHA names one consumer's pact, so the zip takes the latest, a branch or a tag only. A zip holds at most 100 pacts; the README lists the rest.
No apiome pact command downloads a pact, so this kind's block shows the REST request: any HTTP
client fetches the same document with your API key.
Provider test scaffolding
A provider team adopting Pact otherwise starts from a blank file and has to find out which provider states its consumers rely on. This kind writes the starting point.
- Type the Provider (its name or handle).
- Choose the Language: TypeScript · pact-js, Java · pact-jvm, Go · pact-go or Python · pact-python.
- Click "Write tests".
Pacts says which pacts the test verifies: the recommended selectors — each consumer's main branch, and whatever is deployed or released — with pending pacts on, so a new consumer expectation does not break the provider's build until it has been verified once.
The file:
- reads the broker from
PACT_BROKER_BASE_URLandPACT_BROKER_TOKEN, and the provider's address fromPROVIDER_BASE_URL(defaulthttp://localhost:8080). No secret is written into it. - publishes results only when
CI=true, asGIT_COMMITonGIT_BRANCH. - has one state handler stub per provider state the pacts name, marked
TODO, and anEXAMPLE_PARAMETERStable with the parameters each state was sent with (one example value each). - marks each state not registered in Apiome with a comment: hosted verification cannot set it up until it is registered under the provider's provider states.
The states table lists each state with its parameters and In Apiome — Registered, or
No handler. The line under the file reads, for instance, 11 provider states · 2 have no
handler in Apiome. Click "Download" or "Copy"; the card names what to install (for
pact-js, npm install --save-dev @pact-foundation/pact). A file over about 200 KB downloads without
a preview.


/ade/dashboard/pacts/export?kind=tests| Language | Library | File |
|---|---|---|
| TypeScript | pact-js (Verifier, Jest or Vitest) | <provider>.pact.test.ts |
| Java | pact-jvm JUnit 5 (@Provider, @PactBroker, @State) | <Provider>PactTest.java |
| Go | pact-go v2 (provider.NewVerifier) | <provider>_pact_test.go |
| Python | pact-python 2 (Verifier.verify_with_broker) | test_<provider>_pact.py |
pact-python 2 sets states through a state-change URL, so its file also has handle_state_change:
mount it at PROVIDER_BASE_URL + /_pact/provider_states in a test build of the provider.
A provider with no pact yet still gets a file, with no handlers and a note saying so. More than 200 states, or a state name over 500 characters, is left out of the file with the reason listed.
Fail if a state has no handler in Apiome only changes the command: --fail-on-unregistered
exits 1 when a state is not registered.
From the command line
Every flag of the three commands has a control on the page:
apiome pact export-consumer-contract --project billing-api --consumer orders-ui \
--revision 4 --output pact.json --fail-on-findings
apiome pact export-postman --provider "Billing Service" --all-consumers --branch main \
--provider-base-url http://localhost:8080 \
--state-setup --state-change-url http://localhost:8080/_pact/provider_states \
--output collection.json --fail-on-left-out
apiome pact scaffold-provider-tests --provider "Billing Service" --language typescript \
--output billing-service.pact.test.ts --fail-on-unregistered
--all-consumers takes --provider and at most one of --tag or --branch. --state-change-url
needs --state-setup. See Export a pact as a Postman collection
and the CLI reference.
Who can do what
| Action | Needs | Viewer | Editor | Admin | Owner |
|---|---|---|---|---|---|
| Derive a pact from a project | consumer_contracts:view and pacts:view | ✓ | ✓ | ✓ | ✓ |
| Export a Postman collection, download a pact file or a zip | pacts:view | ✓ | ✓ | ✓ | ✓ |
| Write provider tests | pacts:view | ✓ | ✓ | ✓ | ✓ |
| Review and publish | pacts:create | — | ✓ | ✓ | ✓ |
Every read is scoped to your workspace: a pact, project or pacticipant of another workspace is not found.