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

# Approve an automation run

> Approves a run waiting for you, with a note if you write one. The run
carries on as the person who published its version, never as you.
Only the named member or a holder of the named role may, and not the
person who started the run or caused its trigger unless your
organization allows it. Two answers at once give one; the other is
refused. Needs the `automation.approvals.respond` permission, the Growth
plan or higher and a token with `automation:write`.



## OpenAPI

````yaml /openapi.json post /automation/approvals/{approval}/approve
openapi: 3.1.2
info:
  title: StockShift API
  version: 1.0.0
  description: >-
    The StockShift REST API. Start with the guides for authentication, scopes,
    pagination, errors and webhooks.
servers:
  - url: https://app.stockshift.io/api/v1
    description: Production
  - url: https://app.beta.stockshift.io/api/v1
    description: Beta
security:
  - apiKey: []
  - oauth2: []
tags:
  - name: Witnessed stock actions
    description: >-
      Hold a stock action for a second person, who recounts blind and signs, and
      read both signatures. Stock changes only once the witness signs.
  - name: Item stock
    description: >-
      Everything about one item's stock: where it is, what is promised, how it
      is tracked and what it costs.
  - name: Transfers
    description: >-
      Move stock from one location to another, with time in transit between
      shipping and receiving.
  - name: Landed costs
    description: >-
      Add freight, duty and other charges to the cost of stock you have
      received.
  - name: Stock counts
    description: >-
      Count what is on the shelf, compare it with what StockShift expects and
      post the difference once someone approves it.
  - name: Locations
    description: >-
      The warehouses, rooms and bins stock is kept in. Most stock calls need a
      location ID from here.
  - name: Periods
    description: >-
      Close each month once it is reported: lock what is dated in it, check
      nothing is left open and keep the stock value at its end.
  - name: Inventory imports
    description: >-
      Load opening stock from a CSV file, with a preview before anything is
      posted.
  - name: Release requests
    description: >-
      Ask QA to release stock that is on hold, and decline or withdraw the
      request. Releasing the stock closes it.
  - name: Signers
    description: >-
      Who may sign witnessed stock actions: whose identity was checked, how and
      when, and the failed signings reviewers must see.
  - name: Stock
    description: >-
      How much of each item is where. Read levels, now or at a past date, and
      post adjustments when stock is found, lost or damaged.
  - name: Witnessing rules
    description: >-
      Which stock actions wait for a second person to recount and sign, such as
      removing a controlled substance.
  - name: Allocation rules
    description: >-
      Which lots are picked first when stock is reserved or shipped, such as
      first expiry first out.
  - name: Inventory settings
    description: >-
      How the organization handles stock, such as whether stock may go negative
      and how it is costed.
  - name: Lots
    description: Batches of stock that share a lot number, and when they expire.
  - name: Movements
    description: >-
      The ledger behind every stock level. Movements are never edited; you
      correct one by reversing it.
  - name: Serial numbers
    description: Individually tracked units, and where each one is now.
  - name: Stock moves
    description: >-
      Move stock from one location to another in one step, such as from a dock
      to a shelf, and undo a move whole.
  - name: Bulk previews
    description: >-
      Check a list of stock lines before a bulk move, adjustment, hold or print,
      and see what each line needs decided.
  - name: Items
    description: >-
      The products and materials you stock, buy, make or sell. An item's ID or
      SKU is what most other endpoints ask for.
  - name: Families
    description: >-
      Groups of items that differ only by options such as size or color, and the
      variants made from them.
  - name: Catalog imports
    description: >-
      Create or update items from a CSV file, with a preview before anything is
      saved.
  - name: Custom fields
    description: >-
      Extra fields the organization adds to its items. Define them here, then
      set their values on each item.
  - name: Product library
    description: >-
      Look up a product by its GTIN and create an item from what the library
      knows about it.
  - name: Units
    description: >-
      Units of measure, such as each, box or kg. Items count in one base unit
      and convert from the others.
  - name: Scanning
    description: Turn a scanned barcode into the item, unit or labeled piece it identifies.
  - name: Suppliers
    description: >-
      The companies you buy from, the people you deal with there and what they
      charge you.
  - name: Purchase orders
    description: >-
      Orders to suppliers. Draft one, approve it, send it and receive the goods
      against it.
  - name: Purchasing imports
    description: Load suppliers and their catalogs from CSV files.
  - name: Purchasing settings
    description: >-
      How the organization buys, such as the approval threshold and how far a
      receipt may go over the order.
  - name: Receipts
    description: >-
      Goods received against purchase orders. Reverse a receipt to correct it,
      or print labels for what came in.
  - name: Item suppliers
    description: Which suppliers sell an item, and at what price.
  - name: Purchasing exports
    description: >-
      Download suppliers or their catalogs as CSV, in the same columns the
      import reads.
  - name: Sales orders
    description: >-
      Customer orders. Take one as a draft, confirm it to hold stock, then ship
      it and invoice it.
  - name: Customers
    description: The companies you sell to and the people you deal with there.
  - name: Invoices
    description: Bills for what you have sold, and the payments recorded against them.
  - name: Price lists
    description: >-
      The prices a customer pays, with quantity breaks. Give a customer a price
      list and their orders price themselves.
  - name: Quotes
    description: Offers to customers. An accepted quote becomes a sales order.
  - name: Tax rates
    description: The sales tax rates invoices are charged at.
  - name: Sales imports
    description: Load customers and price lists from CSV files.
  - name: Returns
    description: >-
      Goods customers send back: authorize the return, then receive it into
      stock and credit it.
  - name: Shipments
    description: What left the building for each sales order.
  - name: Sales settings
    description: >-
      How the organization sells, such as when stock is reserved and whether
      invoices can go out before shipping.
  - name: Certificates of conformance
    description: >-
      Signed certificates that the goods on a shipment conform to the order,
      kept exactly as they were signed.
  - name: Prices
    description: >-
      Ask what a customer would pay for a quantity of an item before you put it
      on an order.
  - name: Sales exports
    description: >-
      Download customers and price lists as CSV, in the same columns the import
      reads.
  - name: Builds
    description: >-
      Orders to make something. Release a build to the floor, issue its parts
      and complete it into stock.
  - name: Repairs
    description: >-
      Repairs of units customers send back: check the warranty, record the parts
      put in and taken out, then complete the repair or bill it.
  - name: Routings
    description: The steps a build goes through and the work center each step runs at.
  - name: Work centers
    description: The machines, cells or teams where the steps of a routing are done.
  - name: Warranty terms
    description: >-
      How long an item is under warranty and whether it counts from shipment or
      build, with terms of their own for some customers.
  - name: Genealogy
    description: >-
      Trace a lot or serial number back to what went into it, or forward to what
      it went into.
  - name: Manufacturing settings
    description: >-
      How the organization builds, such as whether operations may overlap and
      the status finished goods go into.
  - name: Scheduling
    description: Plan open builds onto working days.
  - name: Cost variances
    description: Where a completed build cost more or less than its standard cost.
  - name: BOMs
    description: >-
      Bills of materials: the parts and quantities that go into an item, kept as
      revisions.
  - name: Engineering changes
    description: >-
      Change orders that propose new BOM revisions and release them once
      approved.
  - name: Engineering imports
    description: Load bills of materials from a CSV file or a CAD export.
  - name: Engineering settings
    description: >-
      How the organization manages engineering changes, such as how many
      approvals a change order needs.
  - name: Engineering exports
    description: Download bills of materials as CSV, in the same columns the import reads.
  - name: Where used
    description: Find every BOM an item appears in, before you change or retire it.
  - name: Inspection plans
    description: >-
      What to check, on which items and how many: the characteristics, sampling
      and inspection point of each plan.
  - name: Inspections
    description: >-
      Inspections opened by receipts, operations and builds. Record their
      results to pass or fail the stock they hold.
  - name: Forecasts
    description: >-
      Expected demand for each item, week by week, and the changes planners make
      to it.
  - name: Scenarios
    description: Copies of the forecast to try out changes without touching the real plan.
  - name: Demand
    description: Past demand for an item at a location, which the forecasts are built from.
  - name: Suggestions
    description: >-
      What the plan says to buy or build. Accept one to raise the purchase order
      or build, or dismiss it.
  - name: Replenishment
    description: >-
      How each item is kept in stock at each location: reorder points, minimums
      and maximums or periodic review.
  - name: Holidays
    description: >-
      Days the organization does not work, which the plan skips when it counts
      lead times.
  - name: Planning settings
    description: >-
      How the organization plans, such as the forecast horizon and service
      level.
  - name: Automations
    description: >-
      Rules that run steps when something happens or on a schedule. Edit the
      draft, then publish it to turn it on.
  - name: Runs
    description: >-
      Each time an automation ran: what started it, what each step did and where
      it failed.
  - name: Approvals
    description: Runs paused for a person to approve or reject before they carry on.
  - name: Automation settings
    description: >-
      Organization-wide limits on automations, such as runs a minute and whether
      someone may approve their own run.
  - name: Automation templates
    description: Ready-made automations to start from.
  - name: Events
    description: >-
      The events an automation can be triggered by, and the data each one
      carries.
  - name: Step catalog
    description: Every step an automation can use and the inputs each one takes.
  - name: Views
    description: >-
      Saved reports: the dataset, filters, grouping and chart someone set up,
      ready to run again.
  - name: Dashboards
    description: Pages of charts and KPIs laid out on a grid.
  - name: Datasets
    description: >-
      The data you can report on and the fields in each. Start here to build a
      report.
  - name: Schedules
    description: >-
      Send a report by email on a schedule, or alert someone when a value
      crosses a threshold.
  - name: KPIs
    description: Single numbers worth watching, defined as a formula over a dataset.
  - name: View folders
    description: Folders that keep saved views organized.
  - name: Insights exports
    description: >-
      Export a report to a file. Large exports run in the background and are
      ready to download later.
  - name: Report templates
    description: Ready-made reports, such as stock aging, to start a view from.
  - name: Reports
    description: >-
      Run a report definition and get its rows or its chart back, without saving
      it first.
  - name: Dashboard
    description: >-
      The figures on the app's home screen, if you want to show the same numbers
      elsewhere.
  - name: Dashboard templates
    description: Ready-made dashboards to start from.
  - name: Formulas
    description: >-
      Check a formula against a dataset before you save it in a KPI or a
      calculated field.
  - name: Connections
    description: >-
      Connected accounts in other systems, what each one syncs and the history
      of its sync runs.
  - name: Shipping
    description: >-
      Carrier rates, the labels bought for orders and returns, and the scans
      that track each parcel.
  - name: Sourcing
    description: >-
      Distributor part prices and stock: search a connected distributor, link
      items to its parts and price a BOM revision.
  - name: Tax addresses
    description: The addresses a connected tax service taxes each sale by, checked with it.
  - name: Connectors
    description: The systems StockShift can connect to, and what each connector can sync.
  - name: Label sets
    description: Every batch of labels printed, so you can find it again and reprint it.
  - name: Label templates
    description: The layouts labels are printed with.
  - name: Pieces
    description: >-
      Look up a labeled piece from the code on its label: the item, lot or
      serial and how much it holds.
  - name: Branding and templates
    description: >-
      The logo, colors, terms and custom fields every quote, purchase order,
      invoice and packing slip prints with.
  - name: Mobile apps
    description: >-
      How the StockShift mobile apps enroll a device, sign in and stay in step
      with the server.
  - name: Devices
    description: >-
      The phones and scanners enrolled in the organization. Lock a lost one,
      wipe it or retire it.
  - name: Scanner setup
    description: >-
      Printable sheets of barcodes that configure a hardware scanner, and each
      person's scanner preferences.
  - name: Enrollments
    description: Make the QR codes that enroll shared devices and kiosks.
  - name: Sync feeds
    description: >-
      Download a snapshot of the data a device needs, then pull the changes
      since.
  - name: Sync commands
    description: >-
      Send the changes a device made while offline. Each command is applied
      once, however often it is sent.
  - name: Sync files
    description: Download the files, such as item images, that a feed points to.
  - name: Profile
    description: >-
      The signed-in person's own account: their details, password, passkeys,
      second factor and sessions.
  - name: Notifications
    description: >-
      The signed-in member's inbox: what needs them, what is unread, and what
      they are told about and how.
  - name: Invitations
    description: Invite people to join the organization, and accept an invitation.
  - name: Roles
    description: Roles and the permissions in each. A member can do what their roles allow.
  - name: Staff access
    description: >-
      Requests from StockShift support to look at the organization's data, which
      an owner must grant.
  - name: Team
    description: The people in the organization and the roles they hold.
  - name: API keys
    description: Create and revoke the keys scripts and integrations use to call this API.
  - name: Organizations
    description: The organizations the signed-in person belongs to.
  - name: Signatures
    description: >-
      Some actions need an electronic signature. Get a signing token here and
      send it with the call.
  - name: Registration
    description: Sign up for a new account and organization.
  - name: Organization
    description: >-
      Organization-wide policy: how long records are kept, session rules, legal
      holds and closing the organization down.
  - name: Address
    description: The billing address that appears on the organization's invoices.
  - name: History
    description: Who changed which field of a record, when and from what.
  - name: Destruction certificates
    description: Check that a certificate of data destruction is genuine.
  - name: Billing
    description: >-
      Check or change the plan, buy run packs for automations, see invoices and
      update the payment method.
  - name: Webhooks
    description: >-
      Register URLs to be told when things happen, and see each delivery and its
      response.
  - name: OAuth apps
    description: >-
      Third-party apps members have connected through OAuth. Revoke one to cut
      off its access.
  - name: REST hooks
    description: >-
      For connected apps such as Zapier: subscribe one event to a URL, and
      unsubscribe it.
  - name: MCP server
    description: >-
      Let an AI assistant work in StockShift through the Model Context Protocol,
      with the same permissions as the member who connects it.
  - name: Recent events
    description: >-
      The latest events of a type, as deliveries send them, to poll or to use as
      samples.
  - name: Webhook events
    description: Every event webhooks and REST hooks can send, with the shape of its data.
