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

# Create a rate card

> Create a rate card mapping meter unit types to a contracted price per unit (integer minor currency units), targeted by substrate / counterparty / scope and pinned to a currency. Cards are created DRAFT by default; activation is a separate, explicit step (a card moves real money exactly like a settlement rule does) — pass `activateOnCreate: true` to go straight to ACTIVE, or SCHEDULED when `activeFrom` is in the future. One price per unit type per card. Requires scope `settlement:write`.



## OpenAPI

````yaml /openapi-v1.yaml post /v1/rate-cards
openapi: 3.1.0
info:
  title: EnfinitOS API
  version: v1.0
  description: >-
    The governed-execution `/v1` developer API for EnfinitOS — rights, delivery,
    proof, and settlement.


    Use this API to register the legal **bases** a right rests on, **issue** and
    lifecycle-manage rights across delivery substrates (DOOH, CTV, spatial/AR,
    mobile, audio, and more), negotiate **offers**, raise and resolve
    **challenges**, observe constraint-gated **deliveries**, seal signed **proof
    packs**, read **metering** + **settlement** projections, configure
    settlement **rules** and **counterparties**, fulfil GDPR **compliance**
    requests, and subscribe to **webhooks**.


    Every state-changing action is appended to an immutable, signable audit log;
    delivery and proof artefacts are Ed25519-signed so a downstream auditor can
    verify them offline.


    ## Response envelope

    Every response wraps its payload in a canonical envelope.


    Success (HTTP 200):

    ```json { "ok": true, "data": { ... }, "contractVersion": "v1.0" } ```


    Error (4xx / 5xx):

    ```json { "ok": false, "error": "VALIDATION_FAILED", "message": "human
    text", "contractVersion": "v1.0" } ```

    Some error responses carry additional context fields alongside `error` and
    `message` (for example `field`, `validationErrors`, `requiredScopes`,
    `keyScopes`).


    ## Authentication

    All endpoints except `GET /v1` and `GET /v1/healthz` require an API key sent
    as `Authorization: Bearer <api-key>`. Keys carry a set of named scopes; each
    operation documents the scope it requires. A key carrying the `*` wildcard
    scope passes every scope check.

    Pre-launch, sandbox keys are issued through the apply flow: request access
    at `/apply`, receive an activation email on approval, and exchange it for a
    `/v1` sandbox key in the integration playground at `/developers/playground`.
    Self-service key issuance from the developer dashboard at
    `/developers/dashboard` lands at the April 2027 production launch.


    ## Identifiers

    Resource ids are prefixed: bases `bas_…`, rights `rgh_…`, offers `ofr_…`
    (passed as `rightId`/`offerId`), settlement rules `rule_…`, counterparties
    `cp_…`, webhook subscriptions, and webhook deliveries `dlv_…`. All
    timestamps are ISO-8601 strings.
  contact:
    name: EnfinitOS Developer Support
    url: https://docs.enfinitos.com
    email: developers@enfinitos.com
servers:
  - url: https://sandbox.api.enfinitos.com
    description: Sandbox — live today
  - url: https://api.enfinitos.com
    description: Production — at the April 2027 launch
security:
  - bearerAuth: []
tags:
  - name: Discovery
    description: Unauthenticated contract + health probes.
  - name: Tenant
    description: Read the caller's sandbox tenant snapshot.
  - name: Rights
    description: Bases and the right lifecycle (issue, suspend, resume, revoke).
  - name: Offers
    description: Propose, accept, reject, counter, and withdraw offers.
  - name: Challenges
    description: Open, resolve, and withdraw challenges against rights.
  - name: Delivery
    description: Observe constraint-gated delivery events.
  - name: Audit
    description: The append-only event log.
  - name: Proof
    description: Signed proof packs.
  - name: Metering & Settlement
    description: Metering and settlement projections.
  - name: Settlement config
    description: Settlement rules and counterparties.
  - name: Compliance
    description: GDPR Article 15 export and Article 17 erasure.
  - name: Webhooks
    description: Webhook subscriptions and delivery history.
  - name: Disputes
    description: Delivery disputes — open, investigate, respond, resolve.
