Ranch.Bot
Skip to reference

Groups API

HTTP reference for groups. Read authentication and access before using these operations. All examples use made-up data and placeholder credentials.

GET /v1/farm/{farm_id}/groups

Get Groups

Current groups HTTP operation. External credential scopes: read:groups. Minimum farm role: READER. Pagination accepts integer skip and take; set both explicitly. An omitted value passes through to the data query. Collection property names differ by resource; use the response schema. Production rate limit: 100 requests per 15-minute window per device account, 1000 per browser session, otherwise per client IP. RateLimit headers report the current window; respect Retry-After on 429. archived uses JavaScript boolean coercion: any nonempty query string, including false, is true. Omit this parameter for active groups.

ParameterInRequiredSchema
farm_idpathYes{"type":"string","format":"uuid"}
skipqueryNo{"type":"integer"}
takequeryNo{"type":"integer"}
archivedqueryNo{"type":"boolean","default":false}

Request example

bash example
curl --fail-with-body -X GET \
  'https://api.ranch.bot/v1/farm/<farm_id>/groups' \
  -H "Authorization: Bearer $RANCHBOT_TOKEN"

Responses

StatusMeaningContent type
200Successapplication/json
400Request validation failed.application/json
401Missing/invalid authentication or insufficient farm role.application/json
403Missing required scope or credential type is disallowed.application/json
404Resource or active farm membership not found.application/json
429Rate limit exceeded. Retry after the indicated delay.application/json
500Unexpected server failure.application/json

200 response schema (application/json)

FieldTypePresenceConstraints
totalnumberRequired
recordsarrayRequired
records[]objectRequired
records[].idstringRequired
records[].created_atstringRequiredformat: "date-time"
records[].updated_atstringRequiredformat: "date-time"
records[].namestringRequired
records[].is_activebooleanRequired
records[].farm_idstringRequired
records[].description (variant 1)nullRequired
records[].description (variant 2)stringRequired
records[].animalsarrayRequired
records[].animals[]objectRequired
records[].animals[].id (variant 1)stringRequired
records[].animals[].id (variant 2)nullRequired
records[].animals[].farm_id (variant 1)stringRequired
records[].animals[].farm_id (variant 2)nullRequired
records[].animals[].is_active (variant 1)booleanRequired
records[].animals[].is_active (variant 2)nullRequired
records[].animals[].metadata (variant 1)JSONRequired
records[].animals[].metadata (variant 2)nullRequired
records[].animals[].created_at (variant 1)stringRequiredformat: "date-time"
records[].animals[].created_at (variant 2)nullRequired
records[].animals[].updated_at (variant 1)stringRequiredformat: "date-time"
records[].animals[].updated_at (variant 2)nullRequired
records[].animals[].inventory_statusstringRequiredenum: ["CURRENT","UNKNOWN","SOLD","DECEASED","NOT_MANAGED"]
records[].membership_fingerprintstringRequired
json example
{
  "total": 0,
  "records": []
}

POST /v1/farm/{farm_id}/groups

Create Group

Current groups HTTP operation. External credential scopes: write:groups. Minimum farm role: EDITOR. Direct requests execute without an app confirmation screen. Production rate limit: 100 requests per 15-minute window per device account, 1000 per browser session, otherwise per client IP. RateLimit headers report the current window; respect Retry-After on 429.

ParameterInRequiredSchema
farm_idpathYes{"type":"string","format":"uuid"}

Request body (application/json)

FieldTypePresenceConstraints
namestringRequired
descriptionstringOptional
json example
{
  "name": "Example"
}

Request example

bash example
curl --fail-with-body -X POST \
  'https://api.ranch.bot/v1/farm/<farm_id>/groups' \
  -H "Authorization: Bearer $RANCHBOT_TOKEN" \
  -H "Content-Type: application/json" \
  --data '{"name":"Example"}'

Responses

StatusMeaningContent type
201Successapplication/json
400Request validation failed.application/json
401Missing/invalid authentication or insufficient farm role.application/json
403Missing required scope or credential type is disallowed.application/json
404Resource or active farm membership not found.application/json
429Rate limit exceeded. Retry after the indicated delay.application/json
500Unexpected server failure.application/json

