> This page is for version 2025-09-18 (default).
> For other versions, use one of these documentation indexes:
> - 2025-09-18 (default): https://apidocs.polytomic.com/2025-09-18/llms.txt
> - 2024-02-08: https://apidocs.polytomic.com/2024-02-08/llms.txt
> - 2023-04-25: https://apidocs.polytomic.com/2023-04-25/llms.txt
> - 2022-12-12: https://apidocs.polytomic.com/2022-12-12/llms.txt
> - 2021-05-23: https://apidocs.polytomic.com/2021-05-23/llms.txt

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

# Patch Schema Field

PATCH https://app.polytomic.com/api/connections/{connection_id}/schemas/{schema_id}/fields/{field_id}
Content-Type: application/json

Edits a single field on a schema, creating an override for a detected field if needed.

Reference: https://apidocs.polytomic.com/api-reference/schemas/patch-field

## Authentication

- `Authorization` header (bearer token, required) — Bearer user API key
- `Authorization` header (basic auth, required) — Basic organization-scoped API key

## Request

### Path parameters

- `connection_id` (string, required) — Connection holding the schema.
- `schema_id` (string, required) — Schema identifier.
- `field_id` (string, required) — Field identifier within the schema.

### Body (application/json)

This endpoint expects a PatchSchemaFieldRequest.

- `definition` (TypesDefinition, optional) — Detailed field type: a type name such as "bigint", or an array naming a complex type followed by its details, such as \["decimal", \{"precision": 10, "scale": 2}] or \["array", "string"].
- `example` (any, optional) — Sample value surfaced in the UI.
- `label` (string, optional, nullable) — Human-readable label for the field.
- `path` (string, optional, nullable) — JSONPath used to extract the field from each source record; only meaningful for document-style backends. Pass an empty string to clear an existing path.
- `type` (string, optional, nullable) — One of: string, number, boolean, datetime, array, object, binary. Changing the type without supplying a matching definition clears any prior detailed type metadata.

## Response

### 200

OK

- `data` (SchemaField, optional)

## Errors

### 400 Bad Request Error

Bad Request

- `key` (string, optional)
- `message` (string, optional)
- `metadata` (map from string to any, optional)
- `status` (integer, optional)

### 404 Not Found Error

Not Found

- `key` (string, optional)
- `message` (string, optional)
- `metadata` (map from string to any, optional)
- `status` (integer, optional)

### 500 Internal Server Error

Internal Server Error

- `key` (string, optional)
- `message` (string, optional)
- `metadata` (map from string to any, optional)
- `status` (integer, optional)

## Types

### TypesDefinition

Detailed field type: a type name such as "bigint", or an array naming a complex type followed by its details, such as \["decimal", \{"precision": 10, "scale": 2}] or \["array", "string"].

### SchemaField

- `association` (SchemaAssociation, optional)
- `id` (string, optional)
- `is_primary_key` (boolean, optional) — Whether this field is part of the schema's primary key, including any user override.
- `name` (string, optional)
- `path` (string, optional) — JSONPath used to extract the field from each source record; only meaningful for document-style backends.
- `primary_key_override` (boolean, optional, nullable) — The user-set primary key status for this field, which takes precedence over source_primary_key; omitted when no override is set.
- `remote_type` (string, optional) — The type of the field from the remote system.
- `source_primary_key` (boolean, optional) — Whether the source system reports this field as part of the schema's primary key.
- `type` (enum, optional)
  - Allowed values: `unknown`, `string`, `number`, `boolean`, `datetime`, `array`, `object`, `binary`
- `type_spec` (any, optional)
- `user_managed` (boolean, optional) — True when the field's effective definition came from a user override.
- `values` (list of PickValue, optional)

### SchemaAssociation

- `id` (string, optional)
- `name` (string, optional)
- `reference_to` (list of string, optional)
- `referenced_field` (string, optional)

### PickValue

- `depends_on` (map from string to string, optional) — Field IDs and internal values required for this option to apply. All entries must match. Omitted for independent options.
- `label` (string, optional)
- `value` (string, optional)

## Examples

**Request**

```json
{}
```

**Response**

```json
{
  "data": {
    "association": {
      "id": "string",
      "name": "string",
      "reference_to": [
        "string"
      ],
      "referenced_field": "string"
    },
    "id": "email",
    "is_primary_key": true,
    "name": "Email",
    "path": "string",
    "primary_key_override": true,
    "remote_type": "varchar(255)",
    "source_primary_key": false,
    "type": "unknown",
    "user_managed": true,
    "values": [
      {
        "depends_on": {},
        "label": "string",
        "value": "string"
      }
    ]
  }
}
```

**SDK Code**

```python
import requests

url = "https://app.polytomic.com/api/connections/248df4b7-aa70-47b8-a036-33ac447e668d/schemas/schema_id/fields/field_id"

payload = {}
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

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

print(response.json())
```

```javascript
const url = 'https://app.polytomic.com/api/connections/248df4b7-aa70-47b8-a036-33ac447e668d/schemas/schema_id/fields/field_id';
const options = {
  method: 'PATCH',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: '{}'
};

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://app.polytomic.com/api/connections/248df4b7-aa70-47b8-a036-33ac447e668d/schemas/schema_id/fields/field_id"

	payload := strings.NewReader("{}")

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

	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://app.polytomic.com/api/connections/248df4b7-aa70-47b8-a036-33ac447e668d/schemas/schema_id/fields/field_id")

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

request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{}"

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.patch("https://app.polytomic.com/api/connections/248df4b7-aa70-47b8-a036-33ac447e668d/schemas/schema_id/fields/field_id")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{}")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('PATCH', 'https://app.polytomic.com/api/connections/248df4b7-aa70-47b8-a036-33ac447e668d/schemas/schema_id/fields/field_id', [
  'body' => '{}',
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
  ],
]);

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

```csharp
using RestSharp;

var client = new RestClient("https://app.polytomic.com/api/connections/248df4b7-aa70-47b8-a036-33ac447e668d/schemas/schema_id/fields/field_id");
var request = new RestRequest(Method.PATCH);
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = [
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
]
let parameters = [] as [String : Any]

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

let request = NSMutableURLRequest(url: NSURL(string: "https://app.polytomic.com/api/connections/248df4b7-aa70-47b8-a036-33ac447e668d/schemas/schema_id/fields/field_id")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "PATCH"
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()
```