Stock Transactions
Function-calling namespace: stockTransactions
- Base URL:
https://api.aivida.in - Engine endpoint:
POST /api - Auth: Stack token middleware enabled in
optionalmode. - Send token in header:
x-stack-access-token: <access_token>(orAuthorization: Bearer <access_token>). - In
optionalmode: no token is allowed; invalid token is rejected with401.
adjustStock
Source: backend/endpoints/stock-transactions/adjust-stock
Input Fields
| Field | Type | Required | Constraints |
|---|---|---|---|
organizationId | string | Yes | - |
serviceId | string | Yes | - |
quantity | integer | No | - |
reason | string | Yes | - |
notes | string | No | - |
performedByUserId | string | No | - |
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
| Field | Type | Required | Constraints |
|---|---|---|---|
organizationId | string | Yes | - |
serviceId | string | Yes | - |
type | string | Yes | - |
quantity | number | Yes | - |
previousQuantity | number | Yes | - |
newQuantity | number | Yes | - |
reason | string | Yes | - |
notes | string | No | - |
providerOrderId | string | No | - |
performedByUserId | string | No | - |
performedAt | integer | Yes | unix-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
| Field | Type | Required | Constraints |
|---|---|---|---|
id | string | Yes | - |
organizationId | string | Yes | - |
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
| Field | Type | Required | Constraints |
|---|---|---|---|
id | string | Yes | - |
organizationId | string | Yes | - |
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
| Field | Type | Required | Constraints |
|---|---|---|---|
organizationId | string | Yes | - |
serviceId | string | Yes | - |
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
| Field | Type | Required | Constraints |
|---|---|---|---|
organizationId | string | Yes | - |
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
| Field | Type | Required | Constraints |
|---|---|---|---|
organizationId | string | Yes | - |
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
| Field | Type | Required | Constraints |
|---|---|---|---|
organizationId | string | Yes | - |
page | integer | No | - |
pageSize | integer | No | - |
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
| Field | Type | Required | Constraints |
|---|---|---|---|
organizationId | string | Yes | - |
serviceId | string | Yes | - |
quantity | integer | No | - |
performedByUserId | string | No | - |
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
| Field | Type | Required | Constraints |
|---|---|---|---|
id | string | Yes | - |
organizationId | string | Yes | - |
serviceId | string | No | nullable |
type | string | No | nullable |
quantity | number | No | nullable |
previousQuantity | number | No | nullable |
newQuantity | number | No | nullable |
reason | string | No | nullable |
notes | string | No | nullable |
providerOrderId | string | No | nullable |
performedByUserId | string | No | nullable |
performedAt | integer | No | unix-ms timestamp; nullable |
createdAt | integer | No | unix-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": {} }