paths:
  /v1/rate-cards:
    post:
      tags:
        - Settlement config
      summary: Create a rate card
      description: >-
        Create a rate card mapping meter unit types to a contracted price per
        unit (integer minor currency units), targeted by substrate /
        counterparty / scope and pinned to a currency. Cards are created DRAFT
        by default; activation is a separate, explicit step (a card moves real
        money exactly like a settlement rule does) — pass `activateOnCreate:
        true` to go straight to ACTIVE, or SCHEDULED when `activeFrom` is in the
        future. One price per unit type per card. Requires scope
        `settlement:write`.
      operationId: createRateCard
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - label
                - prices
              properties:
                label:
                  type: string
                  description: Operator-facing label (required, non-empty).
                description:
                  type:
                    - string
                    - 'null'
                prices:
                  type: array
                  minItems: 1
                  description: Priced unit types; one entry per unit type.
                  items:
                    $ref: '#/components/schemas/RateCardPrice'
                targeting:
                  description: >-
                    Optional targeting block. If omitted, a targeting block is
                    synthesised from the top-level `substrate`,
                    `appliesToScope`, and `currency` fields.
                  allOf:
                    - $ref: '#/components/schemas/RateCardTargeting'
                substrate:
                  type:
                    - string
                    - 'null'
                  description: >-
                    Convenience — seeds `targeting.substrates` when `targeting`
                    is omitted.
                appliesToScope:
                  type:
                    - string
                    - 'null'
                  description: >-
                    Convenience — seeds `targeting.appliesToScope` when
                    `targeting` is omitted.
                currency:
                  type: string
                  description: ISO 4217 currency (upper-cased). Defaults to GBP.
                  default: GBP
                activeFrom:
                  type: string
                  format: date-time
                  description: >-
                    Defaults to now. A future value yields SCHEDULED when
                    activated on create.
                activeUntil:
                  type:
                    - string
                    - 'null'
                  format: date-time
                createdBy:
                  type: string
                  description: Author attribution. Defaults to "developer".
                activateOnCreate:
                  type: boolean
                  default: false
                  description: >-
                    When true, create the card ACTIVE (or SCHEDULED if
                    `activeFrom` is in the future).
      responses:
        '200':
          description: The created rate card.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RateCardResponse'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '409':
          $ref: '#/components/responses/StateConflict'
        '422':
          $ref: '#/components/responses/ValidationFailed'
