Ranch.Bot
Skip to reference

Protocol versions API

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

GET /v1/farm/{farm_id}/protocol-versions

List farm protocol versions

List immutable protocol definitions without inventing missing care steps. External credential scopes: read:records. Minimum farm role: READER.

ParameterInRequiredSchema
farm_idpathYes{"type":"string","format":"uuid"}
skipqueryNo{"type":"integer","minimum":0,"default":0}
takequeryNo{"type":"integer","minimum":1,"maximum":200,"default":50}

Request example

bash example
curl --fail-with-body -X GET \
  'https://api.ranch.bot/v1/farm/<farm_id>/protocol-versions' \
  -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
totalintegerRequiredminimum: 0
recordsarrayRequired
records[]objectRequired
records[].idstringRequiredformat: "uuid"
records[].farm_idstringRequiredformat: "uuid"
records[].namestringRequired
records[].versionstringRequired
records[].stepsarrayRequired
records[].steps[]stringRequired
records[].created_by_user_idstringRequiredformat: "uuid"
records[].created_atstringRequiredformat: "date-time"

POST /v1/farm/{farm_id}/protocol-versions

Create a farm protocol version

Save the exact producer-approved protocol name, version and steps. The same version and steps are idempotent; different steps for an existing version return 409. External credential scopes: write:records. Minimum farm role: EDITOR.

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

Request body (application/json)

FieldTypePresenceConstraints
namestringRequiredminLength: 1; maxLength: 80
versionstringRequiredminLength: 1; maxLength: 80
stepsarrayRequiredminItems: 1; maxItems: 40
steps[]stringRequiredminLength: 1; maxLength: 1000

Create request.json with a JSON body matching the request schema above before running this example.

Request example

bash example
curl --fail-with-body -X POST \
  'https://api.ranch.bot/v1/farm/<farm_id>/protocol-versions' \
  -H "Authorization: Bearer $RANCHBOT_TOKEN" \
  -H "Content-Type: application/json" \
  --data-binary @request.json

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
409The approved preview is stale, the request ID is already used, or the protocol version has different steps.application/json
429Rate limit exceeded. Retry after the indicated delay.application/json
500Unexpected server failure.application/json

201 response schema (application/json)

FieldTypePresenceConstraints
idstringRequiredformat: "uuid"
farm_idstringRequiredformat: "uuid"
namestringRequired
versionstringRequired
stepsarrayRequired
steps[]stringRequired
created_by_user_idstringRequiredformat: "uuid"
created_atstringRequiredformat: "date-time"

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