Skip to main content

Consumer contracts

Generated from apiome-rest/openapi.yaml (API version 1.719.0) — do not edit by hand. How to authenticate is on the REST API reference.

Tag: consumer-contracts · 20 operations

POST /v1/tenants/{tenant_slug}/projects/{project_ref}/consumer-pact-imports​

Import a Pact file into a consumer contract

Import a Pact document (specification 1.x-4.x). Each interaction's method and path is resolved onto the project's path template — /pets/42 becomes /pets/{petId} — and the keys of its example request and response bodies become the fields the consumer declares, resolved against that operation's schemas at the interaction's own status code. Query parameters are declared as parameter usage.

Nothing is dropped. An interaction naming a retired endpoint, a status the specification does not declare, or a field that has been removed comes back in unresolved with a stable reason code and is stored on the revision. An import whose interactions all fail to resolve stores a visibly empty surface rather than succeeding quietly.

matchingRules, providerStates, and generators are deliberately not read: they say how a value is compared, not which fields are used.

The consumer is registered if it does not exist, under the handle in consumer_slug or one derived from the document's own consumer.name — so a CI job uploading a pact for a new service succeeds on its first run.

Requires consumer_contracts:create.

Operation id: import_pact_contract_v1_tenants__tenant_slug__projects__project_ref__consumer_pact_imports_post

Parameters

NameInTypeRequiredDescription
tenant_slugpathstringyesURL-safe tenant slug that scopes the request.
project_refpathstringyesPath parameter identifying the project ref segment.
authorizationheaderstring or nullnoJWT bearer token for authenticated access (Authorization: Bearer <token>).
X-API-Keyheaderstring or nullnoTenant-scoped API key used as an alternative to JWT bearer authentication.

Request body (required)

Request body for import a pact file into a consumer contract.

Responses

StatusDescriptionBody
201Successful response for import a pact file into a consumer contract.application/json ContractResponse
422Validation Errorapplication/json HTTPValidationError

GET /v1/tenants/{tenant_slug}/projects/{project_ref}/consumer-suggestions​

List suggested consumers

Clients seen in this project's usage traffic that no binding attributes to a consumer — by the product token of their user agent (checkout-web), or by the hashed consumer_hint the edge sent. Busiest first; a client a live binding already recognises is left out. A hashed client is shown by an opaque id, never by its value or its hash.

Requires consumer_contracts:view.

Operation id: list_consumer_suggestions_v1_tenants__tenant_slug__projects__project_ref__consumer_suggestions_get

Parameters

NameInTypeRequiredDescription
tenant_slugpathstringyesURL-safe tenant slug that scopes the request.
project_refpathstringyesPath parameter identifying the project ref segment.
daysqueryintegernoWindow in UTC days.
limitqueryintegernoMost to return.
authorizationheaderstring or nullnoJWT bearer token for authenticated access (Authorization: Bearer <token>).
X-API-Keyheaderstring or nullnoTenant-scoped API key used as an alternative to JWT bearer authentication.

Responses

StatusDescriptionBody
200Successful response for list suggested consumers.application/json SuggestionListResponse
422Validation Errorapplication/json HTTPValidationError

POST /v1/tenants/{tenant_slug}/projects/{project_ref}/consumer-suggestions/{suggestion_id}/register​

Register a suggested consumer

