> For the complete documentation index, see [llms.txt](https://docs.pyck.cloud/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.pyck.cloud/graphql-api/mutations/createreceivinginbounditem.md).

# Create Receiving Inbound Item

createReceivingInboundItem Mutation

Creates a new receiving inbound item and associates it with an existing receiving inbound order. This allows adding individual items to a receiving order after it has been created.

## Arguments

| Name    | Type                               | Description                                        |
| ------- | ---------------------------------- | -------------------------------------------------- |
| `input` | `CreateReceivingInboundItemInput!` | Input data for creating the receiving inbound item |

## Return Type

`ReceivingInboundItemOutput` - Contains the created receiving inbound item and any associated workflows.

## Input Fields

`CreateReceivingInboundItemInput`:

| Field          | Type      | Description                                                            |
| -------------- | --------- | ---------------------------------------------------------------------- |
| `dataTypeID`   | `UUID`    | Optional data type ID for custom validation                            |
| `dataTypeSlug` | `String`  | Optional data type slug for custom validation                          |
| `data`         | `Map`     | Custom data associated with the inbound item                           |
| `sku`          | `String!` | Required stock keeping unit (SKU) of the item                          |
| `quantity`     | `Int!`    | Required quantity of the item being received                           |
| `inboundID`    | `ID!`     | Required ID of the receiving inbound order to associate this item with |

## Usage Example

```graphql
mutation {
  createReceivingInboundItem(
    input: {
      sku: "COMPONENT-789",
      quantity: 25,
      inboundID: "550e8400-e29b-41d4-a716-446655440000",
      data: {
        "lot_number": "LOT-2024-001",
        "expiration_date": "2025-12-31",
        "condition": "new",
        "supplier_batch": "BATCH-456",
        "quality_check_required": true
      }
    }
  ) {
    receivingInboundItem {
      id
      sku
      quantity
      data
      createdAt
      inbound {
        id
        supplierID
        orderID
      }
    }
    workflows {
      id
      type
      id
      runID
      status
    }
  }
}
```

## JavaScript Example

```javascript
const createReceivingInboundItemMutation = `
  mutation CreateReceivingInboundItem($input: CreateReceivingInboundItemInput!) {
    createReceivingInboundItem(input: $input) {
      receivingInboundItem {
        id
        sku
        quantity
        data
        createdAt
        inbound {
          id
          supplierID
          orderID
        }
      }
      workflows {
        id
        type
        id
        runID
        status
      }
    }
  }
`;

const variables = {
  input: {
    sku: "COMPONENT-789",
    quantity: 25,
    inboundID: "550e8400-e29b-41d4-a716-446655440000",
    data: {
      lot_number: "LOT-2024-001",
      expiration_date: "2025-12-31",
      condition: "new",
      supplier_batch: "BATCH-456",
      quality_check_required: true
    }
  }
};

// Using fetch or your preferred GraphQL client
const response = await fetch('/graphql', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    'Authorization': 'Bearer YOUR_TOKEN'
  },
  body: JSON.stringify({
    query: createReceivingInboundItemMutation,
    variables: variables
  })
});

const result = await response.json();
console.log('Created receiving inbound item:', result.data.createReceivingInboundItem);
```

## Batch Creation Example

You can create multiple inbound items for the same order:

```javascript
const items = [
  {
    sku: "COMPONENT-789",
    quantity: 25,
    data: { lot_number: "LOT-2024-001", condition: "new" }
  },
  {
    sku: "COMPONENT-790",
    quantity: 50,
    data: { lot_number: "LOT-2024-002", condition: "new" }
  },
  {
    sku: "COMPONENT-791",
    quantity: 10,
    data: { lot_number: "LOT-2024-003", condition: "damaged", quality_check_required: true }
  }
];

const inboundID = "550e8400-e29b-41d4-a716-446655440000";

const createResults = await Promise.all(
  items.map(async (item) => {
    const response = await fetch('/graphql', {
      method: 'POST',
      headers: {
        'Content-Type': 'application/json',
        'Authorization': 'Bearer YOUR_TOKEN'
      },
      body: JSON.stringify({
        query: createReceivingInboundItemMutation,
        variables: {
          input: {
            ...item,
            inboundID
          }
        }
      })
    });
    
    const result = await response.json();
    return result.data.createReceivingInboundItem;
  })
);

console.log('Batch creation results:', createResults);
```

## Notes

* The specified `inboundID` must exist and be accessible to the current user
* The `sku` should correspond to an expected inventory item
* The `quantity` must be a positive integer
* Custom `data` can include tracking information like lot numbers, expiration dates, condition, etc.
* Associated workflows may be automatically triggered based on system configuration (e.g., quality checks, inventory updates)
* The operation may fail if the receiving inbound order is already in a non-editable state
* Consider including relevant receiving information in the `data` field for tracking and compliance
* This mutation is typically used in receiving workflows when items arrive in shipments


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.pyck.cloud/graphql-api/mutations/createreceivinginbounditem.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
