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

# Preview giving a unit by hand

> Shows what giving a unit by hand would do, without doing it: who would get it, who is skipped and why, who matched nobody, and what is left of a rule's budget (`count_against`). `users` are `usr_…` or your own IDs, up to 200. Writes nothing. [Giving by hand](/units#giving-by-hand)



## OpenAPI

````yaml /api-reference/openapi.json post /v1/units/give/preview
openapi: 3.1.0
info:
  title: Lurk API
  version: 1.0.0
  description: Events in, rules decide, units change, receipts out.
servers:
  - url: https://api.getlurk.com
security: []
tags:
  - name: events
    description: Send what your users do. Lurk runs your live rules on each event.
    x-group: Events
    x-displayName: Events
  - name: units
    description: What people collect and hold, and their balances.
    x-group: Units
    x-displayName: Units
  - name: rules
    description: What Lurk does when an event comes in. A person takes a rule live.
    x-group: Rules
    x-displayName: Rules
  - name: activity
    description: A receipt for every change, with why it happened.
    x-group: Receipts
    x-displayName: Receipts
  - name: users
    description: The people your events are about.
    x-group: People
    x-displayName: People
  - name: webhook_endpoints
    description: Where Lurk sends signed notices of what changed.
    x-group: Webhooks
    x-displayName: Webhooks
  - name: known_values
    description: The properties of your own events whose values Lurk remembers.
    x-group: Known values
    x-displayName: Known values
  - name: feedback
    description: Tell the Lurk team about a bug, a gap or an idea.
    x-group: Feedback
    x-displayName: Feedback
  - name: annotations
    description: >-
      Short notes on a day of the project, such as a release or a campaign
      start.
    x-group: Annotations
    x-displayName: Annotations
  - name: trusted_issuers
    description: The sign-in providers a project trusts for its app's users.
    x-group: Trusted issuers
    x-displayName: Trusted issuers
  - name: client_events
    description: The events a signed-in device may send, and their caps.
    x-group: Client events
    x-displayName: Client events
  - name: issuer_identities
    description: Which person each sign-in subject is bound to.
    x-group: Issuer identities
    x-displayName: Issuer identities
  - name: proposals
    description: Changes an agent or Lurky asks for and a person approves or declines.
    x-group: Proposals
    x-displayName: Proposals
  - name: holds
    description: Changes a rule parked for a person to give or refuse.
    x-group: Holds
    x-displayName: Holds
  - name: audiences
    description: The groups of people that rules can read.
    x-group: Audiences
    x-displayName: Audiences
  - name: budgets
    description: What each live rule's budgets have given in the window they are in now.
    x-group: Budgets
    x-displayName: Budgets
  - name: templates
    description: Kits that add units and rules to a project in one go.
    x-group: Templates
    x-displayName: Templates
  - name: views
    description: Saved questions about a project, with their answers.
    x-group: Views
    x-displayName: Views
  - name: integrations
    description: Every way events reach Lurk or state leaves it, and the state of each.
    x-group: Integrations
    x-displayName: Integrations
  - name: projects
    description: Where units, rules and events live. An organization can have several.
    x-group: Projects
    x-displayName: Projects
  - name: clocks
    description: A test project's clock, which can be moved to try schedules and expiries.
    x-group: Clocks
    x-displayName: Clocks
