---
title: "Create custom field definition"
method: POST
path: "/cohorts/{cohortId}/custom-fields"
tags: ["Custom Fields"]
---

# Create custom field definition

`POST /cohorts/{cohortId}/custom-fields`

## Request

- Base URL: `https://api.production.yourmedley.com`
- URL: `https://api.production.yourmedley.com/cohorts/{cohortId}/custom-fields`
- Auth: HTTP bearer

Create a new custom field definition for a cohort

## Path parameters

- `cohortId` string, uuid, required

## Request body

- object
  - `field_name` string, required: Internal field name (used as key in JSONB)
  - `field_label` string, required: Display label for the field
  - `field_type` 'text' | 'number' | 'date' | 'boolean'

## Response `201`

Custom field created successfully

## Other responses

- `400`: Missing required fields
- `401`: Unauthorized
- `404`: Cohort not found
- `409`: Field name already exists

---

[API](https://skmtc.dev/withmedley/apis/medley-api.md) - [All operations](https://skmtc.dev/withmedley/apis/medley-api/llms.txt) - [OpenAPI document](https://skmtc.dev/withmedley/apis/medley-api/revisions/40aaac5ca6bd?raw)
