ProductIndex Attribution API

The Attribution API from ProductIndex — 2 operation(s) for attribution.

GitHub OpenAPI

Operations 2

POST /api/attribution/conversion/ Report an order that came from a ProductIndex link #
POST /api/attribution/adjustment/ Report a refund or cancellation of a reported order #

Work with this as data

Every API here is available over the APIs.io API and to AI agents over MCP.

MCP server

One button, every client — Claude, Cursor, VS Code and the rest.

https://apis.io/mcp

Tools for apis

7 MCP tools reach this
  • find_apisBrowse and filter every API in the catalog.
  • get_api_artifactsOne API's artifacts, grouped by type.
  • get_openapiThe primary OpenAPI for this API.
  • find_similar_apisAPIs that look like this one.
  • apis_io_searchSTART HERE — APIs, providers and tags for one query, each with its total.
  • resolveTurn a domain, URL or GitHub org into the provider it belongs to.
  • find_cohortsEvery scored population of providers in the catalog.
All 92 tools →

Call it yourself

curl for this page
This API
curl "https://apis.io/api/v1/apis/productindex-ai:productindex-ai-attribution-api"
All apis
curl "https://apis.io/api/v1/apis?limit=25"

Calls without X-API-Key need no key. Calls with it need a paid plan — get a key.

Get an API key

Free tier, no form to fill in. Signing in shares your email address with us — we store it to create your key and to recognise you if you sign in with another provider. By signing up you are subscribing to the APIs.io and API Evangelist newsletters — you can unsubscribe from any issue. See our Privacy Policy and Terms.

A second provider on the same verified email joins the account you already have.

OpenAPI Specification

productindex-ai-attribution-api-openapi.yml Raw ↑
openapi: 3.2.0
info:
  title: Productindex Ai Attribution API
  version: 1.0.0
  contact:
    name: ProductIndex
    url: https://productindex.ai/contact
  description: 'Operations tagged Attribution across 2 of this provider''s published API definitions: productindex-ai-mcp.json, productindex-ai-openapi.json. Each path carries the servers of the definition it was published in.'
servers:
- url: https://productindex.ai
  description: Production
security: []
tags:
- name: Attribution
paths:
  /api/attribution/conversion/:
    parameters:
    - $ref: '#/components/parameters/ApiVersion'
    post:
      operationId: reportConversion
      summary: Report an order that came from a ProductIndex link
      description: 'Server-to-server postback from a producer''s store (guide: https://productindex.ai/docs/developers#dev-sales-reporting). Records the attribution on the click named by `pi_ref` and one commission event. The click must be one of the signing org''s links and the order must be placed within 30 days after the click. Idempotent: re-sending the same `order_id` with the same `pi_ref` returns the recorded event with `replay: true`. A legacy body without `order_id`/`subtotal` (the pre-v2 Shopify app) still records attribution but is never billed.'
      security:
      - integrationSignature: []
      parameters:
      - $ref: '#/components/parameters/IntegrationStore'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
              - pi_ref
              - order_id
              - subtotal
              - currency
              properties:
                pi_ref:
                  type: string
                  format: uuid
                  description: The click id from the `?pi_ref=` on the link the shopper arrived by.
                order_id:
                  type: string
                  minLength: 1
                  maxLength: 255
                  description: Your order id. One conversion per order.
                ordered_at:
                  type: string
                  format: date-time
                  description: ISO 8601 with a zone; not in the future. Defaults to the time received.
                subtotal:
                  type: string
                  pattern: ^\d{1,9}(\.\d{1,2})?$
                  description: 'Decimal string. The commission base (Producer Terms §1.8): merchandise subtotal after discounts, excluding tax, shipping, tips and gift cards.'
                currency:
                  type: string
                  pattern: ^[A-Za-z]{3}$
                  description: ISO 4217. Every currency is recorded; only USD orders currently accrue commission.
                order_value:
                  type: number
                  minimum: 0
                  description: Optional order total. Accepted for compatibility; not used for billing.
      responses:
        '200':
          description: 'Recorded, or a re-send of the same order_id + pi_ref (`replay: true`), which returns the recorded event unchanged. Correct an order with POST /api/attribution/adjustment/.'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ConversionRecorded'
        '400':
          description: Invalid field, invalid JSON, or missing/invalid `store`.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '401':
          description: Missing, invalid, expired or replayed signature; unknown or revoked key.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '403':
          description: The key can't act for this `store` or call this endpoint.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '404':
          description: Click not found or not this org's, or the org isn't active.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '409':
          description: 'The click was already converted by another order, or the order is attributed to another click. Also returned when two identical requests race; re-sending then returns 200 with `replay: true`.'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '410':
          description: The order is more than 30 days after the click, or before it.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '503':
          description: Replay protection temporarily unavailable; retry with a new signature.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
      tags:
      - Attribution
    servers:
    - url: https://productindex.ai
      description: Production
  /api/attribution/adjustment/:
    parameters:
    - $ref: '#/components/parameters/ApiVersion'
    post:
      operationId: reportAdjustment
      summary: Report a refund or cancellation of a reported order
      description: 'Reduces the commission on an order previously reported to POST /api/attribution/conversion/ by the same org. Counts within 60 days of the order; later ones return `applied: false, reason: "outside_window"`. Idempotent on (`order_id`, `refund_id`).'
      security:
      - integrationSignature: []
      parameters:
      - $ref: '#/components/parameters/IntegrationStore'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
              - order_id
              - refund_id
              - kind
              - currency
              if:
                properties:
                  kind:
                    const: refund
              then:
                required:
                - amount
              properties:
                order_id:
                  type: string
                  minLength: 1
                  maxLength: 255
                refund_id:
                  type: string
                  minLength: 1
                  maxLength: 255
                  description: Your id for this refund; re-sending it is a replay.
                kind:
                  type: string
                  enum:
                  - refund
                  - cancel
                amount:
                  type: string
                  pattern: ^\d{1,9}(\.\d{1,2})?$
                  description: 'Decimal string: the refunded part of the subtotal. Required for `refund`; a `cancel` without it reverses what''s left.'
                currency:
                  type: string
                  pattern: ^[A-Za-z]{3}$
                  description: Must match the order's currency.
                occurred_at:
                  type: string
                  format: date-time
                  description: ISO 8601 with a zone; not in the future.
      responses:
        '200':
          description: '`applied: true` with the adjustment and the event after it (`replay: true` for a repeat), or `applied: false, reason: "outside_window"`.'
          content:
            application/json:
              schema:
                type: object
                required:
                - applied
                properties:
                  applied:
                    type: boolean
                  reason:
                    type: string
                  replay:
                    type: boolean
                  adjustment:
                    type: object
                  event:
                    type: object
        '400':
          description: Invalid field, invalid JSON, currency mismatch, or missing/invalid `store`.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '401':
          description: Missing, invalid, expired or replayed signature; unknown or revoked key.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '403':
          description: The key can't act for this `store` or call this endpoint.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '404':
          description: No conversion for this `order_id` from this org, or the org isn't active.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '409':
          description: A concurrent duplicate won the race; re-send to get the recorded result.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '503':
          description: Replay protection temporarily unavailable; retry with a new signature.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
      tags:
      - Attribution
    servers:
    - url: https://productindex.ai
      description: Production
