Skip to content

Adjustment API

Overview

The Adjustment API allows partners to manage inventory adjustments for stock corrections, including creating adjustments, retrieving adjustment details, and managing approval workflows.

Base URL

  • Production: https://open.bebaskirim.com/api/partner/v1

Authentication

All API requests require authentication using API key and tenant identification:

  • Authorization: API key authentication
  • X-Tenant-Id: Your tenant identifier
bash
curl -H "Authorization: YOUR_API_KEY" \
     -H "X-Tenant-Id: YOUR_TENANT_ID" \
     https://open.bebaskirim.com/api/partner/v1/adjustments

Endpoints

MethodEndpointDescription
POST/api/partner/v1/adjustmentsCreate new adjustment
GET/api/engine/v1/adjustmentsGet adjustment list
GET/api/engine/v1/adjustments/:idGet adjustment detail
PATCH/api/partner/v1/adjustments/:id/approveApprove adjustment
PATCH/api/partner/v1/adjustments/:id/rejectReject adjustment

1. Create Adjustment

Create a new inventory adjustment for stock corrections.

Endpoint: POST /api/partner/v1/adjustments

Headers:

  • Authorization: {token} (required)
  • X-Tenant-Id: {tenant_id} (required)

Request Body:

json
{
  "location_id": 1,
  "type": "increase",
  "stock_source": "good",
  "reason": "Stock correction",
  "items": [
    {
      "product_id": "PROD-2024-001",
      "quantity": 10,
      "unit_cost": 50000,
      "notes": "Additional stock found"
    }
  ]
}

Request Parameters:

ParameterTypeRequiredDescription
location_idintegerYesLocation ID for adjustment
typestringYesAdjustment type: increase or decrease
stock_sourcestringYesStock source: good or damaged
reasonstringYesReason for adjustment
itemsarrayYesArray of adjustment items
items[].product_idstringYesProduct identifier
items[].quantitynumberYesQuantity to adjust
items[].unit_costnumberYesUnit cost per item
items[].notesstringNoAdditional notes for item

Example Request:

bash
curl -X POST https://sandbox-api.bebaskirim.com/api/partner/v1/adjustments \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "X-Tenant-Id: YOUR_TENANT_ID" \
  -H "Content-Type: application/json" \
  -d '{
    "location_id": 1,
    "type": "increase",
    "reason": "Stock correction",
    "items": [
      {
        "product_id": "PROD-2024-001",
        "quantity": 10,
        "unit_cost": 50000,
        "notes": "Additional stock found"
      }
    ]
  }'

Example Response:

json
{
  "status": "ok",
  "data": {
    "adjustment": {
      "id": "ADJ-2024-001",
      "adjustment_number": "ADJ-2024-001",
      "location": {
        "id": 1,
        "code": "WH-001",
        "name": "Warehouse A",
        "address": "Jl. Warehouse No. 456, Jakarta"
      },
      "type": "increase",
      "stock_source": "good",
      "reason": "Stock correction",
      "status": "pending",
      "total_amount": 500000,
      "item_count": 1,
      "items": [
        {
          "id": 1,
          "product_id": "PROD-2024-001",
          "product_name": "Product A",
          "sku": "SKU-001",
          "quantity": 10,
          "unit_cost": 50000,
          "total_cost": 500000,
          "notes": "Additional stock found"
        }
      ],
      "created_by": {
        "id": 1,
        "name": "John Doe",
        "email": "john@example.com"
      },
      "created_at": "2024-01-15T10:30:00Z",
      "updated_at": "2024-01-15T10:30:00Z",
      "approved_at": null,
      "approved_by": null,
      "rejected_at": null,
      "rejected_by": null,
      "rejection_reason": null
    }
  },
  "errors": null,
  "request_id": "request-id"
}

2. Get Adjustment List

Retrieve a paginated list of adjustments with filtering options.

Endpoint: GET /api/engine/v1/adjustments

Headers:

  • Authorization: {token} (required)
  • X-Tenant-Id: {tenant_id} (required)

Query Parameters:

  • page (integer, optional): Page number for pagination (default: 1)
  • per_page (integer, optional): Number of items per page (default: 10, max: 100)
  • status (string, optional): Filter by status: pending, approved, rejected
  • location_id (integer, optional): Filter by location ID
  • type (string, optional): Filter by type: increase, decrease

Example Request:

bash
curl -X GET "https://sandbox-api.bebaskirim.com/api/engine/v1/adjustments?page=1&per_page=10&status=pending&location_id=1&type=increase" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "X-Tenant-Id: YOUR_TENANT_ID"

