Ranch.Bot
Skip to reference

Default farm API

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

GET /v1/user/default-farm

Get Default Farm

Current default farm HTTP operation. No resource-scope middleware on this operation. Access is resolved for the authenticated user or by the endpoint-specific OAuth checks. 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 example

bash example
curl --fail-with-body -X GET \
  'https://api.ranch.bot/v1/user/default-farm' \
  -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
default_farm_id (variant 1)nullRequired
default_farm_id (variant 2)stringRequired
json example
{
  "default_farm_id": null
}

PUT /v1/user/default-farm

Set Default Farm

Current default farm HTTP operation. No resource-scope middleware on this operation. 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. Device credentials are rejected. Accepts a deprecated legacy key; setting a default does not grant access to that farm.

Request body (application/json)

FieldTypePresenceConstraints
farm_id (variant 1)stringRequiredformat: "uuid"
farm_id (variant 2)nullRequired
json example
{
  "farm_id": "11111111-1111-4111-8111-111111111111"
}

Request example

bash example
curl --fail-with-body -X PUT \
  'https://api.ranch.bot/v1/user/default-farm' \
  -H "Authorization: Bearer $RANCHBOT_TOKEN" \
  -H "Content-Type: application/json" \
  --data '{"farm_id":"11111111-1111-4111-8111-111111111111"}'

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
default_farm_id (variant 1)nullRequired
default_farm_id (variant 2)stringRequired
json example
{
  "default_farm_id": null
}

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"
    }
  ]
}