Birth events API
HTTP reference for birth events. Read authentication and access before using these operations. All examples use made-up data and placeholder credentials.
- POST /v1/farm/{farm_id}/birth-events/preview
- POST /v1/farm/{farm_id}/birth-events
- GET /v1/farm/{farm_id}/birth-events
- GET /v1/farm/{farm_id}/birth-events/{event_id}
POST /v1/farm/{farm_id}/birth-events/preview
Preview a birth event
Validate without saving farm data. Display the entire returned bundle and resolved review. Obtain explicit producer approval of this exact preview before confirmation. A read-only device session cannot call POST; an EDITOR device session needs read:records and a write scope. External credential scopes: read:records. Minimum farm role: EDITOR.
| Parameter | In | Required | Schema |
|---|---|---|---|
| farm_id | path | Yes | {"type":"string","format":"uuid"} |
Request body (application/json)
| Field | Type | Presence | Constraints |
|---|---|---|---|
| request_id | string | Required | format: "uuid" |
| bundle | object | Required | |
| bundle.dam_id | string | Required | format: "uuid" |
| bundle.birth_date | string | Required | |
| bundle.time_precision | string | Optional | enum: ["date_only","morning","afternoon","evening","night"]; default: "date_only" |
| bundle.dam_update | object | Optional | |
| bundle.dam_update.kind | string | Optional | minLength: 1; maxLength: 80 |
| bundle.dam_update.notes | string | Optional | minLength: 1; maxLength: 1000 |
| bundle.maternal_observations | array | Optional | maxItems: 20; default: [] |
| bundle.maternal_observations[] | object | Required | |
| bundle.maternal_observations[].date | string | Required | |
| bundle.maternal_observations[].text | string | Required | minLength: 1; maxLength: 1000 |
| bundle.lactation_observations | array | Optional | maxItems: 20; default: [] |
| bundle.lactation_observations[] | object | Required | |
| bundle.lactation_observations[].date | string | Required | |
| bundle.lactation_observations[].text | string | Required | minLength: 1; maxLength: 1000 |
| bundle.offspring | array | Required | minItems: 1; maxItems: 20 |
| bundle.offspring[] | object | Required | |
| bundle.offspring[].review_label | string | Required | minLength: 1; maxLength: 80 |
| bundle.offspring[].sex | string | Required | enum: ["male","female","unknown"] |
| bundle.offspring[].birth_weight | object | Optional | |
| bundle.offspring[].birth_weight.value | number | Required | maximum: 1000 |
| bundle.offspring[].birth_weight.unit | string | Required | enum: ["kg","lb"] |
| bundle.offspring[].vigor | array | Optional | maxItems: 20; default: [] |
| bundle.offspring[].vigor[] | object | Required | |
| bundle.offspring[].vigor[].date | string | Required | |
| bundle.offspring[].vigor[].text | string | Required | minLength: 1; maxLength: 1000 |
| bundle.offspring[].supplementation | array | Optional | maxItems: 20; default: [] |
| bundle.offspring[].supplementation[] | object | Required | |
| bundle.offspring[].supplementation[].date | string | Required | |
| bundle.offspring[].supplementation[].substance | string | Required | minLength: 1; maxLength: 80 |
| bundle.offspring[].supplementation[].amount | number | Required | maximum: 100000 |
| bundle.offspring[].supplementation[].unit | string | Required | minLength: 1; maxLength: 80 |
| bundle.offspring[].supplementation[].source | string | Required | minLength: 1; maxLength: 1000 |
| bundle.sire | object | Optional | default: {"status":"unknown"} |
| bundle.sire.status | string | Required | enum: ["unknown","presumed","confirmed"] |
| bundle.sire.animal_id | string | Optional | format: "uuid" |
| bundle.sire.provenance | string | Optional | minLength: 1; maxLength: 1000 |
| bundle.sire.confidence | number | Optional | minimum: 0; maximum: 1 |
| bundle.protocol | object | Optional | |
| bundle.protocol.claimed_name | string | Required | minLength: 1; maxLength: 80 |
| bundle.protocol.completed_date | string | Required | |
| bundle.protocol.version_id | string | Optional | format: "uuid" |
| bundle.protocol.offspring_labels | array | Required | minItems: 1; maxItems: 20 |
| bundle.protocol.offspring_labels[] | string | Required | minLength: 1; maxLength: 80 |
| bundle.follow_up | array | Optional | maxItems: 20; default: [] |
| bundle.follow_up[] | object | Required | |
| bundle.follow_up[].name | string | Required | minLength: 1; maxLength: 1000 |
| bundle.follow_up[].due_date | string | Optional | |
| bundle.follow_up[].offspring_labels | array | Required | minItems: 1; maxItems: 20 |
| bundle.follow_up[].offspring_labels[] | string | Required | minLength: 1; maxLength: 80 |
| bundle.group_ids | array | Optional | maxItems: 20; default: [] |
| bundle.group_ids[] | string | Required | format: "uuid" |
| bundle.current_location | string | Optional | minLength: 1; maxLength: 80 |
| bundle.source_sms_id | string | Optional | format: "uuid" |
| bundle.source_message_id | string | Optional | format: "uuid" |
| bundle.evidence | array | Optional | maxItems: 20; default: [] |
| bundle.evidence[] | object | Required | |
| bundle.evidence[].file_id | string | Required | format: "uuid" |
| bundle.evidence[].media_id | string | Optional | format: "uuid" |
| bundle.evidence[].link_to_dam | boolean | Optional | default: false |
| bundle.evidence[].offspring_label | string | Optional | minLength: 1; maxLength: 80 |
| bundle.unresolved | array | Optional | maxItems: 30; default: [] |
| bundle.unresolved[] | string | Required | minLength: 1; maxLength: 1000 |
| bundle.additional_source_sms_ids | array | Optional | maxItems: 20; default: [] |
| bundle.additional_source_sms_ids[] | string | Required | format: "uuid" |
Create request.json with a JSON body matching the request schema above before running this example.
Request example
curl --fail-with-body -X POST \
'https://api.ranch.bot/v1/farm/<farm_id>/birth-events/preview' \
-H "Authorization: Bearer $RANCHBOT_TOKEN" \
-H "Content-Type: application/json" \
--data-binary @request.jsonResponses
| 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 |
| 409 | The approved preview is stale, the request ID is already used, or the protocol version has different steps. | 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 |
|---|---|---|---|
| request_id | string | Required | format: "uuid" |
| bundle | object | Required | |
| bundle.dam_id | string | Required | format: "uuid" |
| bundle.birth_date | string | Required | |
| bundle.time_precision | string | Optional | enum: ["date_only","morning","afternoon","evening","night"]; default: "date_only" |
| bundle.dam_update | object | Optional | |
| bundle.dam_update.kind | string | Optional | minLength: 1; maxLength: 80 |
| bundle.dam_update.notes | string | Optional | minLength: 1; maxLength: 1000 |
| bundle.maternal_observations | array | Optional | maxItems: 20; default: [] |
| bundle.maternal_observations[] | object | Required | |
| bundle.maternal_observations[].date | string | Required | |
| bundle.maternal_observations[].text | string | Required | minLength: 1; maxLength: 1000 |
| bundle.lactation_observations | array | Optional | maxItems: 20; default: [] |
| bundle.lactation_observations[] | object | Required | |
| bundle.lactation_observations[].date | string | Required | |
| bundle.lactation_observations[].text | string | Required | minLength: 1; maxLength: 1000 |
| bundle.offspring | array | Required | minItems: 1; maxItems: 20 |
| bundle.offspring[] | object | Required | |
| bundle.offspring[].review_label | string | Required | minLength: 1; maxLength: 80 |
| bundle.offspring[].sex | string | Required | enum: ["male","female","unknown"] |
| bundle.offspring[].birth_weight | object | Optional | |
| bundle.offspring[].birth_weight.value | number | Required | maximum: 1000 |
| bundle.offspring[].birth_weight.unit | string | Required | enum: ["kg","lb"] |
| bundle.offspring[].vigor | array | Optional | maxItems: 20; default: [] |
| bundle.offspring[].vigor[] | object | Required | |
| bundle.offspring[].vigor[].date | string | Required | |
| bundle.offspring[].vigor[].text | string | Required | minLength: 1; maxLength: 1000 |
| bundle.offspring[].supplementation | array | Optional | maxItems: 20; default: [] |
| bundle.offspring[].supplementation[] | object | Required | |
| bundle.offspring[].supplementation[].date | string | Required | |
| bundle.offspring[].supplementation[].substance | string | Required | minLength: 1; maxLength: 80 |
| bundle.offspring[].supplementation[].amount | number | Required | maximum: 100000 |
| bundle.offspring[].supplementation[].unit | string | Required | minLength: 1; maxLength: 80 |
| bundle.offspring[].supplementation[].source | string | Required | minLength: 1; maxLength: 1000 |
| bundle.sire | object | Optional | default: {"status":"unknown"} |
| bundle.sire.status | string | Required | enum: ["unknown","presumed","confirmed"] |
| bundle.sire.animal_id | string | Optional | format: "uuid" |
| bundle.sire.provenance | string | Optional | minLength: 1; maxLength: 1000 |
| bundle.sire.confidence | number | Optional | minimum: 0; maximum: 1 |
| bundle.protocol | object | Optional | |
| bundle.protocol.claimed_name | string | Required | minLength: 1; maxLength: 80 |
| bundle.protocol.completed_date | string | Required | |
| bundle.protocol.version_id | string | Optional | format: "uuid" |
| bundle.protocol.offspring_labels | array | Required | minItems: 1; maxItems: 20 |
| bundle.protocol.offspring_labels[] | string | Required | minLength: 1; maxLength: 80 |
| bundle.follow_up | array | Optional | maxItems: 20; default: [] |
| bundle.follow_up[] | object | Required | |
| bundle.follow_up[].name | string | Required | minLength: 1; maxLength: 1000 |
| bundle.follow_up[].due_date | string | Optional | |
| bundle.follow_up[].offspring_labels | array | Required | minItems: 1; maxItems: 20 |
| bundle.follow_up[].offspring_labels[] | string | Required | minLength: 1; maxLength: 80 |
| bundle.group_ids | array | Optional | maxItems: 20; default: [] |
| bundle.group_ids[] | string | Required | format: "uuid" |
| bundle.current_location | string | Optional | minLength: 1; maxLength: 80 |
| bundle.source_sms_id | string | Optional | format: "uuid" |
| bundle.source_message_id | string | Optional | format: "uuid" |
| bundle.evidence | array | Optional | maxItems: 20; default: [] |
| bundle.evidence[] | object | Required | |
| bundle.evidence[].file_id | string | Required | format: "uuid" |
| bundle.evidence[].media_id | string | Optional | format: "uuid" |
| bundle.evidence[].link_to_dam | boolean | Optional | default: false |
| bundle.evidence[].offspring_label | string | Optional | minLength: 1; maxLength: 80 |
| bundle.unresolved | array | Optional | maxItems: 30; default: [] |
| bundle.unresolved[] | string | Required | minLength: 1; maxLength: 1000 |
| bundle.additional_source_sms_ids | array | Optional | maxItems: 20; default: [] |
| bundle.additional_source_sms_ids[] | string | Required | format: "uuid" |
| confirmation_hash | string | Required | |
| review | object | Required |
POST /v1/farm/{farm_id}/birth-events
Confirm a reviewed birth event
Save all reviewed animals, observations, relationships, care records, tasks and evidence in one transaction. Submit only request_id, bundle and confirmation_hash from the approved preview. Reusing the exact request is idempotent. A changed hash or reused request ID with different data returns 409; obtain approval of a fresh preview after corrections or changed farm evidence. External credential scopes: write:records, write:animals, write:groups. Minimum farm role: EDITOR.
| Parameter | In | Required | Schema |
|---|---|---|---|
| farm_id | path | Yes | {"type":"string","format":"uuid"} |
Request body (application/json)
| Field | Type | Presence | Constraints |
|---|---|---|---|
| request_id | string | Required | format: "uuid" |
| bundle | object | Required | |
| bundle.dam_id | string | Required | format: "uuid" |
| bundle.birth_date | string | Required | |
| bundle.time_precision | string | Optional | enum: ["date_only","morning","afternoon","evening","night"]; default: "date_only" |
| bundle.dam_update | object | Optional | |
| bundle.dam_update.kind | string | Optional | minLength: 1; maxLength: 80 |
| bundle.dam_update.notes | string | Optional | minLength: 1; maxLength: 1000 |
| bundle.maternal_observations | array | Optional | maxItems: 20; default: [] |
| bundle.maternal_observations[] | object | Required | |
| bundle.maternal_observations[].date | string | Required | |
| bundle.maternal_observations[].text | string | Required | minLength: 1; maxLength: 1000 |
| bundle.lactation_observations | array | Optional | maxItems: 20; default: [] |
| bundle.lactation_observations[] | object | Required | |
| bundle.lactation_observations[].date | string | Required | |
| bundle.lactation_observations[].text | string | Required | minLength: 1; maxLength: 1000 |
| bundle.offspring | array | Required | minItems: 1; maxItems: 20 |
| bundle.offspring[] | object | Required | |
| bundle.offspring[].review_label | string | Required | minLength: 1; maxLength: 80 |
| bundle.offspring[].sex | string | Required | enum: ["male","female","unknown"] |
| bundle.offspring[].birth_weight | object | Optional | |
| bundle.offspring[].birth_weight.value | number | Required | maximum: 1000 |
| bundle.offspring[].birth_weight.unit | string | Required | enum: ["kg","lb"] |
| bundle.offspring[].vigor | array | Optional | maxItems: 20; default: [] |
| bundle.offspring[].vigor[] | object | Required | |
| bundle.offspring[].vigor[].date | string | Required | |
| bundle.offspring[].vigor[].text | string | Required | minLength: 1; maxLength: 1000 |
| bundle.offspring[].supplementation | array | Optional | maxItems: 20; default: [] |
| bundle.offspring[].supplementation[] | object | Required | |
| bundle.offspring[].supplementation[].date | string | Required | |
| bundle.offspring[].supplementation[].substance | string | Required | minLength: 1; maxLength: 80 |
| bundle.offspring[].supplementation[].amount | number | Required | maximum: 100000 |
| bundle.offspring[].supplementation[].unit | string | Required | minLength: 1; maxLength: 80 |
| bundle.offspring[].supplementation[].source | string | Required | minLength: 1; maxLength: 1000 |
| bundle.sire | object | Optional | default: {"status":"unknown"} |
| bundle.sire.status | string | Required | enum: ["unknown","presumed","confirmed"] |
| bundle.sire.animal_id | string | Optional | format: "uuid" |
| bundle.sire.provenance | string | Optional | minLength: 1; maxLength: 1000 |
| bundle.sire.confidence | number | Optional | minimum: 0; maximum: 1 |
| bundle.protocol | object | Optional | |
| bundle.protocol.claimed_name | string | Required | minLength: 1; maxLength: 80 |
| bundle.protocol.completed_date | string | Required | |
| bundle.protocol.version_id | string | Optional | format: "uuid" |
| bundle.protocol.offspring_labels | array | Required | minItems: 1; maxItems: 20 |
| bundle.protocol.offspring_labels[] | string | Required | minLength: 1; maxLength: 80 |
| bundle.follow_up | array | Optional | maxItems: 20; default: [] |
| bundle.follow_up[] | object | Required | |
| bundle.follow_up[].name | string | Required | minLength: 1; maxLength: 1000 |
| bundle.follow_up[].due_date | string | Optional | |
| bundle.follow_up[].offspring_labels | array | Required | minItems: 1; maxItems: 20 |
| bundle.follow_up[].offspring_labels[] | string | Required | minLength: 1; maxLength: 80 |
| bundle.group_ids | array | Optional | maxItems: 20; default: [] |
| bundle.group_ids[] | string | Required | format: "uuid" |
| bundle.current_location | string | Optional | minLength: 1; maxLength: 80 |
| bundle.source_sms_id | string | Optional | format: "uuid" |
| bundle.source_message_id | string | Optional | format: "uuid" |
| bundle.evidence | array | Optional | maxItems: 20; default: [] |
| bundle.evidence[] | object | Required | |
| bundle.evidence[].file_id | string | Required | format: "uuid" |
| bundle.evidence[].media_id | string | Optional | format: "uuid" |
| bundle.evidence[].link_to_dam | boolean | Optional | default: false |
| bundle.evidence[].offspring_label | string | Optional | minLength: 1; maxLength: 80 |
| bundle.unresolved | array | Optional | maxItems: 30; default: [] |
| bundle.unresolved[] | string | Required | minLength: 1; maxLength: 1000 |
| bundle.additional_source_sms_ids | array | Optional | maxItems: 20; default: [] |
| bundle.additional_source_sms_ids[] | string | Required | format: "uuid" |
| confirmation_hash | string | Required |
Create request.json with a JSON body matching the request schema above before running this example.
Request example
curl --fail-with-body -X POST \
'https://api.ranch.bot/v1/farm/<farm_id>/birth-events' \
-H "Authorization: Bearer $RANCHBOT_TOKEN" \
-H "Content-Type: application/json" \
--data-binary @request.jsonResponses
| 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 |
| 409 | The approved preview is stale, the request ID is already used, or the protocol version has different steps. | 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 |
|---|---|---|---|
| id | string | Required | format: "uuid" |
| farm_id | string | Required | format: "uuid" |
| request_id | string | Required | format: "uuid" |
| confirmation_hash | string | Required | |
| created_by_user_id | string | Required | format: "uuid" |
| dam_id | string | Required | format: "uuid" |
| birth_date | string | Required | format: "date-time" |
| time_precision | string or null | Required | |
| bundle | object | Required | |
| bundle.input | object | Required | |
| bundle.input.dam_id | string | Required | format: "uuid" |
| bundle.input.birth_date | string | Required | |
| bundle.input.time_precision | string | Optional | enum: ["date_only","morning","afternoon","evening","night"]; default: "date_only" |
| bundle.input.dam_update | object | Optional | |
| bundle.input.dam_update.kind | string | Optional | minLength: 1; maxLength: 80 |
| bundle.input.dam_update.notes | string | Optional | minLength: 1; maxLength: 1000 |
| bundle.input.maternal_observations | array | Optional | maxItems: 20; default: [] |
| bundle.input.maternal_observations[] | object | Required | |
| bundle.input.maternal_observations[].date | string | Required | |
| bundle.input.maternal_observations[].text | string | Required | minLength: 1; maxLength: 1000 |
| bundle.input.lactation_observations | array | Optional | maxItems: 20; default: [] |
| bundle.input.lactation_observations[] | object | Required | |
| bundle.input.lactation_observations[].date | string | Required | |
| bundle.input.lactation_observations[].text | string | Required | minLength: 1; maxLength: 1000 |
| bundle.input.offspring | array | Required | minItems: 1; maxItems: 20 |
| bundle.input.offspring[] | object | Required | |
| bundle.input.offspring[].review_label | string | Required | minLength: 1; maxLength: 80 |
| bundle.input.offspring[].sex | string | Required | enum: ["male","female","unknown"] |
| bundle.input.offspring[].birth_weight | object | Optional | |
| bundle.input.offspring[].birth_weight.value | number | Required | maximum: 1000 |
| bundle.input.offspring[].birth_weight.unit | string | Required | enum: ["kg","lb"] |
| bundle.input.offspring[].vigor | array | Optional | maxItems: 20; default: [] |
| bundle.input.offspring[].vigor[] | object | Required | |
| bundle.input.offspring[].vigor[].date | string | Required | |
| bundle.input.offspring[].vigor[].text | string | Required | minLength: 1; maxLength: 1000 |
| bundle.input.offspring[].supplementation | array | Optional | maxItems: 20; default: [] |
| bundle.input.offspring[].supplementation[] | object | Required | |
| bundle.input.offspring[].supplementation[].date | string | Required | |
| bundle.input.offspring[].supplementation[].substance | string | Required | minLength: 1; maxLength: 80 |
| bundle.input.offspring[].supplementation[].amount | number | Required | maximum: 100000 |
| bundle.input.offspring[].supplementation[].unit | string | Required | minLength: 1; maxLength: 80 |
| bundle.input.offspring[].supplementation[].source | string | Required | minLength: 1; maxLength: 1000 |
| bundle.input.sire | object | Optional | default: {"status":"unknown"} |
| bundle.input.sire.status | string | Required | enum: ["unknown","presumed","confirmed"] |
| bundle.input.sire.animal_id | string | Optional | format: "uuid" |
| bundle.input.sire.provenance | string | Optional | minLength: 1; maxLength: 1000 |
| bundle.input.sire.confidence | number | Optional | minimum: 0; maximum: 1 |
| bundle.input.protocol | object | Optional | |
| bundle.input.protocol.claimed_name | string | Required | minLength: 1; maxLength: 80 |
| bundle.input.protocol.completed_date | string | Required | |
| bundle.input.protocol.version_id | string | Optional | format: "uuid" |
| bundle.input.protocol.offspring_labels | array | Required | minItems: 1; maxItems: 20 |
| bundle.input.protocol.offspring_labels[] | string | Required | minLength: 1; maxLength: 80 |
| bundle.input.follow_up | array | Optional | maxItems: 20; default: [] |
| bundle.input.follow_up[] | object | Required | |
| bundle.input.follow_up[].name | string | Required | minLength: 1; maxLength: 1000 |
| bundle.input.follow_up[].due_date | string | Optional | |
| bundle.input.follow_up[].offspring_labels | array | Required | minItems: 1; maxItems: 20 |
| bundle.input.follow_up[].offspring_labels[] | string | Required | minLength: 1; maxLength: 80 |
| bundle.input.group_ids | array | Optional | maxItems: 20; default: [] |
| bundle.input.group_ids[] | string | Required | format: "uuid" |
| bundle.input.current_location | string | Optional | minLength: 1; maxLength: 80 |
| bundle.input.source_sms_id | string | Optional | format: "uuid" |
| bundle.input.source_message_id | string | Optional | format: "uuid" |
| bundle.input.evidence | array | Optional | maxItems: 20; default: [] |
| bundle.input.evidence[] | object | Required | |
| bundle.input.evidence[].file_id | string | Required | format: "uuid" |
| bundle.input.evidence[].media_id | string | Optional | format: "uuid" |
| bundle.input.evidence[].link_to_dam | boolean | Optional | default: false |
| bundle.input.evidence[].offspring_label | string | Optional | minLength: 1; maxLength: 80 |
| bundle.input.unresolved | array | Optional | maxItems: 30; default: [] |
| bundle.input.unresolved[] | string | Required | minLength: 1; maxLength: 1000 |
| bundle.input.additional_source_sms_ids | array | Optional | maxItems: 20; default: [] |
| bundle.input.additional_source_sms_ids[] | string | Required | format: "uuid" |
| bundle.review | object | Required | |
| record_id | string | Required | format: "uuid" |
| source_sms_id | string or null | Required | format: "uuid" |
| source_message_id | string or null | Required | format: "uuid" |
| agent_action_id | string or null | Required | format: "uuid" |
| created_at | string | Required | format: "date-time" |
| offspring | array | Required | |
| offspring[] | object | Required | |
| offspring[].id | string | Required | format: "uuid" |
| offspring[].birth_event_id | string | Required | format: "uuid" |
| offspring[].animal_id | string | Required | format: "uuid" |
| offspring[].review_label | string | Required | |
| offspring[].position | integer | Required | |
| offspring[].details | object | Required | |
| tasks | array | Required | |
| tasks[] | object | Required | |
| tasks[].id | string | Required | format: "uuid" |
| tasks[].farm_id | string | Required | format: "uuid" |
| tasks[].birth_event_id | string | Required | format: "uuid" |
| tasks[].name | string | Required | |
| tasks[].status | string | Required | enum: ["TODO","DONE","CANCELLED"] |
| tasks[].due_date | string or null | Required | format: "date-time" |
| tasks[].created_at | string | Required | format: "date-time" |
| tasks[].updated_at | string | Required | format: "date-time" |
| tasks[].animals | array | Optional | |
| tasks[].animals[] | object | Required | |
| tasks[].animals[].id | string | Required | format: "uuid" |
| record | object | Required | |
| record.id | string | Required | format: "uuid" |
| record.files | array | Required | |
| record.files[] | object | Required | |
| record.files[].id | string | Required | format: "uuid" |
| record.files[].name | string | Required | |
| record.files[].mime_type | string | Required | |
| care_records | array | Required | |
| care_records[] | object | Required | |
| care_records[].id | string | Required | format: "uuid" |
| care_records[].name | string | Required | |
| care_records[].applied_at | string or null | Required | format: "date-time" |
| care_records[].record_items | array | Required | |
| care_records[].record_items[] | object | Required |
GET /v1/farm/{farm_id}/birth-events
List birth events
List saved births with pagination, optionally filtered by dam or offspring animal_id. External credential scopes: read:records. Minimum farm role: READER.
| Parameter | In | Required | Schema |
|---|---|---|---|
| farm_id | path | Yes | {"type":"string","format":"uuid"} |
| skip | query | No | {"type":"integer","minimum":0,"default":0} |
| take | query | No | {"type":"integer","minimum":1,"maximum":200,"default":50} |
| animal_id | query | No | {"type":"string","format":"uuid"} |
Request example
curl --fail-with-body -X GET \
'https://api.ranch.bot/v1/farm/<farm_id>/birth-events' \
-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 | integer | Required | minimum: 0 |
| records | array | Required | |
| records[] | object | Required | |
| records[].id | string | Required | format: "uuid" |
| records[].farm_id | string | Required | format: "uuid" |
| records[].request_id | string | Required | format: "uuid" |
| records[].confirmation_hash | string | Required | |
| records[].created_by_user_id | string | Required | format: "uuid" |
| records[].dam_id | string | Required | format: "uuid" |
| records[].birth_date | string | Required | format: "date-time" |
| records[].time_precision | string or null | Required | |
| records[].bundle | object | Required | |
| records[].bundle.input | object | Required | |
| records[].bundle.input.dam_id | string | Required | format: "uuid" |
| records[].bundle.input.birth_date | string | Required | |
| records[].bundle.input.time_precision | string | Optional | enum: ["date_only","morning","afternoon","evening","night"]; default: "date_only" |
| records[].bundle.input.dam_update | object | Optional | |
| records[].bundle.input.dam_update.kind | string | Optional | minLength: 1; maxLength: 80 |
| records[].bundle.input.dam_update.notes | string | Optional | minLength: 1; maxLength: 1000 |
| records[].bundle.input.maternal_observations | array | Optional | maxItems: 20; default: [] |
| records[].bundle.input.maternal_observations[] | object | Required | |
| records[].bundle.input.maternal_observations[].date | string | Required | |
| records[].bundle.input.maternal_observations[].text | string | Required | minLength: 1; maxLength: 1000 |
| records[].bundle.input.lactation_observations | array | Optional | maxItems: 20; default: [] |
| records[].bundle.input.lactation_observations[] | object | Required | |
| records[].bundle.input.lactation_observations[].date | string | Required | |
| records[].bundle.input.lactation_observations[].text | string | Required | minLength: 1; maxLength: 1000 |
| records[].bundle.input.offspring | array | Required | minItems: 1; maxItems: 20 |
| records[].bundle.input.offspring[] | object | Required | |
| records[].bundle.input.offspring[].review_label | string | Required | minLength: 1; maxLength: 80 |
| records[].bundle.input.offspring[].sex | string | Required | enum: ["male","female","unknown"] |
| records[].bundle.input.offspring[].birth_weight | object | Optional | |
| records[].bundle.input.offspring[].birth_weight.value | number | Required | maximum: 1000 |
| records[].bundle.input.offspring[].birth_weight.unit | string | Required | enum: ["kg","lb"] |
| records[].bundle.input.offspring[].vigor | array | Optional | maxItems: 20; default: [] |
| records[].bundle.input.offspring[].vigor[] | object | Required | |
| records[].bundle.input.offspring[].vigor[].date | string | Required | |
| records[].bundle.input.offspring[].vigor[].text | string | Required | minLength: 1; maxLength: 1000 |
| records[].bundle.input.offspring[].supplementation | array | Optional | maxItems: 20; default: [] |
| records[].bundle.input.offspring[].supplementation[] | object | Required | |
| records[].bundle.input.offspring[].supplementation[].date | string | Required | |
| records[].bundle.input.offspring[].supplementation[].substance | string | Required | minLength: 1; maxLength: 80 |
| records[].bundle.input.offspring[].supplementation[].amount | number | Required | maximum: 100000 |
| records[].bundle.input.offspring[].supplementation[].unit | string | Required | minLength: 1; maxLength: 80 |
| records[].bundle.input.offspring[].supplementation[].source | string | Required | minLength: 1; maxLength: 1000 |
| records[].bundle.input.sire | object | Optional | default: {"status":"unknown"} |
| records[].bundle.input.sire.status | string | Required | enum: ["unknown","presumed","confirmed"] |
| records[].bundle.input.sire.animal_id | string | Optional | format: "uuid" |
| records[].bundle.input.sire.provenance | string | Optional | minLength: 1; maxLength: 1000 |
| records[].bundle.input.sire.confidence | number | Optional | minimum: 0; maximum: 1 |
| records[].bundle.input.protocol | object | Optional | |
| records[].bundle.input.protocol.claimed_name | string | Required | minLength: 1; maxLength: 80 |
| records[].bundle.input.protocol.completed_date | string | Required | |
| records[].bundle.input.protocol.version_id | string | Optional | format: "uuid" |
| records[].bundle.input.protocol.offspring_labels | array | Required | minItems: 1; maxItems: 20 |
| records[].bundle.input.protocol.offspring_labels[] | string | Required | minLength: 1; maxLength: 80 |
| records[].bundle.input.follow_up | array | Optional | maxItems: 20; default: [] |
| records[].bundle.input.follow_up[] | object | Required | |
| records[].bundle.input.follow_up[].name | string | Required | minLength: 1; maxLength: 1000 |
| records[].bundle.input.follow_up[].due_date | string | Optional | |
| records[].bundle.input.follow_up[].offspring_labels | array | Required | minItems: 1; maxItems: 20 |
| records[].bundle.input.follow_up[].offspring_labels[] | string | Required | minLength: 1; maxLength: 80 |
| records[].bundle.input.group_ids | array | Optional | maxItems: 20; default: [] |
| records[].bundle.input.group_ids[] | string | Required | format: "uuid" |
| records[].bundle.input.current_location | string | Optional | minLength: 1; maxLength: 80 |
| records[].bundle.input.source_sms_id | string | Optional | format: "uuid" |
| records[].bundle.input.source_message_id | string | Optional | format: "uuid" |
| records[].bundle.input.evidence | array | Optional | maxItems: 20; default: [] |
| records[].bundle.input.evidence[] | object | Required | |
| records[].bundle.input.evidence[].file_id | string | Required | format: "uuid" |
| records[].bundle.input.evidence[].media_id | string | Optional | format: "uuid" |
| records[].bundle.input.evidence[].link_to_dam | boolean | Optional | default: false |
| records[].bundle.input.evidence[].offspring_label | string | Optional | minLength: 1; maxLength: 80 |
| records[].bundle.input.unresolved | array | Optional | maxItems: 30; default: [] |
| records[].bundle.input.unresolved[] | string | Required | minLength: 1; maxLength: 1000 |
| records[].bundle.input.additional_source_sms_ids | array | Optional | maxItems: 20; default: [] |
| records[].bundle.input.additional_source_sms_ids[] | string | Required | format: "uuid" |
| records[].bundle.review | object | Required | |
| records[].record_id | string | Required | format: "uuid" |
| records[].source_sms_id | string or null | Required | format: "uuid" |
| records[].source_message_id | string or null | Required | format: "uuid" |
| records[].agent_action_id | string or null | Required | format: "uuid" |
| records[].created_at | string | Required | format: "date-time" |
| records[].offspring | array | Required | |
| records[].offspring[] | object | Required | |
| records[].offspring[].id | string | Required | format: "uuid" |
| records[].offspring[].birth_event_id | string | Required | format: "uuid" |
| records[].offspring[].animal_id | string | Required | format: "uuid" |
| records[].offspring[].review_label | string | Required | |
| records[].offspring[].position | integer | Required | |
| records[].offspring[].details | object | Required | |
| records[].tasks | array | Required | |
| records[].tasks[] | object | Required | |
| records[].tasks[].id | string | Required | format: "uuid" |
| records[].tasks[].farm_id | string | Required | format: "uuid" |
| records[].tasks[].birth_event_id | string | Required | format: "uuid" |
| records[].tasks[].name | string | Required | |
| records[].tasks[].status | string | Required | enum: ["TODO","DONE","CANCELLED"] |
| records[].tasks[].due_date | string or null | Required | format: "date-time" |
| records[].tasks[].created_at | string | Required | format: "date-time" |
| records[].tasks[].updated_at | string | Required | format: "date-time" |
| records[].tasks[].animals | array | Optional | |
| records[].tasks[].animals[] | object | Required | |
| records[].tasks[].animals[].id | string | Required | format: "uuid" |
| records[].record | object | Required | |
| records[].record.id | string | Required | format: "uuid" |
| records[].record.files | array | Required | |
| records[].record.files[] | object | Required | |
| records[].record.files[].id | string | Required | format: "uuid" |
| records[].record.files[].name | string | Required | |
| records[].record.files[].mime_type | string | Required | |
| records[].care_records | array | Required | |
| records[].care_records[] | object | Required | |
| records[].care_records[].id | string | Required | format: "uuid" |
| records[].care_records[].name | string | Required | |
| records[].care_records[].applied_at | string or null | Required | format: "date-time" |
| records[].care_records[].record_items | array | Required | |
| records[].care_records[].record_items[] | object | Required |
GET /v1/farm/{farm_id}/birth-events/{event_id}
Get a birth event
Retrieve a saved birth and its accessible evidence from the current farm. External credential scopes: read:records. Minimum farm role: READER.
| Parameter | In | Required | Schema |
|---|---|---|---|
| farm_id | path | Yes | {"type":"string","format":"uuid"} |
| event_id | path | Yes | {"type":"string","format":"uuid"} |
Request example
curl --fail-with-body -X GET \
'https://api.ranch.bot/v1/farm/<farm_id>/birth-events/<event_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 |
|---|---|---|---|
| id | string | Required | format: "uuid" |
| farm_id | string | Required | format: "uuid" |
| request_id | string | Required | format: "uuid" |
| confirmation_hash | string | Required | |
| created_by_user_id | string | Required | format: "uuid" |
| dam_id | string | Required | format: "uuid" |
| birth_date | string | Required | format: "date-time" |
| time_precision | string or null | Required | |
| bundle | object | Required | |
| bundle.input | object | Required | |
| bundle.input.dam_id | string | Required | format: "uuid" |
| bundle.input.birth_date | string | Required | |
| bundle.input.time_precision | string | Optional | enum: ["date_only","morning","afternoon","evening","night"]; default: "date_only" |
| bundle.input.dam_update | object | Optional | |
| bundle.input.dam_update.kind | string | Optional | minLength: 1; maxLength: 80 |
| bundle.input.dam_update.notes | string | Optional | minLength: 1; maxLength: 1000 |
| bundle.input.maternal_observations | array | Optional | maxItems: 20; default: [] |
| bundle.input.maternal_observations[] | object | Required | |
| bundle.input.maternal_observations[].date | string | Required | |
| bundle.input.maternal_observations[].text | string | Required | minLength: 1; maxLength: 1000 |
| bundle.input.lactation_observations | array | Optional | maxItems: 20; default: [] |
| bundle.input.lactation_observations[] | object | Required | |
| bundle.input.lactation_observations[].date | string | Required | |
| bundle.input.lactation_observations[].text | string | Required | minLength: 1; maxLength: 1000 |
| bundle.input.offspring | array | Required | minItems: 1; maxItems: 20 |
| bundle.input.offspring[] | object | Required | |
| bundle.input.offspring[].review_label | string | Required | minLength: 1; maxLength: 80 |
| bundle.input.offspring[].sex | string | Required | enum: ["male","female","unknown"] |
| bundle.input.offspring[].birth_weight | object | Optional | |
| bundle.input.offspring[].birth_weight.value | number | Required | maximum: 1000 |
| bundle.input.offspring[].birth_weight.unit | string | Required | enum: ["kg","lb"] |
| bundle.input.offspring[].vigor | array | Optional | maxItems: 20; default: [] |
| bundle.input.offspring[].vigor[] | object | Required | |
| bundle.input.offspring[].vigor[].date | string | Required | |
| bundle.input.offspring[].vigor[].text | string | Required | minLength: 1; maxLength: 1000 |
| bundle.input.offspring[].supplementation | array | Optional | maxItems: 20; default: [] |
| bundle.input.offspring[].supplementation[] | object | Required | |
| bundle.input.offspring[].supplementation[].date | string | Required | |
| bundle.input.offspring[].supplementation[].substance | string | Required | minLength: 1; maxLength: 80 |
| bundle.input.offspring[].supplementation[].amount | number | Required | maximum: 100000 |
| bundle.input.offspring[].supplementation[].unit | string | Required | minLength: 1; maxLength: 80 |
| bundle.input.offspring[].supplementation[].source | string | Required | minLength: 1; maxLength: 1000 |
| bundle.input.sire | object | Optional | default: {"status":"unknown"} |
| bundle.input.sire.status | string | Required | enum: ["unknown","presumed","confirmed"] |
| bundle.input.sire.animal_id | string | Optional | format: "uuid" |
| bundle.input.sire.provenance | string | Optional | minLength: 1; maxLength: 1000 |
| bundle.input.sire.confidence | number | Optional | minimum: 0; maximum: 1 |
| bundle.input.protocol | object | Optional | |
| bundle.input.protocol.claimed_name | string | Required | minLength: 1; maxLength: 80 |
| bundle.input.protocol.completed_date | string | Required | |
| bundle.input.protocol.version_id | string | Optional | format: "uuid" |
| bundle.input.protocol.offspring_labels | array | Required | minItems: 1; maxItems: 20 |
| bundle.input.protocol.offspring_labels[] | string | Required | minLength: 1; maxLength: 80 |
| bundle.input.follow_up | array | Optional | maxItems: 20; default: [] |
| bundle.input.follow_up[] | object | Required | |
| bundle.input.follow_up[].name | string | Required | minLength: 1; maxLength: 1000 |
| bundle.input.follow_up[].due_date | string | Optional | |
| bundle.input.follow_up[].offspring_labels | array | Required | minItems: 1; maxItems: 20 |
| bundle.input.follow_up[].offspring_labels[] | string | Required | minLength: 1; maxLength: 80 |
| bundle.input.group_ids | array | Optional | maxItems: 20; default: [] |
| bundle.input.group_ids[] | string | Required | format: "uuid" |
| bundle.input.current_location | string | Optional | minLength: 1; maxLength: 80 |
| bundle.input.source_sms_id | string | Optional | format: "uuid" |
| bundle.input.source_message_id | string | Optional | format: "uuid" |
| bundle.input.evidence | array | Optional | maxItems: 20; default: [] |
| bundle.input.evidence[] | object | Required | |
| bundle.input.evidence[].file_id | string | Required | format: "uuid" |
| bundle.input.evidence[].media_id | string | Optional | format: "uuid" |
| bundle.input.evidence[].link_to_dam | boolean | Optional | default: false |
| bundle.input.evidence[].offspring_label | string | Optional | minLength: 1; maxLength: 80 |
| bundle.input.unresolved | array | Optional | maxItems: 30; default: [] |
| bundle.input.unresolved[] | string | Required | minLength: 1; maxLength: 1000 |
| bundle.input.additional_source_sms_ids | array | Optional | maxItems: 20; default: [] |
| bundle.input.additional_source_sms_ids[] | string | Required | format: "uuid" |
| bundle.review | object | Required | |
| record_id | string | Required | format: "uuid" |
| source_sms_id | string or null | Required | format: "uuid" |
| source_message_id | string or null | Required | format: "uuid" |
| agent_action_id | string or null | Required | format: "uuid" |
| created_at | string | Required | format: "date-time" |
| offspring | array | Required | |
| offspring[] | object | Required | |
| offspring[].id | string | Required | format: "uuid" |
| offspring[].birth_event_id | string | Required | format: "uuid" |
| offspring[].animal_id | string | Required | format: "uuid" |
| offspring[].review_label | string | Required | |
| offspring[].position | integer | Required | |
| offspring[].details | object | Required | |
| tasks | array | Required | |
| tasks[] | object | Required | |
| tasks[].id | string | Required | format: "uuid" |
| tasks[].farm_id | string | Required | format: "uuid" |
| tasks[].birth_event_id | string | Required | format: "uuid" |
| tasks[].name | string | Required | |
| tasks[].status | string | Required | enum: ["TODO","DONE","CANCELLED"] |
| tasks[].due_date | string or null | Required | format: "date-time" |
| tasks[].created_at | string | Required | format: "date-time" |
| tasks[].updated_at | string | Required | format: "date-time" |
| tasks[].animals | array | Optional | |
| tasks[].animals[] | object | Required | |
| tasks[].animals[].id | string | Required | format: "uuid" |
| record | object | Required | |
| record.id | string | Required | format: "uuid" |
| record.files | array | Required | |
| record.files[] | object | Required | |
| record.files[].id | string | Required | format: "uuid" |
| record.files[].name | string | Required | |
| record.files[].mime_type | string | Required | |
| care_records | array | Required | |
| care_records[] | object | Required | |
| care_records[].id | string | Required | format: "uuid" |
| care_records[].name | string | Required | |
| care_records[].applied_at | string or null | Required | format: "date-time" |
| care_records[].record_items | array | Required | |
| care_records[].record_items[] | object | Required |
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.
{
"success": false,
"errors": [
{
"code": 400,
"name": "ValidationError",
"message": "Example validation failure"
}
]
}