> ## Documentation Index
> Fetch the complete documentation index at: https://docs.variable.global/llms.txt
> Use this file to discover all available pages before exploring further.

# PACT v3 events

> Send PACT Action Events, and get PCF requests answered.

The events endpoint takes a [CloudEvent](https://cloudevents.io) in the PACT v3 format. It needs a token with the
`pact:read` permission, even when your PACT API is public.

### Accepted event types

| Type | What Variable does |
| - | - |
| `org.wbcsd.pact.ProductFootprint.RequestCreatedEvent.3` | Answers the request, below |
| `org.wbcsd.pact.ProductFootprint.RequestFulfilledEvent.3` | Accepts it |
| `org.wbcsd.pact.ProductFootprint.RequestRejectedEvent.3` | Accepts it |
| `org.wbcsd.pact.ProductFootprint.PublishedEvent.3` | Accepts it |

### PCF requests

A `RequestCreatedEvent` asks for the footprints that match its `data`, which takes the same criteria as the
[footprint filters](/pact-api/footprints-v3#filters): `productId`, `companyId`, `geography`, `classification`,
`status`, `validOn`, `validAfter` and `validBefore`. A footprint has to match all of them.

Variable answers by sending an event back to the requester's PACT API, at `<source>/3/events`, where `source` is the
request's own `source`. It authenticates with the credentials of the PACT data source whose URL matches that `source`
(see [Answering PCF requests](/pact-api/configuration#answering-pcf-requests)). The answer is one of:

* **`RequestFulfilledEvent`** with the matching footprints in `pfs`.
* **`RequestRejectedEvent`** with error code `NotFound` when no footprint matches, or the request names no criteria.
* **`RequestRejectedEvent`** with error code `BadRequest` when more than 100 footprints match. Narrow the request, or
  page through [`GET /pact/3/footprints`](/pact-api/footprints-v3).

The answer's `requestEventId` is the request's `id`. A request whose `source` matches none of the company's PACT data
sources gets no answer.


## OpenAPI

````yaml POST /pact/3/events
openapi: 3.0.1
info:
  title: Variable API
  description: This is the Variable API
  version: 1.1.0
servers:
  - url: https://app.variable.global/api
security:
  - basicAuth: []
  - bearerAuth: []
  - oAuthNoScopes: []
paths:
  /pact/3/events:
    servers:
      - url: https://{subdomain}.variable.global/api
        description: Your company's PACT API
        variables:
          subdomain:
            default: your_subdomain
            description: Your Variable subdomain, set in company settings
    post:
      summary: Send a PACT v3 event
      requestBody:
        required: true
        content:
          application/cloudevents+json:
            schema:
              $ref: '#/components/schemas/PactEventV3'
      responses:
        '200':
          description: The event was accepted
        '400':
          description: >-
            The content type isn't `application/cloudevents+json`, or the event
            fails the PACT v3 schema
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PactErrorResponse'
        '401':
          description: The token expired, or lacks the `pact:read` permission
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PactErrorResponse'
      security:
        - bearerAuth: []
components:
  schemas:
    PactEventV3:
      type: object
      description: A CloudEvent in the PACT v3 format.
      required:
        - specversion
        - id
        - source
        - time
        - type
        - data
      properties:
        specversion:
          type: string
          enum:
            - '1.0'
        id:
          type: string
          maxLength: 256
        source:
          type: string
          maxLength: 1024
          description: >-
            The sender's PACT API URL. Variable answers a PCF request at
            `<source>/3/events`.
          example: https://partner.example.com/pact
        time:
          $ref: '#/components/schemas/UTC_ISO_8601'
        type:
          type: string
          enum:
            - org.wbcsd.pact.ProductFootprint.RequestCreatedEvent.3
            - org.wbcsd.pact.ProductFootprint.RequestFulfilledEvent.3
            - org.wbcsd.pact.ProductFootprint.RequestRejectedEvent.3
            - org.wbcsd.pact.ProductFootprint.PublishedEvent.3
        data:
          type: object
          description: >
            For a `RequestCreatedEvent`, the criteria of the footprints asked
            for: `productId`, `companyId`, `geography`, `classification` and
            `status` take up to 100 values each; `validOn`, `validAfter` and
            `validBefore` take one ISO 8601 date.
          example:
            productId:
              - urn:uuid:6f8d6c41-6a3c-4c3e-9a51-0b5c4f1e2d7a
            status:
              - Active
    PactErrorResponse:
      type: object
      properties:
        message:
          type: string
          example: token expired
        code:
          type: string
          enum:
            - BadRequest
            - NotFound
            - TokenExpired
            - Unauthorized
          example: TokenExpired
    UTC_ISO_8601:
      type: string
      format: date-time
      example: '2025-01-01T00:00:00.000Z'
  securitySchemes:
    basicAuth:
      type: http
      scheme: basic
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
    oAuthNoScopes:
      type: oauth2
      flows:
        clientCredentials:
          tokenUrl: /auth/token
          scopes: {}

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.