paths:
  /automation/approvals/{approval}/approve:
    post:
      tags:
        - Approvals
      summary: Approve an automation run
      description: |-
        Approves a run waiting for you, with a note if you write one. The run
        carries on as the person who published its version, never as you.
        Only the named member or a holder of the named role may, and not the
        person who started the run or caused its trigger unless your
        organization allows it. Two answers at once give one; the other is
        refused. Needs the `automation.approvals.respond` permission, the Growth
        plan or higher and a token with `automation:write`.
      operationId: v1.automation.approvals.approve
      parameters:
        - name: approval
          in: path
          required: true
          schema:
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/AnswerApprovalRequest'
      responses:
        '200':
          description: '`AnsweredApprovalResource`'
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    $ref: '#/components/schemas/AnsweredApprovalResource'
                required:
                  - data
          headers:
            X-RateLimit-Limit:
              description: >-
                Requests a minute allowed for this token, or for the address
                without one.
              schema:
                type: integer
            X-RateLimit-Remaining:
              description: Requests left this minute.
              schema:
                type: integer
        '401':
          $ref: '#/components/responses/AuthenticationException'
        '403':
          $ref: '#/components/responses/AuthorizationException'
        '422':
          $ref: '#/components/responses/ValidationException'
        '429':
          description: Too many requests
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
          headers:
            Retry-After:
              description: Seconds until the limit resets.
              schema:
                type: integer
            X-RateLimit-Limit:
              description: Requests a minute allowed.
              schema:
                type: integer
            X-RateLimit-Remaining:
              description: 'Requests left this minute: none.'
              schema:
                type: integer
      x-codeSamples:
        - lang: typescript
          label: TypeScript SDK
          source: >-
            import { StockShift } from "@stockshift/sdk";


            const stockshift = new StockShift({ token:
            process.env.STOCKSHIFT_TOKEN! });


            const result = await
            stockshift.post("/automation/approvals/{approval}/approve", {
              path: { approval: "01J8QZ4M..." },
              body: {},
            });
