> 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/types/transaction.md).

# Transaction

Transaction Type

Represents an inventory transaction - a record of stock changes resulting from executed movements.

## Fields

| Field          | Type               | Description                                                    |
| -------------- | ------------------ | -------------------------------------------------------------- |
| `id`           | `ID!`              | Unique identifier of the transaction                           |
| `tenantID`     | `UUID!`            | Tenant identifier                                              |
| `createdAt`    | `Time!`            | Creation timestamp                                             |
| `createdBy`    | `UUID!`            | User identifier who created the transaction                    |
| `updatedAt`    | `Time`             | Last update timestamp                                          |
| `updatedBy`    | `UUID!`            | User identifier who last updated the transaction               |
| `deletedAt`    | `Time`             | Deletion timestamp                                             |
| `deletedBy`    | `UUID!`            | User identifier who deleted the transaction                    |
| `itemID`       | `UUID!`            | ID of the inventory item                                       |
| `repositoryID` | `UUID!`            | ID of the repository                                           |
| `quantity`     | `Int!`             | Quantity change (positive for incoming, negative for outgoing) |
| `type`         | `TransactionType!` | Type of transaction                                            |
| `movementID`   | `UUID`             | ID of the movement that created this transaction               |
| `referenceID`  | `UUID`             | Reference to related entity (order, adjustment, etc.)          |
| `data`         | `Map`              | Custom data associated with the transaction                    |
| `item`         | `InventoryItem`    | The inventory item                                             |
| `repository`   | `Repository`       | The repository                                                 |
| `movement`     | `ItemMovement`     | The movement that created this transaction                     |

## Interfaces

* `Node`

## Transaction Types

The `TransactionType` enum indicates the nature of the transaction:

* Stock increases (positive quantity)
* Stock decreases (negative quantity)
* Adjustments and corrections

## Usage Example

```graphql
query {
  # Get all transactions for an item in the last 24 hours
  transactions(
    where: {
      itemID: "item-123",
      createdAt_GTE: "2024-01-14T00:00:00Z"
    },
    orderBy: { direction: DESC, field: CREATED_AT }
  ) {
    edges {
      node {
        id
        quantity
        type
        createdAt
        repository {
          name
        }
        item {
          sku
        }
        movement {
          id
          fromRepositoryID
          toRepositoryID
        }
      }
    }
  }
}
```

## Notes

* Transactions are immutable audit records
* Created automatically when movements are executed
* Positive quantity = stock increase, negative = decrease
* Enable time-travel queries for historical stock levels


---

# 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/types/transaction.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.