201 response schema (application/json)

FieldTypePresenceConstraints
idstringRequired
created_atstringRequiredformat: "date-time"
updated_atstringRequiredformat: "date-time"
namestringRequired
is_activebooleanRequired
farm_idstringRequired
description (variant 1)nullRequired
description (variant 2)stringRequired
json example
{
  "id": "11111111-1111-4111-8111-111111111111",
  "created_at": "2026-09-01T12:00:00.000Z",
  "updated_at": "2026-09-01T12:00:00.000Z",
  "name": "Example",
  "is_active": true,
  "farm_id": "11111111-1111-4111-8111-111111111111",
  "description": null
}

DELETE /v1/farm/{farm_id}/groups/{group_id}

Delete Group

Current groups HTTP operation. External credential scopes: write:groups. Minimum farm role: OWNER. Direct requests execute without an app confirmation screen. Production rate limit: 100 requests per 15-minute window per device account, 1000 per browser session, otherwise per client IP. RateLimit headers report the current window; respect Retry-After on 429. Deletion behavior is described below; a successful status does not imply erasure from all retained history. Marks the stored entity inactive (soft deletion).

ParameterInRequiredSchema
farm_idpathYes{"type":"string","format":"uuid"}
group_idpathYes{"type":"string","format":"uuid"}

Request example

bash example
curl --fail-with-body -X DELETE \
  'https://api.ranch.bot/v1/farm/<farm_id>/groups/<group_id>' \
  -H "Authorization: Bearer $RANCHBOT_TOKEN"

Responses

StatusMeaningContent type
204Completed; no response body.No body
400Request validation failed.application/json
401Missing/invalid authentication or insufficient farm role.application/json
403Missing required scope or credential type is disallowed.application/json
404Resource or active farm membership not found.application/json
429Rate limit exceeded. Retry after the indicated delay.application/json
500Unexpected server failure.application/json

GET /v1/farm/{farm_id}/groups/{group_id}

Get Group

Current groups HTTP operation. External credential scopes: read:groups. Minimum farm role: READER. Production rate limit: 100 requests per 15-minute window per device account, 1000 per browser session, otherwise per client IP. RateLimit headers report the current window; respect Retry-After on 429.

ParameterInRequiredSchema
farm_idpathYes{"type":"string","format":"uuid"}
group_idpathYes{"type":"string","format":"uuid"}

Request example

bash example
curl --fail-with-body -X GET \
  'https://api.ranch.bot/v1/farm/<farm_id>/groups/<group_id>' \
  -H "Authorization: Bearer $RANCHBOT_TOKEN"

Responses

StatusMeaningContent type
200Successapplication/json
400Request validation failed.application/json
401Missing/invalid authentication or insufficient farm role.application/json
403Missing required scope or credential type is disallowed.application/json
404Resource or active farm membership not found.application/json
429Rate limit exceeded. Retry after the indicated delay.application/json
500Unexpected server failure.application/json

200 response schema (application/json)

FieldTypePresenceConstraints
idstringRequired
created_atstringRequiredformat: "date-time"
updated_atstringRequiredformat: "date-time"
namestringRequired
is_activebooleanRequired
farm_idstringRequired
description (variant 1)nullRequired
description (variant 2)stringRequired
animalsarrayRequired
animals[]objectRequired
animals[].id (variant 1)stringRequired
animals[].id (variant 2)nullRequired
animals[].farm_id (variant 1)stringRequired
animals[].farm_id (variant 2)nullRequired
animals[].is_active (variant 1)booleanRequired
animals[].is_active (variant 2)nullRequired
animals[].metadata (variant 1)JSONRequired
animals[].metadata (variant 2)nullRequired
animals[].created_at (variant 1)stringRequiredformat: "date-time"
animals[].created_at (variant 2)nullRequired
animals[].updated_at (variant 1)stringRequiredformat: "date-time"
animals[].updated_at (variant 2)nullRequired
animals[].inventory_statusstringRequiredenum: ["CURRENT","UNKNOWN","SOLD","DECEASED","NOT_MANAGED"]
membership_fingerprintstringRequired
json example
{
  "id": "11111111-1111-4111-8111-111111111111",
  "created_at": "2026-09-01T12:00:00.000Z",
  "updated_at": "2026-09-01T12:00:00.000Z",
  "name": "Example",
  "is_active": true,
  "farm_id": "11111111-1111-4111-8111-111111111111",
  "description": null,
  "animals": [],
  "membership_fingerprint": "0000000000000000000000000000000000000000000000000000000000000000"
}

