Farms API
HTTP reference for farms. Read authentication and access before using these operations. All examples use made-up data and placeholder credentials.
GET /v1/farm
Get Farms
Current farms HTTP operation. External credential scopes: read:farms. Access is resolved for the authenticated user or by the endpoint-specific OAuth checks. 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 legacy key, otherwise per client IP. RateLimit headers report the current window; respect Retry-After on 429.
Parameter In Required Schema skip query No {"type":"integer"} take query No {"type":"integer"}
Request example
bash example Copy example
curl --fail-with-body -X GET \
'https://api.ranch.bot/v1/farm' \
-H "Authorization: Bearer $RANCHBOT_TOKEN"
Responses
Status Meaning Content type 200 Success application/json 400 Request validation failed. application/json 401 Missing/invalid authentication or insufficient farm role. application/json 403 Missing required scope or credential type is disallowed. application/json 404 Resource or active farm membership not found. application/json 429 Rate limit exceeded. Retry after the indicated delay. application/json 500 Unexpected server failure. application/json
200 response schema (application/json)
Field Type Presence Constraints total number Required records array Required records[] object Required records[].id string Required records[].created_at string Required format: "date-time" records[].updated_at string Required format: "date-time" records[].name string Required records[].allow_private_threads boolean Required records[].current_month_start (variant 1) null Required records[].current_month_start (variant 2) string Required format: "date-time" records[].is_active boolean Required records[].species string Required enum: ["BISON","CATTLE","ELK","GOAT","HORSE","OTHER","SHEEP"] records[].species_other (variant 1) null Required records[].species_other (variant 2) string Required records[].farm_users array Required records[].farm_users[] object Required records[].farm_users[].id (variant 1) string Required records[].farm_users[].id (variant 2) null Required records[].farm_users[].farm_id (variant 1) string Required records[].farm_users[].farm_id (variant 2) null Required records[].farm_users[].user_id (variant 1) string Required records[].farm_users[].user_id (variant 2) null Required records[].farm_users[].is_active (variant 1) boolean Required records[].farm_users[].is_active (variant 2) null Required records[].farm_users[].role (variant 1) string Required records[].farm_users[].role (variant 2) null Required records[].farm_users[].created_at (variant 1) string Required format: "date-time" records[].farm_users[].created_at (variant 2) null Required records[].farm_users[].updated_at (variant 1) string Required format: "date-time" records[].farm_users[].updated_at (variant 2) null Required records[].farm_users[].user object Required records[].farm_users[].user.id string Required records[].farm_users[].user.full_name string or null Required records[].farm_users[].user.phone_number_local string Required
json example Copy example
{
"total": 0,
"records": []
}
POST /v1/farm
Create Farm
Current farms HTTP operation. External credential scopes: write:farms. Access is resolved for the authenticated user or by the endpoint-specific OAuth checks. Direct requests execute without an app confirmation screen. Production rate limit: 100 requests per 15-minute window, per legacy key, otherwise per client IP. RateLimit headers report the current window; respect Retry-After on 429.
Request body (application/json)
Field Type Presence Constraints name string Required minLength: 2 species string Required enum: ["BISON","CATTLE","ELK","GOAT","HORSE","OTHER","SHEEP"] species_other string Optional maxLength: 100
json example Copy example
{
"name": "Example",
"species": "BISON"
}
Request example
bash example Copy example
curl --fail-with-body -X POST \
'https://api.ranch.bot/v1/farm' \
-H "Authorization: Bearer $RANCHBOT_TOKEN" \
-H "Content-Type: application/json" \
--data '{"name":"Example","species":"BISON"}'
Responses
Status Meaning Content type 201 Success application/json 400 Request validation failed. application/json 401 Missing/invalid authentication or insufficient farm role. application/json 403 Missing required scope or credential type is disallowed. application/json 404 Resource or active farm membership not found. application/json 429 Rate limit exceeded. Retry after the indicated delay. application/json 500 Unexpected server failure. application/json
201 response schema (application/json)
Field Type Presence Constraints farm object Required farm.id string Required farm.created_at string Required format: "date-time" farm.updated_at string Required format: "date-time" farm.name string Required farm.allow_private_threads boolean Required farm.current_month_start (variant 1) null Required farm.current_month_start (variant 2) string Required format: "date-time" farm.is_active boolean Required farm.species string Required enum: ["BISON","CATTLE","ELK","GOAT","HORSE","OTHER","SHEEP"] farm.species_other (variant 1) null Required farm.species_other (variant 2) string Required farm.farm_users array Required farm.farm_users[] object Required farm.farm_users[].id (variant 1) string Required farm.farm_users[].id (variant 2) null Required farm.farm_users[].farm_id (variant 1) string Required farm.farm_users[].farm_id (variant 2) null Required farm.farm_users[].user_id (variant 1) string Required farm.farm_users[].user_id (variant 2) null Required farm.farm_users[].is_active (variant 1) boolean Required farm.farm_users[].is_active (variant 2) null Required farm.farm_users[].role (variant 1) string Required farm.farm_users[].role (variant 2) null Required farm.farm_users[].created_at (variant 1) string Required format: "date-time" farm.farm_users[].created_at (variant 2) null Required farm.farm_users[].updated_at (variant 1) string Required format: "date-time" farm.farm_users[].updated_at (variant 2) null Required farm.farm_users[].user object Required farm.farm_users[].user.id string Required farm.farm_users[].user.full_name string or null Required farm.farm_users[].user.phone_number_local string Required welcome_thread_id string Required
json example Copy example
{
"farm": {
"id": "11111111-1111-4111-8111-111111111111",
"created_at": "2026-09-01T12:00:00.000Z",
"updated_at": "2026-09-01T12:00:00.000Z",
"name": "Example",
"allow_private_threads": true,
"current_month_start": null,
"is_active": true,
"species": "BISON",
"species_other": null,
"farm_users": []
},
"welcome_thread_id": "11111111-1111-4111-8111-111111111111"
}
DELETE /v1/farm/{farm_id}
Delete Farm
Current farms HTTP operation. External credential scopes: write:farms. Minimum farm role: OWNER. Direct requests execute without an app confirmation screen. Production rate limit: 100 requests per 15-minute window, per legacy key, 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).
Parameter In Required Schema farm_id path Yes {"type":"string","format":"uuid"}
Request example
bash example Copy example
curl --fail-with-body -X DELETE \
'https://api.ranch.bot/v1/farm/<farm_id>' \
-H "Authorization: Bearer $RANCHBOT_TOKEN"
Responses
Status Meaning Content type 204 Completed; no response body. No body 400 Request validation failed. application/json 401 Missing/invalid authentication or insufficient farm role. application/json 403 Missing required scope or credential type is disallowed. application/json 404 Resource or active farm membership not found. application/json 429 Rate limit exceeded. Retry after the indicated delay. application/json 500 Unexpected server failure. application/json
GET /v1/farm/{farm_id}
Get Farm
Current farms HTTP operation. External credential scopes: read:farms. Minimum farm role: READER. Production rate limit: 100 requests per 15-minute window, per legacy key, otherwise per client IP. RateLimit headers report the current window; respect Retry-After on 429.
Parameter In Required Schema farm_id path Yes {"type":"string","format":"uuid"}
Request example
bash example Copy example
curl --fail-with-body -X GET \
'https://api.ranch.bot/v1/farm/<farm_id>' \
-H "Authorization: Bearer $RANCHBOT_TOKEN"
Responses
Status Meaning Content type 200 Success application/json 400 Request validation failed. application/json 401 Missing/invalid authentication or insufficient farm role. application/json 403 Missing required scope or credential type is disallowed. application/json 404 Resource or active farm membership not found. application/json 429 Rate limit exceeded. Retry after the indicated delay. application/json 500 Unexpected server failure. application/json
200 response schema (application/json)
Field Type Presence Constraints farm object Required farm.id (variant 1) string Required farm.id (variant 2) null Required farm.allow_private_threads (variant 1) boolean Required farm.allow_private_threads (variant 2) null Required farm.current_month_start (variant 1) string Required format: "date-time" farm.current_month_start (variant 2) null Required farm.is_active (variant 1) boolean Required farm.is_active (variant 2) null Required farm.name (variant 1) string Required farm.name (variant 2) null Required farm.species (variant 1) string Required farm.species (variant 2) null Required farm.species_other (variant 1) string Required farm.species_other (variant 2) null Required farm.created_at (variant 1) string Required format: "date-time" farm.created_at (variant 2) null Required farm.updated_at (variant 1) string Required format: "date-time" farm.updated_at (variant 2) null Required farm.farm_users array Required farm.farm_users[] object Required farm.farm_users[].id (variant 1) string Required farm.farm_users[].id (variant 2) null Required farm.farm_users[].farm_id (variant 1) string Required farm.farm_users[].farm_id (variant 2) null Required farm.farm_users[].user_id (variant 1) string Required farm.farm_users[].user_id (variant 2) null Required farm.farm_users[].is_active (variant 1) boolean Required farm.farm_users[].is_active (variant 2) null Required farm.farm_users[].role (variant 1) string Required farm.farm_users[].role (variant 2) null Required farm.farm_users[].created_at (variant 1) string Required format: "date-time" farm.farm_users[].created_at (variant 2) null Required farm.farm_users[].updated_at (variant 1) string Required format: "date-time" farm.farm_users[].updated_at (variant 2) null Required farm.farm_users[].user object Required farm.farm_users[].user.id string Required farm.farm_users[].user.full_name string or null Required farm.farm_users[].user.phone_number_local string Required
json example Copy example
{
"farm": {
"id": "11111111-1111-4111-8111-111111111111",
"allow_private_threads": true,
"current_month_start": "2026-09-01T12:00:00.000Z",
"is_active": true,
"name": "example",
"species": "example",
"species_other": "example",
"created_at": "2026-09-01T12:00:00.000Z",
"updated_at": "2026-09-01T12:00:00.000Z",
"farm_users": []
}
}
PUT /v1/farm/{farm_id}
Update Farm
Current farms HTTP operation. External credential scopes: write:farms. Minimum farm role: EDITOR. Direct requests execute without an app confirmation screen. Production rate limit: 100 requests per 15-minute window, per legacy key, otherwise per client IP. RateLimit headers report the current window; respect Retry-After on 429.
Parameter In Required Schema farm_id path Yes {"type":"string","format":"uuid"}
Request body (application/json)
Field Type Presence Constraints allow_private_threads boolean Optional name string Optional minLength: 2 species string Optional enum: ["BISON","CATTLE","ELK","GOAT","HORSE","OTHER","SHEEP"] species_other (variant 1) string Optional maxLength: 100 species_other (variant 2) null Optional
json example Copy example
{}
Request example
bash example Copy example
curl --fail-with-body -X PUT \
'https://api.ranch.bot/v1/farm/<farm_id>' \
-H "Authorization: Bearer $RANCHBOT_TOKEN" \
-H "Content-Type: application/json" \
--data '{}'
Responses
Status Meaning Content type 200 Success application/json 400 Request validation failed. application/json 401 Missing/invalid authentication or insufficient farm role. application/json 403 Missing required scope or credential type is disallowed. application/json 404 Resource or active farm membership not found. application/json 429 Rate limit exceeded. Retry after the indicated delay. application/json 500 Unexpected server failure. application/json
200 response schema (application/json)
Field Type Presence Constraints farm object Required farm.id string Required farm.created_at string Required format: "date-time" farm.updated_at string Required format: "date-time" farm.name string Required farm.allow_private_threads boolean Required farm.current_month_start (variant 1) null Required farm.current_month_start (variant 2) string Required format: "date-time" farm.is_active boolean Required farm.species string Required enum: ["BISON","CATTLE","ELK","GOAT","HORSE","OTHER","SHEEP"] farm.species_other (variant 1) null Required farm.species_other (variant 2) string Required farm.farm_users array Required farm.farm_users[] object Required farm.farm_users[].id (variant 1) string Required farm.farm_users[].id (variant 2) null Required farm.farm_users[].farm_id (variant 1) string Required farm.farm_users[].farm_id (variant 2) null Required farm.farm_users[].user_id (variant 1) string Required farm.farm_users[].user_id (variant 2) null Required farm.farm_users[].is_active (variant 1) boolean Required farm.farm_users[].is_active (variant 2) null Required farm.farm_users[].role (variant 1) string Required farm.farm_users[].role (variant 2) null Required farm.farm_users[].created_at (variant 1) string Required format: "date-time" farm.farm_users[].created_at (variant 2) null Required farm.farm_users[].updated_at (variant 1) string Required format: "date-time" farm.farm_users[].updated_at (variant 2) null Required farm.farm_users[].user object Required farm.farm_users[].user.id string Required farm.farm_users[].user.full_name string or null Required farm.farm_users[].user.phone_number_local string Required
json example Copy example
{
"farm": {
"id": "11111111-1111-4111-8111-111111111111",
"created_at": "2026-09-01T12:00:00.000Z",
"updated_at": "2026-09-01T12:00:00.000Z",
"name": "Example",
"allow_private_threads": true,
"current_month_start": null,
"is_active": true,
"species": "BISON",
"species_other": null,
"farm_users": []
}
}
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 Copy example
{
"success": false,
"errors": [
{
"code": 400,
"name": "ValidationError",
"message": "Example validation failure"
}
]
}