> ## 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.

# Release a draft build

> It takes the released revision of its item's BOM and keeps the parts
list that revision gives for its quantity, so later BOM changes do
not move it. It is refused, in plain words, when the item has no
released BOM. Emits manufacturing.build.released. Needs the
`manufacturing.builds.manage` permission and a token with
`manufacturing:write`.



## OpenAPI

````yaml /openapi.json post /manufacturing/builds/{build}/release
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:
  /manufacturing/builds/{build}/release:
    post:
      tags:
        - Builds
      summary: Release a draft build
      description: |-
        It takes the released revision of its item's BOM and keeps the parts
        list that revision gives for its quantity, so later BOM changes do
        not move it. It is refused, in plain words, when the item has no
        released BOM. Emits manufacturing.build.released. Needs the
        `manufacturing.builds.manage` permission and a token with
        `manufacturing:write`.
      operationId: v1.manufacturing.builds.release
      parameters:
        - name: build
          in: path
          required: true
          schema:
            type: string
      responses:
        '200':
          description: '`BuildResource`'
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    $ref: '#/components/schemas/BuildResource'
                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'
        '404':
          $ref: '#/components/responses/ModelNotFoundException'
        '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("/manufacturing/builds/{build}/release", {
              path: { build: "01J8QZ4M..." },
            });