PUT /v1/farm/{farm_id}/groups/{group_id}

Update Group

Current groups HTTP operation. External credential scopes: write:groups. Minimum farm role: EDITOR. Direct requests execute without an app confirmation screen. Production rate limit: 100 requests per 15-minute window per device account, 1000 per browser session, otherwise per client IP. RateLimit headers report the current window; respect Retry-After on 429. Update the group name/description and/or add animals. animal_ids is additive: it connects the listed animals and never removes existing members. Omit animal_ids (or send []) to leave membership unchanged. Every requested animal must be an active animal on this farm; any unknown, archived or other-farm animal rejects the whole request. A request with a nonempty animal_ids cannot be undone.

ParameterInRequiredSchema
farm_idpathYes{"type":"string","format":"uuid"}
group_idpathYes{"type":"string","format":"uuid"}

Request body (application/json)

FieldTypePresenceConstraints
namestringOptional
descriptionstringOptional
animal_idsarrayOptional
animal_ids[]stringRequiredformat: "uuid"
json example
{
  "name": "Replacement ewes",
  "animal_ids": [
    "22222222-2222-4222-8222-222222222222"
  ]
}

Request example

bash example
curl --fail-with-body -X PUT \
  'https://api.ranch.bot/v1/farm/<farm_id>/groups/<group_id>' \
  -H "Authorization: Bearer $RANCHBOT_TOKEN" \
  -H "Content-Type: application/json" \
  --data '{"name":"Replacement ewes","animal_ids":["22222222-2222-4222-8222-222222222222"]}'

Responses

StatusMeaningContent type
200Successapplication/json
400Request validation failed.application/json
401Missing/invalid authentication or insufficient farm role.application/json
403Missing required scope or credential type is disallowed.application/json
404Resource or active farm membership not found.application/json
429Rate limit exceeded. Retry after the indicated delay.application/json
500Unexpected server failure.application/json

200 response schema (application/json)

FieldTypePresenceConstraints
idstringRequired
created_atstringRequiredformat: "date-time"
updated_atstringRequiredformat: "date-time"
namestringRequired
is_activebooleanRequired
farm_idstringRequired
description (variant 1)nullRequired
description (variant 2)stringRequired
json example
{
  "id": "11111111-1111-4111-8111-111111111111",
  "created_at": "2026-09-01T12:00:00.000Z",
  "updated_at": "2026-09-01T12:00:00.000Z",
  "name": "Example",
  "is_active": true,
  "farm_id": "11111111-1111-4111-8111-111111111111",
  "description": null
}

POST /v1/farm/{farm_id}/groups/{group_id}/restore

Restore Group

Current groups HTTP operation. External credential scopes: write:groups. Minimum farm role: OWNER. Direct requests execute without an app confirmation screen. Production rate limit: 100 requests per 15-minute window per device account, 1000 per browser session, otherwise per client IP. RateLimit headers report the current window; respect Retry-After on 429.

ParameterInRequiredSchema
farm_idpathYes{"type":"string","format":"uuid"}
group_idpathYes{"type":"string","format":"uuid"}

Request example

bash example
curl --fail-with-body -X POST \
  'https://api.ranch.bot/v1/farm/<farm_id>/groups/<group_id>/restore' \
  -H "Authorization: Bearer $RANCHBOT_TOKEN"

Responses

StatusMeaningContent type
200Successapplication/json
400Request validation failed.application/json
401Missing/invalid authentication or insufficient farm role.application/json
403Missing required scope or credential type is disallowed.application/json
404Resource or active farm membership not found.application/json
429Rate limit exceeded. Retry after the indicated delay.application/json
500Unexpected server failure.application/json