paths:
  /v1/units/give/preview:
    post:
      tags:
        - units
      summary: Preview giving a unit by hand
      description: >-
        Shows what giving a unit by hand would do, without doing it: who would
        get it, who is skipped and why, who matched nobody, and what is left of
        a rule's budget (`count_against`). `users` are `usr_…` or your own IDs,
        up to 200. Writes nothing. [Giving by hand](/units#giving-by-hand)
      operationId: units.give_preview
      parameters:
        - schema:
            type: string
            description: W3C Trace Context; joins your trace to ours
          required: false
          description: W3C Trace Context; joins your trace to ours
          name: traceparent
          in: header
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/GiveUnitsInput'
      responses:
        '200':
          description: Preview giving a unit by hand
          headers:
            Request-Id:
              schema:
                type: string
                description: Quote this when you contact support
              required: true
              description: Quote this when you contact support
            traceparent:
              schema:
                type: string
                description: W3C Trace Context for this call, in the caller's trace
              required: true
              description: W3C Trace Context for this call, in the caller's trace
            RateLimit:
              schema:
                type: string
                description: The tightest limit now, e.g. `"ingest-key";r=5999;t=42`
              required: true
              description: The tightest limit now, e.g. `"ingest-key";r=5999;t=42`
            RateLimit-Policy:
              schema:
                type: string
                description: Its quota and window, e.g. `"ingest-key";q=6000;w=60`
              required: true
              description: Its quota and window, e.g. `"ingest-key";q=6000;w=60`
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GivePreview'
        '429':
          description: Too many requests. Wait `Retry-After` seconds.
          headers:
            Request-Id:
              schema:
                type: string
                description: Quote this when you contact support
              required: true
              description: Quote this when you contact support
            traceparent:
              schema:
                type: string
                description: W3C Trace Context for this call, in the caller's trace
              required: true
              description: W3C Trace Context for this call, in the caller's trace
            RateLimit:
              schema:
                type: string
                description: The tightest limit now, e.g. `"ingest-key";r=5999;t=42`
              required: true
              description: The tightest limit now, e.g. `"ingest-key";r=5999;t=42`
            RateLimit-Policy:
              schema:
                type: string
                description: Its quota and window, e.g. `"ingest-key";q=6000;w=60`
              required: true
              description: Its quota and window, e.g. `"ingest-key";q=6000;w=60`
            Retry-After:
              schema:
                type: string
                description: Seconds to wait
              required: true
              description: Seconds to wait
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        default:
          description: Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      security:
        - bearerAuth: []
components:
  schemas:
    GiveUnitsInput:
      type: object
      properties:
        unit:
          type: string
          pattern: ^[a-z][a-z0-9_-]{0,63}$
          description: 'The unit to give: its key'
        amount:
          type: integer
          exclusiveMinimum: 0
          maximum: 1000000
          description: What each person gets
        users:
          type: array
          items:
            type: string
            minLength: 1
            maxLength: 256
          minItems: 1
          maxItems: 200
          description: usr_… IDs or the brand's own IDs, up to 200 at a time
        note:
          type: string
          minLength: 1
          maxLength: 280
          description: Written on every receipt
        count_against:
          type: string
          minLength: 1
          maxLength: 100
          description: >-
            A rule (ID or key) with a budget in this unit: the give is counted
            in it and refused if it would pass it
      required:
        - unit
        - amount
        - users
      additionalProperties: false
    GivePreview:
      type: object
      properties:
        unit:
          type: string
          pattern: ^[a-z][a-z0-9_-]{0,63}$
          description: The unit's key
        amount:
          type: integer
          description: What each person gets (or would get)
        people:
          type: array
          items:
            $ref: '#/components/schemas/GiveLine'
          description: One line for each person found, in ID order
        not_found:
          type: array
          items:
            type: string
          description: IDs that matched nobody. Nothing is created for them
        totals:
          type: object
          properties:
            people:
              type: integer
              minimum: 0
              description: Who gets it (or would)
            skipped:
              type: integer
              minimum: 0
              description: Who the unit's settings stop
            units:
              type: integer
              minimum: 0
              description: The total given (or that would be)
          required:
            - people
            - skipped
            - units
          description: Counts for the whole give
        budget:
          type:
            - object
            - 'null'
          properties:
            rule:
              type: object
              properties:
                id:
                  type: string
                  description: The rule's rule_… ID
                key:
                  type: string
                  description: The rule's key
                name:
                  type: string
                  description: The rule's name
              required:
                - id
                - key
                - name
              description: The rule whose budget the give is counted in
            per:
              type: string
              enum:
                - day
                - week
                - month
              description: >-
                How long the budget lasts before it starts again, in the
                project's time zone
            max:
              type: integer
              description: The most the budget allows in that time
            used_before:
              type: integer
              minimum: 0
              description: Already used in the current period
            used_after:
              type: integer
              minimum: 0
              description: With this give counted
          required:
            - rule
            - per
            - max
            - used_before
            - used_after
          description: Set when the give is counted against a rule's budget
      required:
        - unit
        - amount
        - people
        - not_found
        - totals
        - budget
    Error:
      type: object
      properties:
        error:
          type: object
          properties:
            status:
              type: integer
            code:
              type: string
              enum:
                - invalid_json
                - invalid_key
                - forbidden
                - approval_required
                - not_found
                - idempotency_conflict
                - conflict
                - unblock_clock_reversed
                - insufficient_balance
                - reference_used
                - validation_failed
                - rate_limited
                - internal
                - unavailable
            message:
              type: string
            param:
              type: string
            next_step:
              type: string
              description: >-
                What to do about this kind of error, in one sentence. Always
                sent by current servers
            request_id:
              type: string
            doc_url:
              type: string
              format: uri
          required:
            - status
            - code
            - message
            - request_id
            - doc_url
      required:
        - error
    GiveLine:
      type: object
      properties:
        user:
          type: object
          properties:
            id:
              type: string
              description: The usr_… ID
            external_id:
              type: string
              description: The brand's own identifier for the person
          required:
            - id
            - external_id
          description: The person
        status:
          type: string
          enum:
            - given
            - would_give
            - skipped
          description: >-
            given: they got it. would_give: they would get it (a preview).
            skipped: the unit's settings stop it, and `reason` says why
        reason:
          type:
            - string
            - 'null'
          description: 'Why they were skipped: beans would be 1,100, past its cap of 1,000'
        balance_after:
          type:
            - integer
            - 'null'
          description: What they hold after, or would hold in a preview. Null when skipped
        activity:
          type:
            - string
            - 'null'
          pattern: ^act_[0-7][0-9a-hjkmnp-tv-z]{25}$
          description: Their receipt, once given
      required:
        - user
        - status
        - reason
        - balance_after
        - activity
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: >-
        A project key (Developers → API keys). Keep it on your server, not in an
        app.

````

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