---
title: "Create Record"
method: POST
path: "/v1/farm/{farm_id}/records"
tags: ["records"]
---

# Create Record

`POST /v1/farm/{farm_id}/records`

## Request

- Base URL: `https://api.ranch.bot`
- URL: `https://api.ranch.bot/v1/farm/{farm_id}/records`
- Auth: HTTP bearer

Current records HTTP operation. External credential scopes: write:records; a typed traceability payload that carries identification.profile_update additionally requires write:animals. 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. Legacy creation requires at least one animal_ids or group_ids entry attached to an active entity in this farm. Typed creation supplies `traceability` and requires an opaque `request_key` (1-200 characters); it does not require those associations. The 201 response is the created record for legacy creation or a `{ "event": ... }` envelope for typed creation. Associations must name active entities in this farm; the service filters out ids outside that set. Supply ids obtained from the same farm.

## Path parameters

- `farm_id` string, uuid, required

## Request body

- union
  - object
    - `animal_ids` string[]
    - `group_ids` string[]
    - `description` string
    - `name` string, required
    - `type` 'FEED' | 'GENETIC' | 'HEALTH' | 'MOVEMENT' | 'OTHER', required
    - `applied_at` string, date-time, required
    - `traceability` object, required: Optional versioned schema-1 traceability payload. When present the request creates a typed event instead of a legacy record and request_key is required.
    - `request_key` string, required: Opaque idempotency key (1-200 characters). Required with traceability and ignored for legacy creation.
  - object
    - `animal_ids` string[], required
    - `group_ids` string[]
    - `description` string
    - `name` string, required
    - `type` 'FEED' | 'GENETIC' | 'HEALTH' | 'MOVEMENT' | 'OTHER', required
    - `applied_at` string, date-time, required
    - `traceability` object: Optional versioned schema-1 traceability payload. When present the request creates a typed event instead of a legacy record and request_key is required.
    - `request_key` string: Opaque idempotency key (1-200 characters). Required with traceability and ignored for legacy creation.
  - object
    - `animal_ids` string[]
    - `group_ids` string[], required
    - `description` string
    - `name` string, required
    - `type` 'FEED' | 'GENETIC' | 'HEALTH' | 'MOVEMENT' | 'OTHER', required
    - `applied_at` string, date-time, required
    - `traceability` object: Optional versioned schema-1 traceability payload. When present the request creates a typed event instead of a legacy record and request_key is required.
    - `request_key` string: Opaque idempotency key (1-200 characters). Required with traceability and ignored for legacy creation.

## Response `201`

Success

- union
  - object
    - `type` 'OTHER' | 'FEED' | 'GENETIC' | 'HEALTH' | 'MOVEMENT', required
    - `id` string, required
    - `created_at` string, date-time, required
    - `updated_at` string, date-time, required
    - `name` string, required
    - `is_active` boolean, required
    - `description` string, nullable, required
    - `applied_at` string, date-time, required
  - object
    - `event` object, required: The created typed traceability event envelope.

## Other responses

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

---

[API](https://skmtc.dev/ranch/apis/ranch-bot-http-api.md) · [All operations](https://skmtc.dev/ranch/apis/ranch-bot-http-api/llms.txt) · [OpenAPI document](https://skmtc.dev/ranch/apis/ranch-bot-http-api/revisions/24109d33fa02?raw)