components:
  schemas:
    BuildResource:
      type: object
      properties:
        id:
          type: string
        number:
          type: string
          description: Such as MO-00001, numbered per organization.
        status:
          type: string
          description: draft, released, in_progress, completed, cancelled or reversed.
        item_id:
          type: string
        item_sku:
          type: string
        item_name:
          type: string
        quantity:
          type: string
          description: How many to build, in the item's base unit.
        unit:
          type: string
          description: The item's base unit.
        location_id:
          type: string
        location_code:
          type: string
        location_name:
          type: string
        due_on:
          type:
            - string
            - 'null'
          description: Y-m-d.
        note:
          type:
            - string
            - 'null'
        revision_label:
          type:
            - string
            - 'null'
          description: >-
            The BOM revision the parts list comes from, such as A; null for a
            draft whose item has no released BOM.
        parts_list_fixed:
          type: boolean
          description: >-
            Whether the parts list was fixed on release; a draft's follows the
            BOM until then.
        blocked:
          type:
            - string
            - 'null'
          description: Why a draft cannot be released, in plain words; null when it can.
        lines:
          type: array
          description: The parts list, line by line.
          items:
            $ref: '#/components/schemas/BuildLineResource'
        released_at:
          type:
            - string
            - 'null'
        cancelled_at:
          type:
            - string
            - 'null'
        created_at:
          type: string
        updated_at:
          type: string
        can_complete:
          type: boolean
          description: Whether the reader may complete builds.
        can_issue:
          type: boolean
          description: >-
            Whether the reader may issue parts in steps: the plan records
            consumption and they may complete builds.
        issues:
          type: array
          description: The parts issued so far, step by step, oldest first.
          items:
            $ref: '#/components/schemas/BuildIssueResource'
        output:
          anyOf:
            - $ref: '#/components/schemas/BuildOutputResource'
              description: What it made, once completed; null before.
            - type: 'null'
        currency:
          type: string
          description: The currency costs are in, such as USD.
        started_at:
          type:
            - string
            - 'null'
          description: When parts were first issued to it.
        can_trace:
          type: boolean
          description: >-
            Whether the reader may trace what it made: the plan traces genealogy
            and they may.
        operations:
          type: array
          description: >-
            Its operations in sequence, copied from its revision's routing on
            release on a plan with routings.
          items:
            $ref: '#/components/schemas/BuildOperationResource'
        problems:
          type: array
          description: The problems reported on it, open ones first, newest first.
          items:
            $ref: '#/components/schemas/BuildProblemResource'
        can_run_operations:
          type: boolean
          description: Whether the reader may start, pause and finish operations.
        can_manage:
          type: boolean
          description: >-
            Whether the reader may manage builds, which closes problems and
            corrects time.
        priority:
          type: string
          description: >-
            high, normal or low: which build goes first when builds due the same
            day share a work center.
        planned_start_on:
          type:
            - string
            - 'null'
          description: >-
            Y-m-d: the first day scheduling planned its operations for; null
            until it is scheduled.
        planned_finish_on:
          type:
            - string
            - 'null'
          description: 'Y-m-d: the day scheduling planned its last operation to finish.'
        late:
          type: boolean
          description: Whether it is planned to finish after it is due.
        costs:
          anyOf:
            - $ref: '#/components/schemas/BuildCostResource'
              description: >-
                Its estimated cost against its actual cost; null unless the plan
                costs jobs and the reader has `inventory.valuation.view`.
            - type: 'null'
        can_print_labels:
          type: boolean
          description: >-
            Whether the reader may print labels for the units it makes: it is
            released or later, and they have `labels.print`.
      required:
        - id
        - number
        - status
        - item_id
        - item_sku
        - item_name
        - quantity
        - unit
        - location_id
        - location_code
        - location_name
        - due_on
        - note
        - revision_label
        - parts_list_fixed
        - blocked
        - lines
        - released_at
        - cancelled_at
        - created_at
        - updated_at
        - can_complete
        - can_issue
        - issues
        - output
        - currency
        - started_at
        - can_trace
        - operations
        - problems
        - can_run_operations
        - can_manage
        - priority
        - planned_start_on
        - planned_finish_on
        - late
        - costs
        - can_print_labels
      title: BuildResource
    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
    BuildLineResource:
      type: object
      properties:
        position:
          type: string
          description: >-
            The BOM line's position, or the positions down through phantoms,
            such as "20/10".
        component_id:
          type: string
        component_sku:
          type:
            - string
            - 'null'
          description: Null when the reader may not see the component.
        component_name:
          type:
            - string
            - 'null'
        required:
          type: string
          description: What the build takes, scrap included.
        unit:
          type: string
          description: The component's base unit.
        available:
          type:
            - string
            - 'null'
          description: >-
            Available at the build's location; null when the reader may not see
            the component.
        short:
          type:
            - string
            - 'null'
          description: >-
            What is missing; 0 when nothing is. Once released, what neither the
            build's holds nor stock left to promise cover of what it still has
            to issue. Null when the reader may not see the component.
        explanation:
          type:
            - string
            - 'null'
          description: >-
            Why the part is short, in plain words, such as "Short 3 M4-10.
            PO-00002 brings 10 on 2026-11-20."; null when nothing is short.
        open_orders:
          type: array
          description: >-
            Open purchase orders that bring more to the build's location,
            soonest first.
          items:
            $ref: '#/components/schemas/BuildOrderResource'
        alternates:
          type: array
          description: What could stand in for the component, by rank.
          items:
            $ref: '#/components/schemas/BuildAlternateResource'
        id:
          type:
            - string
            - 'null'
          description: >-
            The parts list line, which parts are issued against; null for a
            draft, whose parts list is not fixed yet.
        held:
          type:
            - string
            - 'null'
          description: Held for the build at its location; null for a draft.
        issued:
          type:
            - string
            - 'null'
          description: >-
            Issued so far, with alternates counted as the component they stand
            in for; null for a draft.
        variance:
          type:
            - string
            - 'null'
          description: >-
            Issued less required: above zero for an overrun, below for a
            shortfall. Null for a draft, and for a line nothing is issued for
            yet unless the build was completed.
        variance_reason:
          type:
            - string
            - 'null'
          description: Why more or less than the parts list was used.
      required:
        - position
        - component_id
        - component_sku
        - component_name
        - required
        - unit
        - available
        - short
        - explanation
        - open_orders
        - alternates
        - id
        - held
        - issued
        - variance
        - variance_reason
      title: BuildLineResource
    BuildIssueResource:
      type: object
      properties:
        step:
          type: integer
          description: From 1; completing issues in a step of its own.
        position:
          type: string
          description: The parts list line it was for, such as "20".
        component_id:
          type: string
        component_sku:
          type:
            - string
            - 'null'
          description: Null when the reader may not see the component.
        alternate_rank:
          type:
            - integer
            - 'null'
          description: >-
            The alternate's rank when one stood in for the line's component;
            null for the component.
        quantity:
          type: string
          description: In the component's base unit.
        lots:
          type: array
          description: The lots it came from, by number.
          items:
            type: string
        serials:
          type: array
          items:
            type: string
        cost:
          type: string
          description: What the stock ledger costed it at, in the organization's currency.
        issued_at:
          type: string
      required:
        - step
        - position
        - component_id
        - component_sku
        - alternate_rank
        - quantity
        - lots
        - serials
        - cost
        - issued_at
      title: BuildIssueResource
    BuildOutputResource:
      type: object
      properties:
        status:
          type: string
          description: 'The status it went into: available or quarantined.'
        lot:
          type:
            - string
            - 'null'
        serials:
          type: array
          items:
            type: string
        cost:
          type: string
          description: The cost of the parts issued, in the organization's currency.
        unit_cost:
          type: string
          description: Per unit made.
        issued_as_recorded:
          type: boolean
          description: Whether completing issued nothing more than the steps recorded.
        completed_at:
          type: string
        reversed_at:
          type:
            - string
            - 'null'
          description: >-
            Set once the build is reversed: its parts went back and its output
            came out.
      required:
        - status
        - lot
        - serials
        - cost
        - unit_cost
        - issued_as_recorded
        - completed_at
        - reversed_at
      title: BuildOutputResource
    BuildOperationResource:
      type: object
      properties:
        id:
          type: string
        sequence:
          type: integer
          description: Its place in the build's operations, as in the routing.
        name:
          type: string
        work_center_id:
          type: string
        work_center_code:
          type: string
        work_center_name:
          type: string
        instructions:
          type:
            - string
            - 'null'
        setup_minutes:
          type: string
          description: Planned minutes to set up, once for the build.
        run_minutes:
          type: string
          description: Planned minutes to run the build's whole quantity.
        status:
          type: string
          description: pending, running, paused or completed.
        started_at:
          type:
            - string
            - 'null'
          description: When the span running now began; null unless it is running.
        started_by_you:
          type: boolean
          description: Whether the reader started the span running now.
        good_quantity:
          type:
            - string
            - 'null'
          description: How many came out good, once it is finished.
        scrap_quantity:
          type:
            - string
            - 'null'
          description: How many were scrapped, once it is finished.
        scrap_reason:
          type:
            - string
            - 'null'
        completed_at:
          type:
            - string
            - 'null'
        worked_minutes:
          type: string
          description: Minutes worked so far, corrections included.
        can_take:
          type: string
          description: >-
            The most it can take: what the operation before it passed on good,
            or the build's quantity for the first.
        blocked:
          type:
            - string
            - 'null'
          description: >-
            Why it cannot be started or resumed now, in plain words; null when
            it can, or when it is running or finished.
        time_records:
          type: array
          description: Its spans of work and their corrections, oldest first.
          items:
            $ref: '#/components/schemas/TimeRecordResource'
        subcontract:
          anyOf:
            - $ref: '#/components/schemas/OperationSubcontractResource'
              description: >-
                The supplier doing it, with its order and where its work stands;
                null when it is done in house.
            - type: 'null'
        checks:
          type: array
          description: >-
            The checks recorded as it finished: each check's id, pass, fail or
            na, and any value and note. A failed check did not stop it.
          items: {}
      required:
        - id
        - sequence
        - name
        - work_center_id
        - work_center_code
        - work_center_name
        - instructions
        - setup_minutes
        - run_minutes
        - status
        - started_at
        - started_by_you
        - good_quantity
        - scrap_quantity
        - scrap_reason
        - completed_at
        - worked_minutes
        - can_take
        - blocked
        - time_records
        - subcontract
        - checks
      title: BuildOperationResource
    BuildProblemResource:
      type: object
      properties:
        id:
          type: string
        operation_id:
          type:
            - string
            - 'null'
          description: The operation it is about; null for the whole build.
        operation:
          type:
            - string
            - 'null'
          description: The operation's sequence and name, such as "20 Solder".
        reason:
          type: string
          description: material, machine, quality, instructions or other.
        note:
          type: string
        has_photo:
          type: boolean
          description: Whether it has a photo, which the photo endpoint links to.
        status:
          type: string
          description: open or closed.
        reported_by_you:
          type: boolean
          description: Whether the reader reported it.
        reported_at:
          type: string
        close_note:
          type:
            - string
            - 'null'
          description: What was done about it, once closed.
        closed_at:
          type:
            - string
            - 'null'
      required:
        - id
        - operation_id
        - operation
        - reason
        - note
        - has_photo
        - status
        - reported_by_you
        - reported_at
        - close_note
        - closed_at
      title: BuildProblemResource
    BuildCostResource:
      type: object
      properties:
        estimate:
          $ref: '#/components/schemas/CostSplitResource'
          description: >-
            The BOM's cost rollup for the build's quantity plus its planned
            minutes at its work centers' rates.
        actual:
          $ref: '#/components/schemas/CostSplitResource'
          description: >-
            The parts issued at ledger cost plus the time recorded at the rates
            in effect then.
        variance:
          $ref: '#/components/schemas/CostSplitResource'
          description: Actual less estimate.
        final:
          type: boolean
          description: >-
            Whether the build is completed, so the actual cost is final; before,
            it is the cost so far.
        standard_unit_cost:
          type:
            - string
            - 'null'
          description: >-
            A standard-cost output's standard per unit, when it was received at
            it.
        standard_variance:
          type:
            - string
            - 'null'
          description: Actual less standard, as recorded on the output's receipt.
      required:
        - estimate
        - actual
        - variance
        - final
        - standard_unit_cost
        - standard_variance
      title: BuildCostResource
    BuildOrderResource:
      type: object
      properties:
        number:
          type: string
          description: Such as PO-00001.
        quantity:
          type: string
          description: Left to receive, in the part's base unit.
        expected_on:
          type:
            - string
            - 'null'
          description: Y-m-d; null when the order has no date.
      required:
        - number
        - quantity
        - expected_on
      title: BuildOrderResource
    BuildAlternateResource:
      type: object
      properties:
        rank:
          type: integer
          description: 1 is tried first.
        component_id:
          type: string
        component_sku:
          type:
            - string
            - 'null'
          description: Null when the reader may not see the component.
        component_name:
          type:
            - string
            - 'null'
        quantity:
          type: string
          description: What the build would take of it instead, scrap included.
        unit:
          type: string
        available:
          type:
            - string
            - 'null'
          description: >-
            Available at the build's location; null when the reader may not see
            the component.
      required:
        - rank
        - component_id
        - component_sku
        - component_name
        - quantity
        - unit
        - available
      title: BuildAlternateResource
    TimeRecordResource:
      type: object
      properties:
        id:
          type: string
        worked_by:
          type:
            - integer
            - 'null'
          description: >-
            Who worked, as a pseudonymous user id that outlives the person's
            erasure.
        you:
          type: boolean
          description: Whether the reader worked it.
        work_center_code:
          type: string
        started_at:
          type: string
        ended_at:
          type: string
        minutes:
          type: string
          description: >-
            Minutes counted, to the hundredth; negative on a correction that
            takes time back.
        corrects_id:
          type:
            - string
            - 'null'
          description: The record this one corrects; null on a span of work.
        created_at:
          type: string
      required:
        - id
        - worked_by
        - you
        - work_center_code
        - started_at
        - ended_at
        - minutes
        - corrects_id
        - created_at
      title: TimeRecordResource
    OperationSubcontractResource:
      type: object
      properties:
        supplier_id:
          type: string
        supplier_name:
          type:
            - string
            - 'null'
        service_item_id:
          type: string
        service_sku:
          type:
            - string
            - 'null'
          description: Null when the reader may not see the service.
        service_name:
          type:
            - string
            - 'null'
        unit_price:
          type: string
          description: The order's price per base unit of the service.
        purchase_order_id:
          type:
            - string
            - 'null'
          description: The draft purchase order raised for it when the build was released.
        purchase_order_number:
          type:
            - string
            - 'null'
        sent:
          type: boolean
          description: Whether its parts were sent to the supplier's location.
        returned:
          type: boolean
          description: Whether they came back, once its order was received in full.
        cost:
          type: string
          description: >-
            What was received of the work so far, at its price: part of the
            build's actual cost.
        send_blocked:
          type:
            - string
            - 'null'
          description: >-
            Why its parts cannot be sent now, in plain words; null when they can
            or went already.
        order_status:
          type:
            - string
            - 'null'
          description: >-
            draft, approved, sent, partially_received, received, closed or
            cancelled; null when it has none.
        notice:
          type:
            - string
            - 'null'
          description: >-
            What happened to its order and what to do, in plain words, once it
            was cancelled or closed before the work was done.
        can_bring_back:
          type: boolean
          description: Whether its parts can be brought back from the supplier now.
        can_reorder:
          type: boolean
          description: Whether a new order can be raised for what it still has to take.
      required:
        - supplier_id
        - supplier_name
        - service_item_id
        - service_sku
        - service_name
        - unit_price
        - purchase_order_id
        - purchase_order_number
        - sent
        - returned
        - cost
        - send_blocked
        - order_status
        - notice
        - can_bring_back
        - can_reorder
      title: OperationSubcontractResource
    CostSplitResource:
      type: object
      properties:
        parts:
          type:
            - string
            - 'null'
        labor:
          type:
            - string
            - 'null'
        overhead:
          type:
            - string
            - 'null'
        total:
          type:
            - string
            - 'null'
        subcontract:
          type:
            - string
            - 'null'
          description: The work suppliers did on it.
      required:
        - parts
        - labor
        - overhead
        - total
        - subcontract
      title: CostSplitResource
  responses:
    AuthenticationException:
      description: Unauthenticated
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ProblemDetails'
    AuthorizationException:
      description: Forbidden
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ProblemDetails'
    ModelNotFoundException:
      description: Not found
      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

- [Draft a build](https://docs.stockshift.io/api-reference/builds/draft-a-build.md)
- [Release a draft revision of a BOM](https://docs.stockshift.io/api-reference/boms/release-a-draft-revision-of-a-bom.md)
- [Change a draft build](https://docs.stockshift.io/api-reference/builds/change-a-draft-build.md)


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