> This page is for Unified.

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

# /target-fields

POST https://api.merge.dev/api/ticketing/v1/target-fields
Content-Type: application/json

Create a new organization-wide Target Field. Target Fields are custom fields that your organization defines to collect supplemental data from integrations. [Learn more](https://docs.merge.dev/supplemental-data/field-mappings/target-fields/).

Reference: https://docs.merge.dev/merge-unified/ticketing/linked-account/field-mapping/target-fields-retrieve

## Authentication

- `Authorization` header (bearer token, required) — Token-based authentication with required prefix "Bearer"

## Servers

- `https://api.merge.dev/api` (Production, default)
- `https://api-eu.merge.dev/api` (ProductionEU)
- `https://api-ap.merge.dev/api` (ProductionAPSE1)

## Request

### Headers

- `X-Account-Token` (string, required) — Token identifying the end user.

### Body (application/json)

This endpoint expects a CreateTargetFieldRequest.

- `name` (string, required) — The name of the target field.
- `common_model` (string, required) — The name of the Common Model to associate the target field with.
- `description` (string, optional, default: ) — The description of the target field.

## Response

### 200

- `Ticket` (list of ExternalTargetFieldAPI, optional)
- `Comment` (list of ExternalTargetFieldAPI, optional)
- `Project` (list of ExternalTargetFieldAPI, optional)
- `Collection` (list of ExternalTargetFieldAPI, optional)
- `User` (list of ExternalTargetFieldAPI, optional)
- `Role` (list of ExternalTargetFieldAPI, optional)
- `Account` (list of ExternalTargetFieldAPI, optional)
- `Team` (list of ExternalTargetFieldAPI, optional)
- `Attachment` (list of ExternalTargetFieldAPI, optional)
- `Tag` (list of ExternalTargetFieldAPI, optional)
- `Contact` (list of ExternalTargetFieldAPI, optional)

## Types

### ExternalTargetFieldAPI

- `name` (string, optional, nullable)
- `description` (string, optional, nullable)
- `is_mapped` (string, optional, nullable)

## Examples

**Request**

```json
{
  "name": "employee_favorite_team",
  "common_model": "Employee"
}
```

**Response**

```json
{
  "Ticket": [
    {
      "name": "example_target_field_name",
      "description": "this is a example description of a target field",
      "is_mapped": "true"
    }
  ],
  "Comment": [
    {
      "name": "example_target_field_name",
      "description": "this is a example description of a target field",
      "is_mapped": "true"
    }
  ],
  "Project": [
    {
      "name": "example_target_field_name",
      "description": "this is a example description of a target field",
      "is_mapped": "true"
    }
  ],
  "Collection": [
    {
      "name": "example_target_field_name",
      "description": "this is a example description of a target field",
      "is_mapped": "true"
    }
  ],
  "User": [
    {
      "name": "example_target_field_name",
      "description": "this is a example description of a target field",
      "is_mapped": "true"
    }
  ],
  "Role": [
    {
      "name": "example_target_field_name",
      "description": "this is a example description of a target field",
      "is_mapped": "true"
    }
  ],
  "Account": [
    {
      "name": "example_target_field_name",
      "description": "this is a example description of a target field",
      "is_mapped": "true"
    }
  ],
  "Team": [
    {
      "name": "example_target_field_name",
      "description": "this is a example description of a target field",
      "is_mapped": "true"
    }
  ],
  "Attachment": [
    {
      "name": "example_target_field_name",
      "description": "this is a example description of a target field",
      "is_mapped": "true"
    }
  ],
  "Tag": [
    {
      "name": "example_target_field_name",
      "description": "this is a example description of a target field",
      "is_mapped": "true"
    }
  ],
  "Contact": [
    {
      "name": "example_target_field_name",
      "description": "this is a example description of a target field",
      "is_mapped": "true"
    }
  ]
}
```

**SDK Code**

```python
import requests

url = "https://api.merge.dev/api/ticketing/v1/target-fields"

payload = {
    "name": "employee_favorite_team",
    "common_model": "Employee"
}
headers = {
    "X-Account-Token": "X-Account-Token",
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

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

print(response.json())
```

```javascript
const url = 'https://api.merge.dev/api/ticketing/v1/target-fields';
const options = {
  method: 'POST',
  headers: {
    'X-Account-Token': 'X-Account-Token',
    Authorization: 'Bearer <token>',
    'Content-Type': 'application/json'
  },
  body: '{"name":"employee_favorite_team","common_model":"Employee"}'
};

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://api.merge.dev/api/ticketing/v1/target-fields"

	payload := strings.NewReader("{\n  \"name\": \"employee_favorite_team\",\n  \"common_model\": \"Employee\"\n}")

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

	req.Header.Add("X-Account-Token", "X-Account-Token")
	req.Header.Add("Authorization", "Bearer <token>")
	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://api.merge.dev/api/ticketing/v1/target-fields")

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

request = Net::HTTP::Post.new(url)
request["X-Account-Token"] = 'X-Account-Token'
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"name\": \"employee_favorite_team\",\n  \"common_model\": \"Employee\"\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://api.merge.dev/api/ticketing/v1/target-fields")
  .header("X-Account-Token", "X-Account-Token")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"name\": \"employee_favorite_team\",\n  \"common_model\": \"Employee\"\n}")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.merge.dev/api/ticketing/v1/target-fields', [
  'body' => '{
  "name": "employee_favorite_team",
  "common_model": "Employee"
}',
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
    'X-Account-Token' => 'X-Account-Token',
  ],
]);

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

```csharp
using RestSharp;

var client = new RestClient("https://api.merge.dev/api/ticketing/v1/target-fields");
var request = new RestRequest(Method.POST);
request.AddHeader("X-Account-Token", "X-Account-Token");
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"name\": \"employee_favorite_team\",\n  \"common_model\": \"Employee\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = [
  "X-Account-Token": "X-Account-Token",
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
]
let parameters = [
  "name": "employee_favorite_team",
  "common_model": "Employee"
] as [String : Any]

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

let request = NSMutableURLRequest(url: NSURL(string: "https://api.merge.dev/api/ticketing/v1/target-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()
```