components:
  schemas:
    AnswerApprovalRequest:
      type: object
      description: An answer to an approval, with a note if the person writes one.
      properties:
        note:
          type:
            - string
            - 'null'
          description: >-
            Why, in up to 2000 characters, kept with the answer and shown on the
            run.
          maxLength: 2000
      title: AnswerApprovalRequest
    AnsweredApprovalResource:
      type: object
      properties:
        id:
          type: string
        run_id:
          type: string
        automation_id:
          type: string
        step:
          type: integer
          description: The approval step's number, from 1.
        status:
          type: string
          description: approved or rejected.
          enum:
            - pending
            - approved
            - rejected
            - timed_out
            - cancelled
        answered_at:
          type:
            - string
            - 'null'
        note:
          type:
            - string
            - 'null'
          description: Why, as the person who answered wrote it.
      required:
        - id
        - run_id
        - automation_id
        - step
        - status
        - answered_at
        - note
      title: AnsweredApprovalResource
    ProblemDetails:
      type: object
      properties:
        type:
          type: string
          format: uri
          description: Links to the documentation for this code.
        title:
          type: string
          description: The HTTP status text.
        status:
          type: integer
          description: The HTTP status code.
        code:
          type: string
          description: A stable machine readable name, such as validation_failed.
        detail:
          type: string
          description: What went wrong, for people.
        errors:
          type: object
          description: >-
            Errors by field. On validation_failed, and on a refusal with a code
            of its own such as insufficient_stock or document_closed.
          additionalProperties:
            type: array
            items:
              type: string
        feature:
          type: string
          description: The plan feature needed. Only on plan_upgrade_required.
        reason:
          type: string
          description: Why a device must download a feed again. Only on resync_required.
        attempts_left:
          type: integer
          description: >-
            How many refused signatures are left before the member is locked on
            the device. Only on signature_assertion_invalid.
        rule_ids:
          type: array
          description: >-
            The witnessing rules that cover the stock. Only on
            verification_required.
          items:
            type: string
        witness:
          type: string
          description: >-
            Where the witness signs: same_device, remote or either. Only on
            verification_required.
        blind_recount:
          type: boolean
          description: >-
            Whether the witness recounts before seeing the quantity. Only on
            verification_required.
        flags:
          type: array
          description: >-
            The flags a bulk line's decisions leave open, as the bulk preview
            names them. Only on decision_required.
          items:
            type: object
            properties:
              flag:
                type: string
              facts:
                type: object
                description: >-
                  The facts of the flag, as in the bulk preview; the others are
                  null.
                additionalProperties:
                  anyOf:
                    - type: string
                    - type: integer
                    - type: array
                      items:
                        type: string
                    - type: 'null'
              choices:
                type: array
                items:
                  type: string
            required:
              - flag
              - facts
              - choices
      required:
        - type
        - title
        - status
        - code
        - detail
      title: ProblemDetails
  responses:
    AuthenticationException:
      description: Unauthenticated
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ProblemDetails'
    AuthorizationException:
      description: Forbidden
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ProblemDetails'
    ValidationException:
      description: Validation error
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ProblemDetails'
  securitySchemes:
    apiKey:
      type: http
      description: >-
        For your own scripts and server-to-server integrations. Create a key in
        the app under Settings > Access > API keys and copy it then, because it
        is shown once. Send it as `Authorization: Bearer <key>`. The key acts as
        the member who made it, in the organization it was made in. A call needs
        the member's permission and one of the key's scopes, such as
        `inventory:read` or `sales:write`. A key with `*` has every scope.
      scheme: bearer
    oauth2:
      type: oauth2
      description: >-
        For apps that other people connect to their StockShift account. Use the
        OAuth 2.1 authorization code flow with PKCE (S256); there is no client
        secret. Discover the endpoints at
        `/.well-known/oauth-authorization-server` (RFC 8414) and register your
        app at `POST /oauth/register` (RFC 7591). The member chooses the
        organization and approves the scopes on the consent page, and the token
        can never do more than the member could. Send it as `Authorization:
        Bearer <token>`, as you would an API key. Access tokens last an hour;
        each refresh returns a new refresh token, so store it.
      flows:
        authorizationCode:
          authorizationUrl: https://app.stockshift.io/oauth/authorize
          tokenUrl: https://app.stockshift.io/oauth/token
          refreshUrl: https://app.stockshift.io/oauth/token
          scopes:
            access:read: Access read
            audit:read: Audit read
            address:read: Address read
            address:write: Address write
            billing:read: Billing read
            catalog:read: Catalog read
            catalog:write: Catalog write
            dashboard:read: Dashboard read
            dashboard:write: Dashboard write
            developer:read: Developer read
            developer:write: Developer write
            devices:read: Devices read
            devices:write: Devices write
            documents:read: Documents read
            documents:write: Documents write
            notifications:read: Notifications read
            notifications:write: Notifications write
            inventory:read: Inventory read
            inventory:write: Inventory write
            purchasing:read: Purchasing read
            purchasing:write: Purchasing write
            quality:read: Quality read
            quality:write: Quality write
            sales:read: Sales read
            sales:write: Sales write
            engineering:read: Engineering read
            engineering:write: Engineering write
            manufacturing:read: Manufacturing read
            manufacturing:write: Manufacturing write
            automation:read: Automation read
            automation:write: Automation write
            insights:read: Insights read
            insights:write: Insights write
            integrations:read: Integrations read
            integrations:write: Integrations write
            labels:read: Labels read
            labels:write: Labels write
            library:read: Library read
            organization:read: Organization read
            organization:write: Organization write
            planning:read: Planning read
            planning:write: Planning write
            sync:read: Sync read
            sync:write: Sync write

````

## Related topics

- [Run an automation now](https://docs.stockshift.io/api-reference/automations/run-an-automation-now.md)
- [Cancel an automation run](https://docs.stockshift.io/api-reference/runs/cancel-an-automation-run.md)
- [List automation runs](https://docs.stockshift.io/api-reference/runs/list-automation-runs.md)


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