components:
  schemas:
    RateCardPrice:
      type: object
      description: One priced unit type. One price per unit type per card.
      required:
        - unitType
        - pricePerUnitCents
      properties:
        unitType:
          $ref: '#/components/schemas/MeterUnitType'
        pricePerUnitCents:
          type: integer
          minimum: 0
          description: >-
            Integer minor currency units (pence/cents) per ONE unit. 0 =
            contractually free. gross = unitCount × pricePerUnitCents.
    RateCardTargeting:
      type: object
      description: >-
        Controls when a card applies — same shape as settlement-rule targeting
        minus the gross-amount bounds (gross does not exist until a card has
        priced the meter).
      required:
        - currency
      properties:
        substrates:
          type:
            - array
            - 'null'
          description: Substrates this card applies to. Null/empty = ALL.
          items:
            type: string
        counterpartyIds:
          type:
            - array
            - 'null'
          description: Counterparties this card applies to. Null/empty = ALL.
          items:
            type: string
        appliesToScope:
          type:
            - string
            - 'null'
          description: Free-form scope-label filter; null/empty = ALL.
        currency:
          type: string
          description: ISO 4217 — cards are currency-pinned.
    RateCardResponse:
      allOf:
        - $ref: '#/components/schemas/SuccessEnvelope'
        - type: object
          properties:
            data:
              type: object
              properties:
                rateCard:
                  $ref: '#/components/schemas/RateCard'
    MeterUnitType:
      type: string
      enum:
        - DWELL_SECONDS
        - IMPRESSION_IN_PLACE
        - ATTENTION_SECONDS
        - OCCUPANCY_WEIGHTED_EXPOSURE
        - COMPLIANT_DELIVERY_MINUTE
        - CUSTOM
    SuccessEnvelope:
      type: object
      required:
        - ok
        - data
        - contractVersion
      properties:
        ok:
          type: boolean
          const: true
        data:
          description: Route-specific payload. Operation responses refine this.
          type: object
        contractVersion:
          type: string
          const: v1.0
    RateCard:
      type: object
      description: >-
        The pricing-policy plane — maps meter unit types to a contracted price
        per unit, targeted + currency-pinned. Mirrors `SettlementRule`
        (lifecycle, scheduling, versioning, audit fields).
      properties:
        id:
          type: string
          description: >-
            Prefixed `ratecard_` (or `ratecard:default` for the platform
            default).
        orgId:
          type: string
        version:
          type: integer
        label:
          type: string
        description:
          type:
            - string
            - 'null'
        status:
          $ref: '#/components/schemas/RateCardStatus'
        activeFrom:
          type: string
          format: date-time
        activeUntil:
          type:
            - string
            - 'null'
          format: date-time
        supersedesCardId:
          type:
            - string
            - 'null'
        supersededByCardId:
          type:
            - string
            - 'null'
        prices:
          type: array
          items:
            $ref: '#/components/schemas/RateCardPrice'
        targeting:
          $ref: '#/components/schemas/RateCardTargeting'
        createdBy:
          type: string
        createdAt:
          type: string
          format: date-time
        updatedAt:
          type: string
          format: date-time
        approvedBy:
          type:
            - string
            - 'null'
        approvedAt:
          type:
            - string
            - 'null'
          format: date-time
        approvalNotes:
          type:
            - string
            - 'null'
    ErrorEnvelope:
      type: object
      required:
        - ok
        - error
        - message
      properties:
        ok:
          type: boolean
          const: false
        error:
          $ref: '#/components/schemas/ErrorCode'
        message:
          type: string
          description: Human-readable explanation.
        contractVersion:
          type: string
          const: v1.0
        field:
          type: string
          description: Present on some VALIDATION_FAILED errors — the offending field.
        validationErrors:
          type: array
          description: Present on settlement-rule / counterparty validation failures.
          items:
            type: object
            additionalProperties: true
        requiredScopes:
          type: array
          description: Present on SCOPE_MISSING — the scopes the operation needs.
          items:
            type: string
        keyScopes:
          type: array
          description: Present on SCOPE_MISSING — the scopes the presented key carries.
          items:
            type: string
      additionalProperties: true
    RateCardStatus:
      type: string
      description: >-
        Rate-card lifecycle — identical vocabulary to `SettlementRuleStatus` so
        both pricing planes share one approvals model.
      enum:
        - DRAFT
        - PENDING_APPROVAL
        - SCHEDULED
        - ACTIVE
        - SUPERSEDED
        - CANCELLED
    ErrorCode:
      type: string
      description: Machine-readable error code. Drives the HTTP status.
      enum:
        - AUTH_REQUIRED
        - AUTH_INVALID
        - SCOPE_MISSING
        - BAD_REQUEST
        - VALIDATION_FAILED
        - RESOURCE_NOT_FOUND
        - STATE_CONFLICT
        - PRECONDITION_FAILED
        - RATE_LIMITED
        - INTERNAL_ERROR
  responses:
    Unauthorized:
      description: >-
        Missing/malformed Authorization header (AUTH_REQUIRED) or an invalid key
        (AUTH_INVALID).
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorEnvelope'
    Forbidden:
      description: >-
        The key is valid but missing one or more required scopes
        (SCOPE_MISSING).
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorEnvelope'
    StateConflict:
      description: >-
        The resource is in a state that forbids this transition, or a concurrent
        write lost (STATE_CONFLICT).
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorEnvelope'
    ValidationFailed:
      description: >-
        A field was missing or wrong-typed (VALIDATION_FAILED). May carry
        `field` or `validationErrors`.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorEnvelope'
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: 'API key sent as `Authorization: Bearer <api-key>`.'

````