EndpointsStock Transactions

Stock Transactions

Function-calling namespace: stockTransactions

  • Base URL: https://api.aivida.in
  • Engine endpoint: POST /api
  • Auth: Stack token middleware enabled in optional mode.
  • Send token in header: x-stack-access-token: <access_token> (or Authorization: Bearer <access_token>).
  • In optional mode: no token is allowed; invalid token is rejected with 401.

adjustStock

Source: backend/endpoints/stock-transactions/adjust-stock

Input Fields

FieldTypeRequiredConstraints
organizationIdstringYes-
serviceIdstringYes-
quantityintegerNo-
reasonstringYes-
notesstringNo-
performedByUserIdstringNo-

Example Request

curl -X POST https://api.aivida.in/api \
  -H "Content-Type: application/json" \
  -H "x-stack-access-token: <access_token_optional>" \
  -d '{
  "namespace": "stockTransactions",
  "apiName": "adjustStock",
  "data": {
    "organizationId": "org_123",
    "serviceId": "service_123",
    "reason": "value"
  }
}'

Example Response

{ "status": "ok", "data": {} }

create

Source: backend/endpoints/stock-transactions/create

Input Fields

FieldTypeRequiredConstraints
organizationIdstringYes-
serviceIdstringYes-
typestringYes-
quantitynumberYes-
previousQuantitynumberYes-
newQuantitynumberYes-
reasonstringYes-
notesstringNo-
providerOrderIdstringNo-
performedByUserIdstringNo-
performedAtintegerYesunix-ms timestamp

Example Request

curl -X POST https://api.aivida.in/api \
  -H "Content-Type: application/json" \
  -H "x-stack-access-token: <access_token_optional>" \
  -d '{
  "namespace": "stockTransactions",
  "apiName": "create",
  "data": {
    "organizationId": "org_123",
    "serviceId": "service_123",
    "type": "general",
    "quantity": 1,
    "previousQuantity": 1,
    "newQuantity": 1,
    "reason": "value",
    "performedAt": 1710201600000
  }
}'

Example Response

{ "status": "ok", "data": {} }

delete

Source: backend/endpoints/stock-transactions/delete

Input Fields

FieldTypeRequiredConstraints
idstringYes-
organizationIdstringYes-

Example Request

curl -X POST https://api.aivida.in/api \
  -H "Content-Type: application/json" \
  -H "x-stack-access-token: <access_token_optional>" \
  -d '{
  "namespace": "stockTransactions",
  "apiName": "delete",
  "data": {
    "id": "id_123",
    "organizationId": "org_123"
  }
}'

Example Response

{ "status": "ok", "data": {} }

getById

Source: backend/endpoints/stock-transactions/get-by-id

Input Fields

FieldTypeRequiredConstraints
idstringYes-
organizationIdstringYes-

Example Request

curl -X POST https://api.aivida.in/api \
  -H "Content-Type: application/json" \
  -H "x-stack-access-token: <access_token_optional>" \
  -d '{
  "namespace": "stockTransactions",
  "apiName": "getById",
  "data": {
    "id": "id_123",
    "organizationId": "org_123"
  }
}'

Example Response

{ "status": "ok", "data": {} }

getByService

Source: backend/endpoints/stock-transactions/get-by-service

Input Fields

FieldTypeRequiredConstraints
organizationIdstringYes-
serviceIdstringYes-

Example Request

curl -X POST https://api.aivida.in/api \
  -H "Content-Type: application/json" \
  -H "x-stack-access-token: <access_token_optional>" \
  -d '{
  "namespace": "stockTransactions",
  "apiName": "getByService",
  "data": {
    "organizationId": "org_123",
    "serviceId": "service_123"
  }
}'

Example Response

{ "status": "ok", "data": {} }

getMedicationsWithStock

Source: backend/endpoints/stock-transactions/get-medications-with-stock

Input Fields

FieldTypeRequiredConstraints
organizationIdstringYes-

Example Request

curl -X POST https://api.aivida.in/api \
  -H "Content-Type: application/json" \
  -H "x-stack-access-token: <access_token_optional>" \
  -d '{
  "namespace": "stockTransactions",
  "apiName": "getMedicationsWithStock",
  "data": {
    "organizationId": "org_123"
  }
}'

Example Response

{ "status": "ok", "data": {} }

getStockStats

Source: backend/endpoints/stock-transactions/get-stock-stats

Input Fields

FieldTypeRequiredConstraints
organizationIdstringYes-

Example Request

curl -X POST https://api.aivida.in/api \
  -H "Content-Type: application/json" \
  -H "x-stack-access-token: <access_token_optional>" \
  -d '{
  "namespace": "stockTransactions",
  "apiName": "getStockStats",
  "data": {
    "organizationId": "org_123"
  }
}'

Example Response

{ "status": "ok", "data": {} }

listByOrganization

Source: backend/endpoints/stock-transactions/list-by-organization

Input Fields

FieldTypeRequiredConstraints
organizationIdstringYes-
pageintegerNo-
pageSizeintegerNo-

Example Request

curl -X POST https://api.aivida.in/api \
  -H "Content-Type: application/json" \
  -H "x-stack-access-token: <access_token_optional>" \
  -d '{
  "namespace": "stockTransactions",
  "apiName": "listByOrganization",
  "data": {
    "organizationId": "org_123"
  }
}'

Example Response

{ "status": "ok", "data": {} }

setInitialStock

Source: backend/endpoints/stock-transactions/set-initial-stock

Input Fields

FieldTypeRequiredConstraints
organizationIdstringYes-
serviceIdstringYes-
quantityintegerNo-
performedByUserIdstringNo-

Example Request

curl -X POST https://api.aivida.in/api \
  -H "Content-Type: application/json" \
  -H "x-stack-access-token: <access_token_optional>" \
  -d '{
  "namespace": "stockTransactions",
  "apiName": "setInitialStock",
  "data": {
    "organizationId": "org_123",
    "serviceId": "service_123"
  }
}'

Example Response

{ "status": "ok", "data": {} }

update

Source: backend/endpoints/stock-transactions/update

Input Fields

FieldTypeRequiredConstraints
idstringYes-
organizationIdstringYes-
serviceIdstringNonullable
typestringNonullable
quantitynumberNonullable
previousQuantitynumberNonullable
newQuantitynumberNonullable
reasonstringNonullable
notesstringNonullable
providerOrderIdstringNonullable
performedByUserIdstringNonullable
performedAtintegerNounix-ms timestamp; nullable
createdAtintegerNounix-ms timestamp; nullable

Example Request

curl -X POST https://api.aivida.in/api \
  -H "Content-Type: application/json" \
  -H "x-stack-access-token: <access_token_optional>" \
  -d '{
  "namespace": "stockTransactions",
  "apiName": "update",
  "data": {
    "id": "id_123",
    "organizationId": "org_123"
  }
}'

Example Response

{ "status": "ok", "data": {} }