components:
  parameters:
    IntegrationStore:
      name: store
      in: query
      required: true
      description: 'The store the signed request acts for. For a producer''s own key (`custom_…`): your organization id (lowercase UUID), shown as the store value in Producer Dashboard → Sales reporting. It is part of the signed `@query`.'
      schema:
        type: string
    ApiVersion:
      name: ProductIndex-API-Version
      in: header
      required: false
      description: 'API version to use. Optional: the only version is 1, requests without this header get version 1, and any other value is rejected with a 400 (code unsupported_api_version). See the versioning policy in info.description.'
      schema:
        type: string
        enum:
        - '1'
        default: '1'
  schemas:
    ConversionRecorded:
      type: object
      required:
      - recorded
      - pi_ref
      - event
      properties:
        recorded:
          type: boolean
          const: true
        replay:
          type: boolean
          description: Present (true) when this was an identical re-send.
        pi_ref:
          type: string
          format: uuid
        event:
          type: object
          properties:
            id:
              type: string
              format: uuid
            status:
              type: string
              enum:
              - accrued
              - billed
              - over_cap
              - not_billable
              - reversed
            not_billable_reason:
              type:
              - string
              - 'null'
            free_applied_cents:
              type: integer
            billable_cents:
              type: integer
            commission_cents:
              type: integer
    ErrorResponse:
      type: object
      required:
      - error
      properties:
        error:
          type: string
      additionalProperties: true
      description: Common error envelope across every route in this spec. Some validation branches add extra fields alongside `error` (e.g. `field`, `max`, `valid`, `code`) — see each operation's per-status description for the exact fields a given failure mode adds.
  securitySchemes:
    integrationSignature:
      type: http
      scheme: signature
      description: 'RFC 9421 HTTP Message Signature with Ed25519, ProductIndex profile (full recipe and a tested Node implementation: https://productindex.ai/docs/developers#dev-sales-reporting). Headers: `Content-Digest: sha-256=:<base64 SHA-256 of the body>:`, `Signature-Input: pi=("@method" "@authority" "@path" "@query" "content-digest");created=<unix>;expires=<unix>;nonce="<22 base64url chars>";keyid="<kid>";alg="ed25519";tag="productindex-integration"`, `Signature: pi=:<base64 signature>:`. `@authority` is productindex.ai, `@path` has no trailing slash, `expires` is at most 60 s after `created`, and each nonce is accepted once. A producer''s own key (kid `custom_…`, created in Producer Dashboard → Sales reporting; ProductIndex stores only the public key) may call only the two /api/attribution/ postbacks, and only for its own organization''s `store`.'
    producerSession:
      type: apiKey
      in: cookie
      name: authjs.session-token
      description: Browser session cookie from signing in at /auth/signin, for a producer account (accountType='producer'). Served as "__Secure-authjs.session-token" over HTTPS. Not directly obtainable by a pure API/agent client — this auth mode is for the dashboard's own fetch() calls and the human-driven signup/verification flow, not for third-party integrations. Third-party/agent integrations should use producerBearerToken where the route supports it.
    producerBearerToken:
      type: http
      scheme: bearer
      description: Shopify-plugin producer link token (issued via the Shopify OAuth/link flow, validated with validateShopifyLinkToken). Only accepted on routes built on resolveProducerAuth — not every producer route supports this; register.ts and ucp-check.ts are session-only.
x-refined-from:
- productindex-ai-mcp.json
- productindex-ai-openapi.json