Register the client as a consumer (or, with consumer, bind it to an existing one) and create the binding that recognises it: the glob <token>/* for a user agent, or a hashed binding holding the value's hash the edge already sent — so no value is typed. A hashed client needs binding_name, the header or claim its value arrives in. From the next ingested batch on, its calls are attributed and its runtime edges appear in the graph.

Requires consumer_contracts:create.

Operation id: register_consumer_suggestion_v1_tenants__tenant_slug__projects__project_ref__consumer_suggestions__suggestion_id__register_post

Parameters

NameInTypeRequiredDescription
tenant_slugpathstringyesURL-safe tenant slug that scopes the request.
project_refpathstringyesPath parameter identifying the project ref segment.
suggestion_idpathstringyesPath parameter identifying the suggestion id segment.
authorizationheaderstring or nullnoJWT bearer token for authenticated access (Authorization: Bearer <token>).
X-API-Keyheaderstring or nullnoTenant-scoped API key used as an alternative to JWT bearer authentication.

Request body (required)

Request body for register a suggested consumer.

Responses

StatusDescriptionBody
201Successful response for register a suggested consumer.application/json RegisteredSuggestion
404consumer-suggestion-not-found, or an unknown project or consumer.—
409consumer-slug-taken, consumer-slug-reserved or consumer-binding-exists.—
422Validation Errorapplication/json HTTPValidationError

GET /v1/tenants/{tenant_slug}/projects/{project_ref}/consumer-surface​

List the operations and fields a consumer could declare

Every operation of a stored version, with the request, response, and parameter fields a consumer can declare against it. This is the catalogue the UI picker draws.

Field enumeration is bounded — recursive schemas terminate and very wide operations are cut short — and an operation whose list was cut says so with truncated: true. A field the catalogue omitted can still be declared by naming it explicitly.

Requires consumer_contracts:view.

Operation id: read_available_surface_v1_tenants__tenant_slug__projects__project_ref__consumer_surface_get

Parameters

NameInTypeRequiredDescription
tenant_slugpathstringyesURL-safe tenant slug that scopes the request.
project_refpathstringyesPath parameter identifying the project ref segment.
versionquerystring or nullnoVersion label, revision id, or latest. Defaults to the latest revision.
authorizationheaderstring or nullnoJWT bearer token for authenticated access (Authorization: Bearer <token>).
X-API-Keyheaderstring or nullnoTenant-scoped API key used as an alternative to JWT bearer authentication.

Responses

StatusDescriptionBody
200Successful response for list the operations and fields a consumer could declare.application/json AvailableSurfaceResponse
422Validation Errorapplication/json HTTPValidationError

GET /v1/tenants/{tenant_slug}/projects/{project_ref}/consumer-usage​

Count the consumers using each operation, field and schema of a version

The registry's current contracts, projected onto one stored version's pointers: how many consumers declared each operation and field, and how many reach each component schema through those fields. This is what an authoring overlay draws next to the contract (DCW-0.5).

Only contracts resolved against this version are projected; consumers whose current contract names another version are counted in other_version_consumer_count, and consumers with no contract yet in undeclared_consumer_count.

Requires projects:view. Consumer names are included only for a caller holding consumer_contracts:view — anyone else gets the same counts with consumers: null and consumers_visible: false.

Operation id: read_consumer_usage_v1_tenants__tenant_slug__projects__project_ref__consumer_usage_get

Parameters

NameInTypeRequiredDescription
tenant_slugpathstringyesURL-safe tenant slug that scopes the request.
project_refpathstringyesPath parameter identifying the project ref segment.
versionquerystring or nullnoVersion label, revision id, or latest. Defaults to the latest revision.
authorizationheaderstring or nullnoJWT bearer token for authenticated access (Authorization: Bearer <token>).
X-API-Keyheaderstring or nullnoTenant-scoped API key used as an alternative to JWT bearer authentication.

Responses

StatusDescriptionBody
200Successful response for count the consumers using each operation, field and schema of a version.application/json ConsumerUsageResponse
422Validation Errorapplication/json HTTPValidationError

GET /v1/tenants/{tenant_slug}/projects/{project_ref}/consumers​

List a project's consumers

Every live consumer of the project, newest first, each with its current contract revision — the operations and fields it declares it uses, plus how many interactions could not be resolved.

A consumer that has never declared a contract is still listed, with contract: null. That is the state a newly registered consumer is in, and hiding it would make the registration look like it failed.

Each row's runtime counts its declared-and-used, declared-unused and used-undeclared operations over runtime_days, from the traffic its bindings attribute.

At most 1,000 a page: pass the previous page's next_cursor as cursor until has_more is false.

Requires consumer_contracts:view.

Operation id: list_project_consumers_v1_tenants__tenant_slug__projects__project_ref__consumers_get

Parameters

NameInTypeRequiredDescription
tenant_slugpathstringyesURL-safe tenant slug that scopes the request.
project_refpathstringyesPath parameter identifying the project ref segment.
teamquerystring or nullnoOnly consumers whose owner (confirmed, else suggested) is this team slug (CDG-2.4).
runtime_daysqueryintegernoWindow, in UTC days ending today, of each row's runtime counts (RDG-1.8).
limitqueryintegernoPage size. At most 1000.
cursorquerystring or nullnoOpaque cursor from the previous page (next_cursor, or the X-Next-Cursor header). Omit for the first page.
authorizationheaderstring or nullnoJWT bearer token for authenticated access (Authorization: Bearer <token>).
X-API-Keyheaderstring or nullnoTenant-scoped API key used as an alternative to JWT bearer authentication.

Responses

StatusDescriptionBody
200Successful response for list a project's consumers.application/json ConsumerListResponse
422Validation Errorapplication/json HTTPValidationError

POST /v1/tenants/{tenant_slug}/projects/{project_ref}/consumers​

Register a consumer

Register a named client of this project. The handle (slug) is what CI and Pact files name; it is derived from name when omitted, and is not editable afterwards — renaming it would orphan every reference to it.

Registering a consumer declares nothing on its own. The surface it uses arrives separately, either by importing a Pact file or by declaring a picked selection.

Requires consumer_contracts:create.

Operation id: register_consumer_v1_tenants__tenant_slug__projects__project_ref__consumers_post

Parameters

NameInTypeRequiredDescription
tenant_slugpathstringyesURL-safe tenant slug that scopes the request.
project_refpathstringyesPath parameter identifying the project ref segment.
authorizationheaderstring or nullnoJWT bearer token for authenticated access (Authorization: Bearer <token>).
X-API-Keyheaderstring or nullnoTenant-scoped API key used as an alternative to JWT bearer authentication.

Request body (required)

Request body for register a consumer.

Responses

StatusDescriptionBody
201Successful response for register a consumer.application/json ConsumerRecord
422Validation Errorapplication/json HTTPValidationError

GET /v1/tenants/{tenant_slug}/projects/{project_ref}/consumers/{consumer_ref}​

Read one consumer and its current contract

Read a consumer by its handle or its id, together with the full surface of its current contract revision.

Requires consumer_contracts:view.

Operation id: read_consumer_v1_tenants__tenant_slug__projects__project_ref__consumers__consumer_ref__get

Parameters

NameInTypeRequiredDescription
tenant_slugpathstringyesURL-safe tenant slug that scopes the request.
project_refpathstringyesPath parameter identifying the project ref segment.
consumer_refpathstringyesPath parameter identifying the consumer ref segment.
authorizationheaderstring or nullnoJWT bearer token for authenticated access (Authorization: Bearer <token>).
X-API-Keyheaderstring or nullnoTenant-scoped API key used as an alternative to JWT bearer authentication.

Responses

StatusDescriptionBody
200Successful response for read one consumer and its current contract.application/json ConsumerDetailResponse
422Validation Errorapplication/json HTTPValidationError

PATCH /v1/tenants/{tenant_slug}/projects/{project_ref}/consumers/{consumer_ref}​

Update a consumer

Apply a partial update to a consumer's identity — its name, description, owner, contact, or metadata. Omitted fields are left alone.

The handle is not updatable. It is the name CI and Pact files use, and changing it would silently orphan every reference to it; retire the consumer and register a new one instead.

Requires consumer_contracts:edit.

Operation id: patch_consumer_v1_tenants__tenant_slug__projects__project_ref__consumers__consumer_ref__patch

Parameters

NameInTypeRequiredDescription
tenant_slugpathstringyesURL-safe tenant slug that scopes the request.
project_refpathstringyesPath parameter identifying the project ref segment.
consumer_refpathstringyesPath parameter identifying the consumer ref segment.
authorizationheaderstring or nullnoJWT bearer token for authenticated access (Authorization: Bearer <token>).
X-API-Keyheaderstring or nullnoTenant-scoped API key used as an alternative to JWT bearer authentication.

Request body (required)

Request body for update a consumer.

Responses

StatusDescriptionBody
200Successful response for update a consumer.application/json ConsumerRecord
422Validation Errorapplication/json HTTPValidationError

DELETE /v1/tenants/{tenant_slug}/projects/{project_ref}/consumers/{consumer_ref}​

Retire a consumer

Retire a consumer. Its contract revisions are kept: a published version's per-consumer verdict has to stay explicable after the consumer is decommissioned, and the handle becomes available again for a new registration.

Requires consumer_contracts:delete, which the built-in grids give Owner and Admin only — removing a consumer removes a signal that guards other people's changes.

Operation id: delete_consumer_v1_tenants__tenant_slug__projects__project_ref__consumers__consumer_ref__delete

Parameters

NameInTypeRequiredDescription
tenant_slugpathstringyesURL-safe tenant slug that scopes the request.
project_refpathstringyesPath parameter identifying the project ref segment.
consumer_refpathstringyesPath parameter identifying the consumer ref segment.
authorizationheaderstring or nullnoJWT bearer token for authenticated access (Authorization: Bearer <token>).
X-API-Keyheaderstring or nullnoTenant-scoped API key used as an alternative to JWT bearer authentication.

Responses

StatusDescriptionBody
204Successful response for retire a consumer.—
422Validation Errorapplication/json HTTPValidationError

GET /v1/tenants/{tenant_slug}/projects/{project_ref}/consumers/{consumer_ref}/bindings​

List a consumer's bindings

How this consumer is recognised in usage traffic: a header, an API key, a JWT claim, or a user-agent glob. A bound value is never returned — not even as a hash.

Deleted bindings are listed with include_deleted=true; they no longer match traffic but keep the history they attributed.

At most 1,000 a page: pass the previous page's next_cursor as cursor until has_more is false.

Requires consumer_contracts:view.

Operation id: list_consumer_bindings_v1_tenants__tenant_slug__projects__project_ref__consumers__consumer_ref__bindings_get

Parameters

NameInTypeRequiredDescription
tenant_slugpathstringyesURL-safe tenant slug that scopes the request.
project_refpathstringyesPath parameter identifying the project ref segment.
consumer_refpathstringyesPath parameter identifying the consumer ref segment.
include_deletedquerybooleannoAlso list deleted bindings.
limitqueryintegernoPage size. At most 1000.
cursorquerystring or nullnoOpaque cursor from the previous page (next_cursor, or the X-Next-Cursor header). Omit for the first page.
authorizationheaderstring or nullnoJWT bearer token for authenticated access (Authorization: Bearer <token>).
X-API-Keyheaderstring or nullnoTenant-scoped API key used as an alternative to JWT bearer authentication.

Responses

StatusDescriptionBody
200Successful response for list a consumer's bindings.application/json ConsumerBindingBindingListResponse
422Validation Errorapplication/json HTTPValidationError

POST /v1/tenants/{tenant_slug}/projects/{project_ref}/consumers/{consumer_ref}/bindings​

Bind a header, API key, JWT claim or user agent to a consumer

Attribute usage traffic to this consumer. header, api_key and jwt_claim take the value to recognise: it is accepted once, hashed (HMAC-SHA256 under a key derived for this workspace) before anything is stored, and never returned. user_agent takes no value; its name is a glob such as billing-service/*.

Matching starts with the next ingested batch. One kind, name and value can identify only one consumer per workspace (409 consumer-binding-exists).

Requires consumer_contracts:create.

Operation id: create_consumer_binding_v1_tenants__tenant_slug__projects__project_ref__consumers__consumer_ref__bindings_post

Parameters

NameInTypeRequiredDescription
tenant_slugpathstringyesURL-safe tenant slug that scopes the request.
project_refpathstringyesPath parameter identifying the project ref segment.
consumer_refpathstringyesPath parameter identifying the consumer ref segment.
authorizationheaderstring or nullnoJWT bearer token for authenticated access (Authorization: Bearer <token>).
X-API-Keyheaderstring or nullnoTenant-scoped API key used as an alternative to JWT bearer authentication.

Request body (required)

Request body for bind a header, api key, jwt claim or user agent to a consumer.

Responses

StatusDescriptionBody
201Successful response for bind a header, api key, jwt claim or user agent to a consumer.application/json BindingRecord
409consumer-binding-exists or consumer-binding-limit.—
422Validation Errorapplication/json HTTPValidationError
503consumer-binding-key-unavailable: no envelope master key is configured.—

DELETE /v1/tenants/{tenant_slug}/projects/{project_ref}/consumers/{consumer_ref}/bindings​

Delete all of a consumer's bindings, optionally erasing its usage identity

Without erase, every live binding stops matching traffic and history stays attributed, as when they are deleted one by one.

With erase=true (RDG-5.4), in one transaction: every binding of the consumer, live or deleted, is removed with its hash; every hourly and daily counter it attributed is re-attributed to anonymous (the counts are kept, so totals do not change); the suggested-consumer rows carrying its hashes and its runtime graph edges are deleted. Afterwards no usage read names the consumer. The consumer and its contract stay.

Requires consumer_contracts:delete. An erasure is audited as usage.consumer.erased.

Operation id: delete_consumer_bindings_v1_tenants__tenant_slug__projects__project_ref__consumers__consumer_ref__bindings_delete

Parameters

NameInTypeRequiredDescription
tenant_slugpathstringyesURL-safe tenant slug that scopes the request.
project_refpathstringyesPath parameter identifying the project ref segment.
consumer_refpathstringyesPath parameter identifying the consumer ref segment.
erasequerybooleannoAlso re-attribute the consumer's counters to anonymous.
authorizationheaderstring or nullnoJWT bearer token for authenticated access (Authorization: Bearer <token>).
X-API-Keyheaderstring or nullnoTenant-scoped API key used as an alternative to JWT bearer authentication.

Responses

StatusDescriptionBody
200Successful response for delete all of a consumer's bindings, optionally erasing its usage identity.application/json BindingsDeletedResponse
400anonymous cannot be erased.—
422Validation Errorapplication/json HTTPValidationError

DELETE /v1/tenants/{tenant_slug}/projects/{project_ref}/consumers/{consumer_ref}/bindings/{binding_id}​

Delete a consumer binding

Stop attributing traffic through this binding, from the next ingested batch on. Traffic it already attributed stays attributed to the consumer.

Requires consumer_contracts:delete.

Operation id: delete_consumer_binding_v1_tenants__tenant_slug__projects__project_ref__consumers__consumer_ref__bindings__binding_id__delete

Parameters

NameInTypeRequiredDescription
tenant_slugpathstringyesURL-safe tenant slug that scopes the request.
project_refpathstringyesPath parameter identifying the project ref segment.
consumer_refpathstringyesPath parameter identifying the consumer ref segment.
binding_idpathstringyesPath parameter identifying the binding id segment.
authorizationheaderstring or nullnoJWT bearer token for authenticated access (Authorization: Bearer <token>).
X-API-Keyheaderstring or nullnoTenant-scoped API key used as an alternative to JWT bearer authentication.

Responses

StatusDescriptionBody
204Successful response for delete a consumer binding.—
422Validation Errorapplication/json HTTPValidationError

GET /v1/tenants/{tenant_slug}/projects/{project_ref}/consumers/{consumer_ref}/contract​

Read a consumer's contract

The consumer's current contract revision, or a specific one with ?revision=.

Requires consumer_contracts:view.

Operation id: read_contract_v1_tenants__tenant_slug__projects__project_ref__consumers__consumer_ref__contract_get

Parameters

NameInTypeRequiredDescription
tenant_slugpathstringyesURL-safe tenant slug that scopes the request.
project_refpathstringyesPath parameter identifying the project ref segment.
consumer_refpathstringyesPath parameter identifying the consumer ref segment.
revisionqueryinteger or nullnoA specific revision number; defaults to the current one.
authorizationheaderstring or nullnoJWT bearer token for authenticated access (Authorization: Bearer <token>).
X-API-Keyheaderstring or nullnoTenant-scoped API key used as an alternative to JWT bearer authentication.

Responses

StatusDescriptionBody
200Successful response for read a consumer's contract.application/json ConsumerContractRecord
422Validation Errorapplication/json HTTPValidationError

PUT /v1/tenants/{tenant_slug}/projects/{project_ref}/consumers/{consumer_ref}/contract​

Declare a consumer's contract from a picked surface

Declare which operations — and, optionally, which fields on them — this consumer uses, without a Pact file. This is what the UI picker submits.

The selection names operations and fields the way a person picks them (method, path template, dotted data path); the server resolves each against the stored specification and stores the resulting JSON Pointers. A client cannot supply its own pointers, so a stored surface always describes something the specification actually contains.

Anything that does not resolve is reported, not dropped: an operation that no longer exists, or a field that has been removed, comes back in unresolved with a stable reason code and is stored on the revision.

Every call writes a new revision; nothing is overwritten.

Requires consumer_contracts:edit.

Operation id: declare_contract_v1_tenants__tenant_slug__projects__project_ref__consumers__consumer_ref__contract_put

Parameters

NameInTypeRequiredDescription
tenant_slugpathstringyesURL-safe tenant slug that scopes the request.
project_refpathstringyesPath parameter identifying the project ref segment.
consumer_refpathstringyesPath parameter identifying the consumer ref segment.
versionquerystring or nullnoVersion label, revision id, or latest to resolve the selection against. Defaults to the project's latest revision.
authorizationheaderstring or nullnoJWT bearer token for authenticated access (Authorization: Bearer <token>).
X-API-Keyheaderstring or nullnoTenant-scoped API key used as an alternative to JWT bearer authentication.

Request body (required)

Request body for declare a consumer's contract from a picked surface.

Responses

StatusDescriptionBody
201Successful response for declare a consumer's contract from a picked surface.application/json ContractResponse
422Validation Errorapplication/json HTTPValidationError

GET /v1/tenants/{tenant_slug}/projects/{project_ref}/consumers/{consumer_ref}/contract-revisions​

List a consumer's contract history

Every stored revision of this consumer's contract, newest first. Revisions are never overwritten, so this is the record of what the consumer claimed it used over time.

Requires consumer_contracts:view.

Operation id: list_contract_revisions_v1_tenants__tenant_slug__projects__project_ref__consumers__consumer_ref__contract_revisions_get

Parameters

NameInTypeRequiredDescription
tenant_slugpathstringyesURL-safe tenant slug that scopes the request.
project_refpathstringyesPath parameter identifying the project ref segment.
consumer_refpathstringyesPath parameter identifying the consumer ref segment.
limitqueryintegernoMaximum revisions to return.
authorizationheaderstring or nullnoJWT bearer token for authenticated access (Authorization: Bearer <token>).
X-API-Keyheaderstring or nullnoTenant-scoped API key used as an alternative to JWT bearer authentication.

Responses

StatusDescriptionBody
200Successful response for list a consumer's contract history.application/json ContractRevisionsResponse
422Validation Errorapplication/json HTTPValidationError

GET /v1/tenants/{tenant_slug}/projects/{project_ref}/consumers/{consumer_ref}/pact​

Export a consumer's declared surface as a Pact v4 file

Generate a Pact v4 document from a consumer contract revision declared through the picker.

Each declared operation becomes one Synchronous/HTTP interaction per response status the consumer reads, carrying only the declared fields. Sample values are the specification's own examples (media-type example / examples, then the schema's example, examples, default, const or first enum value, then a parameter's example). Response bodies carry a cascading type matcher at $, so the provider must return the same shape, not the same values.

Nothing is dropped silently. findings lists every value that had to be invented (placeholder, e.g. no-example, status-range) and everything that could not be written (omitted, e.g. field-not-found, status-default, media-type-not-json, contract-unresolved).

consumer.name is the pacticipant bound to this consumer, else the consumer's handle. provider.name is provider when given, else the one pacticipant bound to the project, else the project's handle; several bound pacticipants without provider is 409 consumer-pact-export-provider-ambiguous.

Only a picker-declared (manual) revision is exported: a revision from a Pact file or an agent is 422 consumer-pact-export-unsupported-source, and a revision that yields no interaction is 422 consumer-pact-export-empty with its findings.

Requires consumer_contracts:view and pacts:view.

Operation id: export_consumer_pact_v1_tenants__tenant_slug__projects__project_ref__consumers__consumer_ref__pact_get

Parameters

NameInTypeRequiredDescription
tenant_slugpathstringyesURL-safe tenant slug that scopes the request.
project_refpathstringyesPath parameter identifying the project ref segment.
consumer_refpathstringyesPath parameter identifying the consumer ref segment.
revisionqueryinteger or nullnoA contract revision; defaults to the current one.
providerquerystring or nullnoThe provider pacticipant name.
authorizationheaderstring or nullnoJWT bearer token for authenticated access (Authorization: Bearer <token>).
X-API-Keyheaderstring or nullnoTenant-scoped API key used as an alternative to JWT bearer authentication.

Responses

StatusDescriptionBody
200Successful response for export a consumer's declared surface as a pact v4 file.application/json PactExportResponse
409Several pacticipants are bound to the project.—
422Not exportable.—

POST /v1/tenants/{tenant_slug}/projects/{project_ref}/consumers/{consumer_ref}/pact/publish​

Publish a consumer's declared surface to the Pact Broker

Generate the Pact v4 document of a picker-declared contract revision (as GET …/pact does) and publish it for a consumer version, exactly as POST …/pact-broker/contracts/publish would: the consumer and provider are registered as pacticipants on first use, the version is recorded with its branch and tags, identical content is stored once, a different pact for a version that already has one is 409 pact-content-conflict, and bi-directional comparisons run against the provider's contracts. The workspace's publish rate limit applies.

Each declared operation becomes one Synchronous/HTTP interaction per response status the consumer reads, carrying only the declared fields. Sample values are the specification's own examples (media-type example / examples, then the schema's example, examples, default, const or first enum value, then a parameter's example). Response bodies carry a cascading type matcher at $, so the provider must return the same shape, not the same values.

Nothing is dropped silently. findings lists every value that had to be invented (placeholder, e.g. no-example, status-range) and everything that could not be written (omitted, e.g. field-not-found, status-default, media-type-not-json, contract-unresolved).

consumer.name is the pacticipant bound to this consumer, else the consumer's handle. provider.name is provider when given, else the one pacticipant bound to the project, else the project's handle; several bound pacticipants without provider is 409 consumer-pact-export-provider-ambiguous.

Only a picker-declared (manual) revision is exported: a revision from a Pact file or an agent is 422 consumer-pact-export-unsupported-source, and a revision that yields no interaction is 422 consumer-pact-export-empty with its findings.

Requires consumer_contracts:view and pacts:create.

Operation id: publish_consumer_pact_v1_tenants__tenant_slug__projects__project_ref__consumers__consumer_ref__pact_publish_post

Parameters

NameInTypeRequiredDescription
tenant_slugpathstringyesURL-safe tenant slug that scopes the request.
project_refpathstringyesPath parameter identifying the project ref segment.
consumer_refpathstringyesPath parameter identifying the consumer ref segment.
authorizationheaderstring or nullnoJWT bearer token for authenticated access (Authorization: Bearer <token>).
X-API-Keyheaderstring or nullnoTenant-scoped API key used as an alternative to JWT bearer authentication.

Request body (required)

Request body for publish a consumer's declared surface to the pact broker.

Responses

StatusDescriptionBody
200Successful response for publish a consumer's declared surface to the pact broker.application/json PactExportPublishResponse
409Ambiguous provider, or changed content for a published version.—
422Not exportable.—
429Over the publish budget.—

GET /v1/tenants/{tenant_slug}/projects/{project_ref}/consumers/{consumer_ref}/runtime​

Compare a consumer's contract with its observed traffic

Per operation, what the consumer declares (its current contract) next to what its bindings show it calls (the usage index, by UTC day):

  • declared_and_used — declared and called in the window;
  • declared_unused — declared, never called in the window;
  • used_undeclared — called, not declared. To add one to the contract, submit the current selection plus that operation to PUT …/consumers/{consumer_ref}/contract.

A consumer with no contract (contract_state: undeclared) reports everything it calls as used_undeclared. anonymous reports the traffic no binding attributes.

Requires consumer_contracts:view.

Operation id: read_consumer_runtime_v1_tenants__tenant_slug__projects__project_ref__consumers__consumer_ref__runtime_get

Parameters

NameInTypeRequiredDescription
tenant_slugpathstringyesURL-safe tenant slug that scopes the request.
project_refpathstringyesPath parameter identifying the project ref segment.
consumer_refpathstringyesPath parameter identifying the consumer ref segment.
daysqueryintegernoWindow in UTC days, ending today.
authorizationheaderstring or nullnoJWT bearer token for authenticated access (Authorization: Bearer <token>).
X-API-Keyheaderstring or nullnoTenant-scoped API key used as an alternative to JWT bearer authentication.

Responses

StatusDescriptionBody
200Successful response for compare a consumer's contract with its observed traffic.application/json ConsumerRuntime
422Validation Errorapplication/json HTTPValidationError

Schemas used​

AvailableSurfaceResponse​

The picker's catalogue for one stored version.

PropertyTypeRequiredDescription
version_record_idstringyesThe revision the catalogue was built from.
version_labelstring or nullnoThat revision's label.
operationsarray of AvailableOperationOutnoOperations.
countintegeryesHow many operations the specification declares.
truncatedbooleannoTrue when any operation's field list was cut short by the walk limits.

BindingInput​

A binding to create.

Attributes: kind: header, api_key, jwt_claim or user_agent. name: The header name, the API-key header name, the JWT claim name, or the user-agent glob. value: The value to recognise (not for user_agent). Accepted once, hashed, and never stored or returned.

PropertyTypeRequiredDescription
kindenum "header", "api_key", "jwt_claim", "user_agent"yesWhat identifies the consumer in traffic.
namestringyesThe header name (x-client-id), the header carrying the API key (x-api-key), the JWT claim (azp), or for user_agent a glob such as billing-service/*.
valuestring (password) or nullnoThe value to recognise. Required for header, api_key and jwt_claim; refused for user_agent. Hashed before it is stored and never returned.

BindingRecord​

A stored binding as every response shows it — never with its value or its hash.

Attributes: id: Row id. consumer_id: The consumer it attributes traffic to. kind: The binding kind. name: The header or claim name, or the user-agent glob. hashed: Whether a value is bound (every kind but user_agent). key_version: The master-key version the value was hashed under. last_matched_at: When traffic last matched it. created_at: When it was created. deleted_at: When it was deleted (it stops matching; history keeps it).

PropertyTypeRequiredDescription
idstringyesStable resource identifier.
consumer_idstringyesConsumer ID.
kindstringyesKind.
namestringyesHuman-readable name.
hashedbooleanyesTrue when a value is bound; the value itself is never returned.
key_versioninteger or nullnoKey Version.
last_matched_atstring or nullnoLast Matched At timestamp (ISO 8601).
created_atstring or nullnoCreation timestamp (ISO 8601).
deleted_atstring or nullnoDeleted At timestamp (ISO 8601).

BindingsDeletedResponse​

What DELETE …/bindings deleted and, with erase=true, re-attributed (RDG-5.4).

PropertyTypeRequiredDescription
consumerstringyesThe consumer's slug.
erasedbooleanyesWhether the consumer's counters were re-attributed to anonymous.
bindingsintegeryesBindings deleted.
hourly_rowsintegernoHourly counter rows re-attributed to anonymous.
daily_rowsintegernoDaily rollup rows re-attributed to anonymous.
callsintegernoCalls those daily rows counted (kept, now anonymous).
unattributed_rowsintegernoSuggested-consumer rows carrying its hashes, deleted.
edgesintegernoRuntime dependency-graph edges from the consumer, deleted.

ConsumerBindingBindingListResponse​

A consumer's bindings.

PropertyTypeRequiredDescription
bindingsarray of BindingRecordnoNewest first.
countintegeryesHow many bindings were returned.
has_morebooleannoWhether another page exists.
next_cursorstring or nullnoPass as cursor to read the next page; null on the last page.

ConsumerContractRecord​

One stored contract revision.

Attributes: id: Row id. consumer_id: The consumer this revision belongs to. revision: Per-consumer counter, from 1. is_current: Whether this is the consumer's current revision. source: pact, manual or agent (CDG-5.2). version_id: The specification revision the pointers were resolved against. version_label: That revision's version label, snapshotted. surface: The declared surface. operation_count: How many operations it declares. field_count: How many fields it declares. unresolved: Interactions that could not be placed. unresolved_count: How many of those there are. source_metadata: Pact provenance; empty for a manual declaration. source_digest: sha256:<hex> of the uploaded Pact document, when there was one. note: Free text explaining the revision. actor_label: Who declared it, at the time. created_at: When it was declared (ISO-8601).

PropertyTypeRequiredDescription
idstringyesStable resource identifier.
consumer_idstringyesConsumer ID.
revisionintegeryesRevision.
is_currentbooleannoWhether current.
sourcestringnoProvenance source for the record (for example human or imported).
version_idstring or nullnoProject version identifier or semantic version label, depending on context.
version_labelstring or nullnoVersion Label.
surfaceConsumerContractSurfacenoSurface.
operation_countintegernoNumber of operation.
field_countintegernoNumber of field.
unresolvedarray of UnresolvedInteractionnoUnresolved.
unresolved_countintegernoNumber of unresolved.
source_metadataobjectnoSource Metadata.
source_digeststring or nullnoSource Digest.
notestring or nullnoNote.
actor_labelstring or nullnoActor Label.
created_atstring or nullnoCreation timestamp (ISO 8601).

ConsumerDetailResponse​

One consumer with its current contract, when it has declared one.

PropertyTypeRequiredDescription
consumerConsumerRecordyesConsumer.
contractConsumerContractRecord or nullnoThe current contract revision, or null when none is declared.

ConsumerInput​

A new consumer, as a caller defines one.

Attributes: slug: Stable handle. Derived from name when omitted. name: Display name. description: What this consumer is. owner: Free text — the team, squad, channel, or person accountable. contact: Email or URL to notify when this consumer's contract would break. metadata: Non-secret free-form context (repository, environment, CI job).

PropertyTypeRequiredDescription
slugstring or nullnoURL-safe identifier.
namestringyesHuman-readable name.
descriptionstring or nullnoFree-text description.
ownerstring or nullnoOwner.
contactstring or nullnoContact.
metadataobjectnoAdditional JSON metadata bag.

ConsumerListResponse​

Every live consumer of a project with its current contract.

PropertyTypeRequiredDescription
consumersarray of ConsumerSummarynoThe project's consumers, newest first.
countintegeryesHow many consumers were returned.
has_morebooleannoWhether another page exists.
next_cursorstring or nullnoPass as cursor to read the next page; null on the last page.

ConsumerPatch​

A partial update. Omitted fields are left alone.

slug is deliberately absent: it is the handle CI and Pact files name, and renaming it would silently orphan every reference to it.

PropertyTypeRequiredDescription
namestring or nullnoHuman-readable name.
descriptionstring or nullnoFree-text description.
ownerstring or nullnoOwner.
contactstring or nullnoContact.
metadataobject or nullnoAdditional JSON metadata bag.

ConsumerRecord​

A stored consumer.

Attributes: id: Row id. tenant_id: Owning tenant. project_id: Project this consumer consumes. slug: Stable handle. name: Display name. description: What this consumer is. owner: Accountable team or person. contact: Where to reach them. metadata: Free-form non-secret context. created_at: When it was registered. updated_at: When it was last changed. deleted_at: Retirement stamp, when retired. runtime_last_seen_at: When usage traffic last attributed to it through a binding (RDG-1.8).

PropertyTypeRequiredDescription
idstringyesStable resource identifier.
tenant_idstringyesTenant that owns the resource.
project_idstringyesProject identifier the resource belongs to.
slugstringyesURL-safe identifier.
namestringyesHuman-readable name.
descriptionstring or nullnoFree-text description.
ownerstring or nullnoOwner.
contactstring or nullnoContact.
metadataobjectnoAdditional JSON metadata bag.
created_atstring or nullnoCreation timestamp (ISO 8601).
updated_atstring or nullnoLast update timestamp (ISO 8601).
deleted_atstring or nullnoDeleted At timestamp (ISO 8601).
runtime_last_seen_atstring or nullnoRuntime Last Seen At timestamp (ISO 8601).

ConsumerRuntime​

Declared versus observed for one consumer.

PropertyTypeRequiredDescription
consumer_idstring or nullnoNull for the anonymous consumer.
slugstringyesURL-safe identifier.
namestringyesHuman-readable name.
contract_statestringyesdeclared, undeclared, or none (anonymous).
since_daystringyesFirst UTC day of the window.
until_daystringyesLast UTC day of the window.
summaryRuntimeSummaryyesShort summary suitable for navigation and reference docs.
declared_and_usedarray of RuntimeOperationnoDeclared And Used.
declared_unusedarray of RuntimeOperationnoDeclared Unused.
used_undeclaredarray of RuntimeOperationnoUsed Undeclared.

ConsumerUsageResponse​

Consumer usage of one stored version.

Attributes: version_record_id: The revision the usage is bound to. version_label: That revision's label. consumers_visible: Whether consumer names are included for this reader. consumer_count: Consumers whose current contract was resolved against this revision. other_version_consumer_count: Consumers whose current contract names another revision. undeclared_consumer_count: Consumers registered but with no contract yet. operations: Per-operation usage, ordered by pointer. schemas: Per-component-schema usage, ordered by pointer.

PropertyTypeRequiredDescription
version_record_idstringyesRevision the usage is bound to.
version_labelstring or nullnoThat revision's label.
consumers_visiblebooleanyesWhether consumer names are included — requires consumer_contracts:view.
consumer_countintegeryesConsumers whose current contract was resolved against this revision.
other_version_consumer_countintegeryesConsumers whose current contract names another revision; not projected.
undeclared_consumer_countintegeryesRegistered consumers that have declared no contract yet.
operationsarray of OperationUsagenoPer-operation usage.
schemasarray of SchemaUsagenoPer-schema usage.

ContractResponse​

A stored contract revision plus the consumer it belongs to.

PropertyTypeRequiredDescription
consumerConsumerRecordyesConsumer.
contractConsumerContractRecordyesContract.
unresolvedarray of UnresolvedInteractionnoInteractions or fields that could not be resolved against the specification. Repeated from the stored contract so an importing client sees them without a second read; they are never silently dropped.

ContractRevisionsResponse​

A consumer's contract history.

PropertyTypeRequiredDescription
revisionsarray of ConsumerContractRecordnoRevisions, newest first.
countintegeryesHow many revisions were returned.

HTTPValidationError​

Validation error response emitted when request data fails schema checks.

PropertyTypeRequiredDescription
detailarray of ValidationErrornoDetail.

PactExportPublishRequest​

Publish the generated pact for one consumer version.

PropertyTypeRequiredDescription
consumer_versionstringyesThe consumer build's version.
branchstring or nullnoThe branch it was built from.
tagsarray of stringnoTags for the consumer version.
build_urlstring or nullnohttp(s) URL of the CI build.
revisioninteger or nullnoA contract revision; defaults to the current one.
providerstring or nullnoThe provider pacticipant name; see the export endpoint.

PactExportPublishResponse​

The generated pact, plus what the broker stored and the comparisons it ran.

PropertyTypeRequiredDescription
consumer_namestringyesconsumer.name in the pact (the pacticipant it publishes as).
provider_namestringyesprovider.name in the pact.
consumer_pacticipant_boundbooleanyesWhether the consumer name is that of a pacticipant bound to this consumer.
provider_pacticipant_boundbooleanyesWhether the provider name is that of the pacticipant bound to this project.
revisionintegeryesThe contract revision the pact was generated from.
version_record_idstringyesThe specification revision the examples were read from.
version_labelstring or nullnoThat revision's label.
interaction_countintegeryesHow many interactions the pact carries.
placeholder_countintegeryesHow many values were invented because no example exists.
omitted_countintegeryesHow many declared items could not be written at all.
findingsarray of ExportFindingnoEvery placeholder and omission, with a stable reason code. Never silently empty.
operationsarray of ExportOperationnoWhat each declared operation became: the interactions it wrote (indexes into pact.interactions) and its finding counts. An operation with no interaction was left out; its omitted finding gives the reason.
pactobjectyesThe Pact v4 document.
publishobjectyesThe Pact Broker publish result, exactly as POST …/pact-broker/contracts/publish returns it: notices, the embedded pacticipant and version, pb:contracts and, when the provider has a provider contract, comparisons.

PactExportResponse​

A generated pact and what it could not say.

PropertyTypeRequiredDescription
consumer_namestringyesconsumer.name in the pact (the pacticipant it publishes as).
provider_namestringyesprovider.name in the pact.
consumer_pacticipant_boundbooleanyesWhether the consumer name is that of a pacticipant bound to this consumer.
provider_pacticipant_boundbooleanyesWhether the provider name is that of the pacticipant bound to this project.
revisionintegeryesThe contract revision the pact was generated from.
version_record_idstringyesThe specification revision the examples were read from.
version_labelstring or nullnoThat revision's label.
interaction_countintegeryesHow many interactions the pact carries.
placeholder_countintegeryesHow many values were invented because no example exists.
omitted_countintegeryesHow many declared items could not be written at all.
findingsarray of ExportFindingnoEvery placeholder and omission, with a stable reason code. Never silently empty.
operationsarray of ExportOperationnoWhat each declared operation became: the interactions it wrote (indexes into pact.interactions) and its finding counts. An operation with no interaction was left out; its omitted finding gives the reason.
pactobjectyesThe Pact v4 document.

PactImportRequest​

A Pact document to import.

Attributes: pact: The Pact document as raw JSON text. consumer_slug: The handle to store it under. Derived from the document's own consumer.name when omitted, which is what lets a CI job upload a pact for a service that has never been registered. consumer_name: Display name for a consumer this import registers. version: Version label, revision id, or latest to resolve the interactions against. note: Free text explaining the revision.

PropertyTypeRequiredDescription
pactstringyesThe Pact document as raw JSON text.
consumer_slugstring or nullnoConsumer Slug.
consumer_namestring or nullnoConsumer Name.
versionstring or nullnoVersion.
notestring or nullnoNote.

RegisterSuggestionInput​

How to register a suggestion.

Attributes: name: Display name for a new consumer (defaults to the suggestion's). slug: Handle for a new consumer (defaults to the suggestion's). consumer: Bind to this existing consumer (slug or id) instead of registering a new one. binding_name: For a hashed client: the header, API-key header or claim name.

PropertyTypeRequiredDescription
namestring or nullnoHuman-readable name.
slugstring or nullnoURL-safe identifier.
consumerstring or nullnoConsumer.
binding_namestring or nullnoBinding Name.

RegisteredSuggestion​

What registering did.

PropertyTypeRequiredDescription
consumerConsumerRecordyesConsumer.
bindingBindingRecordyesBinding.
created_consumerbooleanyesFalse when the client was bound to an existing consumer.

SuggestionListResponse​

A project's suggested consumers.

PropertyTypeRequiredDescription
suggestionsarray of SuggestedConsumernoBusiest first.
countintegeryesHow many suggestions were returned.
window_daysintegeryesThe window they were drawn from, in UTC days ending today.

SurfaceSelection​

A whole picked surface, as the UI picker submits it.

Attributes: operations: The picked operations. Refused when empty — an empty contract declares nothing and would silently exempt the consumer from every future analysis. note: Optional free text explaining the revision.

PropertyTypeRequiredDescription
operationsarray of SelectedOperationnoOperations.
notestring or nullnoNote.