200 response schema (application/json)

FieldTypePresenceConstraints
idstringRequired
created_atstringRequiredformat: "date-time"
updated_atstringRequiredformat: "date-time"
namestringRequired
is_activebooleanRequired
farm_idstringRequired
description (variant 1)nullRequired
description (variant 2)stringRequired
json example
{
  "id": "11111111-1111-4111-8111-111111111111",
  "created_at": "2026-09-01T12:00:00.000Z",
  "updated_at": "2026-09-01T12:00:00.000Z",
  "name": "Example",
  "is_active": true,
  "farm_id": "11111111-1111-4111-8111-111111111111",
  "description": null
}

POST /v1/farm/{farm_id}/groups/{group_id}/membership

Update Group Membership

Current groups HTTP operation. External credential scopes: write:groups. Minimum farm role: EDITOR. Explicitly add and remove group members. Pass the membership_fingerprint from a fresh group read; a stale fingerprint is a 409 conflict. add_animal_ids and remove_animal_ids must not overlap, every target must be on this farm, and additions must be active. Already-present additions and already-absent removals are no-ops. Removal unlinks membership only; it changes no animal status, record, count observation or saved birth link, and cannot be undone.

ParameterInRequiredSchema
farm_idpathYes{"type":"string","format":"uuid"}
group_idpathYes{"type":"string","format":"uuid"}

Request body (application/json)

FieldTypePresenceConstraints
add_animal_idsarrayOptionalmaxItems: 200
add_animal_ids[]stringRequiredformat: "uuid"
remove_animal_idsarrayOptionalmaxItems: 200
remove_animal_ids[]stringRequiredformat: "uuid"
membership_fingerprintstringRequired
json example
{
  "add_animal_ids": [
    "22222222-2222-4222-8222-222222222222"
  ],
  "remove_animal_ids": [],
  "membership_fingerprint": "0000000000000000000000000000000000000000000000000000000000000000"
}

Request example

bash example
curl --fail-with-body -X POST \
  'https://api.ranch.bot/v1/farm/<farm_id>/groups/<group_id>/membership' \
  -H "Authorization: Bearer $RANCHBOT_TOKEN" \
  -H "Content-Type: application/json" \
  --data '{"add_animal_ids":["22222222-2222-4222-8222-222222222222"],"remove_animal_ids":[],"membership_fingerprint":"0000000000000000000000000000000000000000000000000000000000000000"}'

Responses

StatusMeaningContent type
200Successapplication/json
400Request validation failed.application/json
401Missing/invalid authentication or insufficient farm role.application/json
403Missing required scope or credential type is disallowed.application/json
404Resource or active farm membership not found.application/json
409The reviewed membership changed before this request was applied; reread the group.application/json
429Rate limit exceeded. Retry after the indicated delay.application/json
500Unexpected server failure.application/json

200 response schema (application/json)

FieldTypePresenceConstraints
group_idstringRequiredformat: "uuid"
added_animal_idsarrayRequired
added_animal_ids[]stringRequiredformat: "uuid"
removed_animal_idsarrayRequired
removed_animal_ids[]stringRequiredformat: "uuid"
member_animal_idsarrayRequired
member_animal_ids[]stringRequiredformat: "uuid"
membership_fingerprintstringRequired
member_countintegerRequired
json example
{
  "group_id": "11111111-1111-4111-8111-111111111111",
  "added_animal_ids": [
    "22222222-2222-4222-8222-222222222222"
  ],
  "removed_animal_ids": [],
  "member_animal_ids": [
    "22222222-2222-4222-8222-222222222222"
  ],
  "membership_fingerprint": "0000000000000000000000000000000000000000000000000000000000000000",
  "member_count": 1
}

Error body

Validation and authentication errors generally use this envelope. Rate-limit errors omit data; OAuth polling also has protocol-specific errors shown in its reference.

json example
{
  "success": false,
  "errors": [
    {
      "code": 400,
      "name": "ValidationError",
      "message": "Example validation failure"
    }
  ]
}