Example Response:

json
{
  "status": "ok",
  "data": {
    "adjustments": [
      {
        "id": "ADJ-2024-001",
        "adjustment_number": "ADJ-2024-001",
        "location": {
          "id": 1,
          "code": "WH-001",
          "name": "Warehouse A"
        },
        "type": "increase",
        "reason": "Stock correction",
        "status": "pending",
        "total_amount": 500000,
        "item_count": 1,
        "created_at": "2024-01-15T10:30:00Z",
        "updated_at": "2024-01-15T10:30:00Z"
      }
    ],
    "pagination": {
      "current_page": 1,
      "per_page": 10,
      "total": 25,
      "last_page": 3
    }
  },
  "errors": null,
  "request_id": "request-id"
}

3. Get Adjustment Detail

Retrieve detailed information about a specific adjustment.

Endpoint: GET /api/engine/v1/adjustments/:id

Headers:

  • Authorization: {token} (required)
  • X-Tenant-Id: {tenant_id} (required)

Path Parameters:

ParameterTypeRequiredDescription
idstringYesAdjustment ID

Example Request:

bash
curl -X GET https://sandbox-api.bebaskirim.com/api/engine/v1/adjustments/ADJ-2024-001 \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "X-Tenant-Id: YOUR_TENANT_ID"

Example Response:

json
{
  "status": "ok",
  "data": {
    "adjustment": {
      "id": "ADJ-2024-001",
      "adjustment_number": "ADJ-2024-001",
      "location": {
        "id": 1,
        "code": "WH-001",
        "name": "Warehouse A",
        "address": "Jl. Warehouse No. 456, Jakarta"
      },
      "type": "increase",
      "stock_source": "good",
      "reason": "Stock correction",
      "status": "pending",
      "total_amount": 500000,
      "items": [
        {
          "id": 1,
          "product_id": "PROD-2024-001",
          "product_name": "Product A",
          "sku": "SKU-001",
          "quantity": 10,
          "unit_cost": 50000,
          "total_cost": 500000,
          "notes": "Additional stock found",
          "current_stock": 100
        }
      ],
      "created_by": {
        "id": 1,
        "name": "John Doe",
        "email": "john@example.com"
      },
      "created_at": "2024-01-15T10:30:00Z",
      "updated_at": "2024-01-15T10:30:00Z",
      "approved_at": null,
      "approved_by": null,
      "rejected_at": null,
      "rejected_by": null,
      "rejection_reason": null
    }
  },
  "errors": null,
  "request_id": "request-id"
}

4. Approve Adjustment

Approve a pending adjustment to apply the stock changes.

Endpoint: PATCH /api/partner/v1/adjustments/:id/approve

Headers:

  • Authorization: {token} (required)
  • X-Tenant-Id: {tenant_id} (required)

Path Parameters:

ParameterTypeRequiredDescription
idstringYesAdjustment ID

Request Body:

json
{}

Example Request:

bash
curl -X POST https://sandbox-api.bebaskirim.com/api/partner/v1/adjustments/ADJ-2024-001/approve \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "X-Tenant-Id: YOUR_TENANT_ID" \
  -H "Content-Type: application/json" \
  -d '{}'

Example Response:

json
{
  "status": "ok",
  "data": null,
  "errors": null,
  "request_id": "request-id"
}

5. Reject Adjustment

Reject a pending adjustment.

Endpoint: PATCH /api/partner/v1/adjustments/:id/reject

Headers:

  • Authorization: {token} (required)
  • X-Tenant-Id: {tenant_id} (required)

Path Parameters:

ParameterTypeRequiredDescription
idstringYesAdjustment ID

Request Body:

json
{
  "reason": "Insufficient documentation provided"
}

Request Parameters:

ParameterTypeRequiredDescription
reasonstringYesReason for rejection

Example Request:

bash
curl -X POST https://sandbox-api.bebaskirim.com/api/partner/v1/adjustments/ADJ-2024-001/reject \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "X-Tenant-Id: YOUR_TENANT_ID" \
  -H "Content-Type: application/json" \
  -d '{
    "reason": "Insufficient documentation provided"
  }'

Example Response:

json
{
  "status": "ok",
  "data": null,
  "errors": null,
  "request_id": "request-id"
}

Status Codes

StatusDescription
pendingAdjustment created, awaiting approval
approvedAdjustment approved and stock updated
rejectedAdjustment rejected

Adjustment Types

TypeDescription
increaseStock increase adjustment
decreaseStock decrease adjustment