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

# Reserve an effect

> Reserves the next attempt of an effect by the key of the business fact; a key already done or ambiguous reserves nothing, and an attempt in flight answers 409.



## OpenAPI

````yaml openapi/en/cell.json POST /v1/coordination/effects
openapi: 3.1.0
info:
  title: Niadra data API
  version: '1'
  description: >-
    Writing, context, history, objects, identity, privacy and governance of one
    space. Every space has a stable address, with the space and the region in
    its name.
servers:
  - url: https://{space}.{region}.api.niadra.com
    variables:
      space:
        default: acme-prod
        description: The space, which comes in the source key.
      region:
        default: us-east-2
        description: The region of the space, which also comes in the key.
security: []
paths:
  /v1/coordination/effects:
    post:
      tags:
        - coordination
      summary: Reserve an effect
      description: >-
        Reserves the next attempt of an effect, named by the key of the business
        fact it belongs to (one farewell per conversation, one filing per
        notice). A check with `effect_key` does the same; this route serves a
        caller that already decided. A key already `done` or `unknown_outcome`
        reserves nothing, and the answer says so; a key `reserved` by another
        attempt answers 409.


        **Authentication.** Source key: `Authorization: Bearer nia_sk_...`.
        Required scope: `coordinate`. It answers only in a space with the
        `coordination` feature on (the `features` document); in a space without
        it, 404.
      operationId: reserve_effect_v1_coordination_effects_post
      parameters:
        - in: header
          name: Idempotency-Key
          required: true
          schema:
            maxLength: 256
            minLength: 1
            title: Idempotency-Key
            type: string
          description: >-
            Required. Kept 24 hours with the hash of the body: a retry with the
            same key returns the first answer, and the same key with a different
            body returns 409 `conflict`.
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/EffectReserve'
        required: true
      responses:
        '200':
          description: >-
            The key was done or ambiguous already: nothing was reserved, do not
            act.
        '201':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Effect'
          description: The attempt is reserved for the caller, which must settle it.
        '409':
          description: '`effect_in_flight`: another attempt holds the key.'
        '422':
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Problem'
          description: The request does not match the contract.
      security:
        - sourceKey: []
components:
  schemas:
    EffectReserve:
      additionalProperties: false
      properties:
        cost_units:
          default: 0
          minimum: 0
          title: Cost Units
          type: integer
        effect_key:
          maxLength: 512
          minLength: 1
          title: Effect Key
          type: string
        fact:
          anyOf:
            - $ref: '#/components/schemas/ObjectRef'
            - type: 'null'
        kind:
          $ref: '#/components/schemas/EffectKind'
      required:
        - effect_key
        - kind
      title: EffectReserve
      type: object
    Effect:
      additionalProperties: false
      description: >-
        `effect_id` is the key's keyed hash: it names the effect in paths, where
        the key itself, which may

        carry a conversation id, never goes.
      properties:
        attempt:
          title: Attempt
          type: integer
        done_at:
          anyOf:
            - format: date-time
              type: string
            - type: 'null'
          title: Done At
        effect_id:
          pattern: ^[A-Za-z0-9_-]{43}$
          title: Effect Id
          type: string
        reserved_at:
          format: date-time
          title: Reserved At
          type: string
        state:
          enum:
            - reserved
            - done
            - failed
            - unknown_outcome
          title: State
          type: string
      required:
        - effect_id
        - state
        - attempt
        - reserved_at
      title: Effect
      type: object
    Problem:
      additionalProperties: false
      description: RFC 9457 problem details; `code` comes from the versioned error catalog.
      properties:
        code:
          title: Code
          type: string
        detail:
          anyOf:
            - type: string
            - type: 'null'
          default: null
          title: Detail
        request_id:
          anyOf:
            - type: string
            - type: 'null'
          default: null
          title: Request Id
        status:
          title: Status
          type: integer
        title:
          title: Title
          type: string
        type:
          default: about:blank
          title: Type
          type: string
      required:
        - title
        - status
        - code
      title: Problem
      type: object
    ObjectRef:
      additionalProperties: false
      description: >-
        A business object in a system of record, e.g. `invoice` / `erp` /
        `0823`.
      properties:
        id:
          maxLength: 512
          minLength: 1
          title: Id
          type: string
          description: The id in that system.
        namespace:
          maxLength: 256
          minLength: 1
          title: Namespace
          type: string
          description: The system it lives in, such as `erp`.
        type:
          maxLength: 256
          minLength: 1
          title: Type
          type: string
          description: Object type, such as `invoice`, `order` or `ticket`.
      required:
        - type
        - namespace
        - id
      title: ObjectRef
      type: object
    EffectKind:
      enum:
        - delivery
        - document
        - notice
        - filing
        - paid_call
        - external_action
      title: EffectKind
      type: string
  securitySchemes:
    sourceKey:
      type: http
      scheme: bearer
      description: nia_sk_...

````