> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://developer.crehana.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://developer.crehana.com/_mcp/server.

# Create Custom Field

POST https://www.crehana.com/api/v5/rest/org/{organization_slug}/custom-fields/
Content-Type: application/json

**Purpose:** Allows creating extra company fields..

Reference: https://developer.crehana.com/api-reference/endpoints/custom-fields/create-custom-field

## Authentication

- `Api-Key` header (required) — API key of the organization. Always sent together with the `Secret-Access` header.

## Servers

- `https://www.crehana.com` (Production, default)
- `https://qa.creha.co` (QA)

## Request

### Path parameters

- `organization_slug` (string, required)

### Query parameters

- `version` (string, optional, default: 1)

### Body (application/json)

This endpoint expects a CreateCustomFieldInput.

- `name` (string, required)
- `description` (string, required)
- `type` (enum, required) — An enumeration.
  - Allowed values: `TEXT`, `NUMBER`, `DATE`, `MULTIPLE`
- `can_edit` (boolean, required)
- `is_mandatory` (boolean, required)
- `is_visible` (boolean, required)
- `max_length` (integer, optional)
- `where_mandatory` (enum, optional) — An enumeration.
  - Allowed values: `CREATION`, `PROFILE`
- `custom_field_choices` (list of CreateCustomFieldChoiceInput, optional)

## Response

### 200

Successful Response

- `any`

## Errors

### 422 Unprocessable Entity Error

Validation Error

- `detail` (list of ValidationError, optional)

## Types

### CreateCustomFieldChoiceInput

- `name` (string, required)

### ValidationError

- `loc` (list of ValidationErrorLocItems, required)
- `msg` (string, required)
- `type` (string, required)

### ValidationErrorLocItems

## Examples

**Request**

```json
{
  "name": "string",
  "description": "string",
  "type": "TEXT",
  "can_edit": true,
  "is_mandatory": true,
  "is_visible": true
}
```

**SDK Code**

```python
import requests

url = "https://www.crehana.com/api/v5/rest/org/organization_slug/custom-fields/"

payload = {
    "name": "string",
    "description": "string",
    "type": "TEXT",
    "can_edit": True,
    "is_mandatory": True,
    "is_visible": True
}
headers = {
    "Secret-Access": "Secret-Access",
    "Api-Key": "<apiKey>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript
const url = 'https://www.crehana.com/api/v5/rest/org/organization_slug/custom-fields/';
const options = {
  method: 'POST',
  headers: {
    'Secret-Access': 'Secret-Access',
    'Api-Key': '<apiKey>',
    'Content-Type': 'application/json'
  },
  body: '{"name":"string","description":"string","type":"TEXT","can_edit":true,"is_mandatory":true,"is_visible":true}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://www.crehana.com/api/v5/rest/org/organization_slug/custom-fields/"

	payload := strings.NewReader("{\n  \"name\": \"string\",\n  \"description\": \"string\",\n  \"type\": \"TEXT\",\n  \"can_edit\": true,\n  \"is_mandatory\": true,\n  \"is_visible\": true\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("Secret-Access", "Secret-Access")
	req.Header.Add("Api-Key", "<apiKey>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby
require 'uri'
require 'net/http'

url = URI("https://www.crehana.com/api/v5/rest/org/organization_slug/custom-fields/")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Secret-Access"] = 'Secret-Access'
request["Api-Key"] = '<apiKey>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"name\": \"string\",\n  \"description\": \"string\",\n  \"type\": \"TEXT\",\n  \"can_edit\": true,\n  \"is_mandatory\": true,\n  \"is_visible\": true\n}"

response = http.request(request)
puts response.read_body
```

```java
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://www.crehana.com/api/v5/rest/org/organization_slug/custom-fields/")
  .header("Secret-Access", "Secret-Access")
  .header("Api-Key", "<apiKey>")
  .header("Content-Type", "application/json")
  .body("{\n  \"name\": \"string\",\n  \"description\": \"string\",\n  \"type\": \"TEXT\",\n  \"can_edit\": true,\n  \"is_mandatory\": true,\n  \"is_visible\": true\n}")
  .asString();
```

```php
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://www.crehana.com/api/v5/rest/org/organization_slug/custom-fields/', [
  'body' => '{
  "name": "string",
  "description": "string",
  "type": "TEXT",
  "can_edit": true,
  "is_mandatory": true,
  "is_visible": true
}',
  'headers' => [
    'Api-Key' => '<apiKey>',
    'Content-Type' => 'application/json',
    'Secret-Access' => 'Secret-Access',
  ],
]);

echo $response->getBody();
```

```csharp
using RestSharp;

var client = new RestClient("https://www.crehana.com/api/v5/rest/org/organization_slug/custom-fields/");
var request = new RestRequest(Method.POST);
request.AddHeader("Secret-Access", "Secret-Access");
request.AddHeader("Api-Key", "<apiKey>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"name\": \"string\",\n  \"description\": \"string\",\n  \"type\": \"TEXT\",\n  \"can_edit\": true,\n  \"is_mandatory\": true,\n  \"is_visible\": true\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = [
  "Secret-Access": "Secret-Access",
  "Api-Key": "<apiKey>",
  "Content-Type": "application/json"
]
let parameters = [
  "name": "string",
  "description": "string",
  "type": "TEXT",
  "can_edit": true,
  "is_mandatory": true,
  "is_visible": true
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://www.crehana.com/api/v5/rest/org/organization_slug/custom-fields/")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```