> 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.

# Get Sync Target

GET https://app.polytomic.com/api/connections/{id}/modelsync/target/fields

Returns the fields, modes, and properties of a target object on a connection.

Pass the target object identifier to retrieve the fields available for
mapping on that object. These are the destination fields you can reference
when configuring field mappings in a model sync.

> 📘 To list available target objects and their identifiers, use
> [`GET /api/connections/{id}/modelsync/targetobjects`](../../../../../../api-reference/model-sync/targets/list).

Fields returned here reflect the connection's current cached state. If the
upstream object schema has changed, trigger a schema refresh with
[`POST /api/connections/{id}/schemas/refresh`](../../../../../../api-reference/schemas/refresh)
before calling this endpoint.

## Fields for a target that hasn't been created yet

Some connections support creating a new destination object as part of a
model sync — for example, a Facebook Ads custom audience or a LinkedIn Ads
contact list. In that case there is no existing target identifier to pass;
instead, describe the new target with the same properties returned in the
`target_creation` block of
[`GET /api/connections/{id}/modelsync/targetobjects`](../../../../../../api-reference/model-sync/targets/list),
and this endpoint will return the fields the new target will expose.

Exactly one of `target` or `properties` must be supplied. Each input is
sent as a separate `properties[key]=value` query parameter. For a Facebook
Ads connection that requires an `account` and a `name`:

```
GET /api/connections/{id}/modelsync/target/fields
  ?properties[account]=act_1234567
  &properties[name]=My%20new%20audience
```

The response shape is identical to the existing-target form. For backends
where the new target's field set is fixed (most ads platforms), `fields`
contains those fields; for backends where the columns are user-defined
(e.g. a SQL database), `fields` will be empty and the caller defines the
columns at mapping time.

When `properties` is supplied, the `refresh` parameter is ignored — a
not-yet-created target has no cached schema to refresh.

Reference: https://apidocs.polytomic.com/api-reference/model-sync/targets/get-target-fields

## Authentication

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

## Request

### Path parameters

- `id` (string, required) — Unique identifier of the connection.

### Query parameters

- `target` (string, optional) — Identifier of the target object (e.g. schema.table for a database destination, object name for a SaaS destination). Required unless properties is supplied.
- `refresh` (boolean, optional) — When true, force a cache refresh of the target's schema before returning its fields. Ignored when properties is supplied.
- `properties` (map from string to list of string, optional) — Target-creation property values, supplied as properties\[key]=value, matching the target\_creation.properties returned by GET /api/connections/\{id}/modelsync/targetobjects. When supplied, the response describes the not-yet-created target that would result from these inputs, in the same shape as for an existing target. Exactly one of target or properties must be supplied.

## Response

### 200

OK

- `data` (TargetResponse, optional)

## Errors

### 400 Bad Request Error

Bad Request

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

### 403 Forbidden Error

Forbidden

- `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

### TargetResponse

- `fields` (list of TargetField, optional, nullable) — Fields available for mapping on this target. Empty for backends where the new target's columns are user-defined (e.g. SQL databases).
- `id` (string, optional) — Backend-specific identifier of the target object. For not-yet-created targets, this is an internal placeholder identifier that callers should not rely on.
- `modes` (list of Mode, optional, nullable) — Sync modes the target supports (e.g. create, update, upsert). The chosen mode determines which operations the sync may perform.
- `name` (string, optional) — Human-readable name of the target object.
- `properties` (SyncDestinationProperties, optional)
- `refreshed_at` (datetime, optional) — Timestamp the target's cached schema was last refreshed. Zero for targets that do not have a cached schema (including not-yet-created targets).

### TargetField

- `association` (boolean, optional) — True if this field is an association (foreign key) to another object rather than a value column.
- `createable` (boolean, optional) — True if this field can be written when creating a new record.
- `description` (string, optional) — Description of the field, when the backend provides one.
- `encryptable` (boolean, optional) — True if this field supports field-level encryption.
- `filter_functions` (list of SupportedFilterFunction, optional, nullable) — Comparisons this field accepts in a target filter. A condition whose function is absent from this list is rejected when the sync is saved. Empty when the destination publishes no per-field list, in which case any comparison is accepted.
- `filterable` (boolean, optional) — True if this field can be used in a target filter.
- `id` (string, optional) — Backend-specific identifier of the field; use this value when configuring field mappings.
- `identity_functions` (list of IdentityFunction, optional, nullable) — Identity match functions supported when this field is used as the sync identity (e.g. exact match, hashed match).
- `multiple_associations` (boolean, optional) — True if this association field holds a set of references rather than one; every value mapped to it is a member of the set. False for a field that is not an association, and for one whose destination has not declared how many references the relationship holds.
- `name` (string, optional) — Human-readable name of the field.
- `required` (boolean, optional) — True if a model sync must map a value to this field for records to be accepted.
- `source_type` (string, optional) — Native type reported by the destination system.
- `supports_identity` (boolean, optional) — True if this field may be used as the identity (match key) for syncs that require one.
- `type` (string, optional) — Polytomic-normalized type used when mapping values to this field.
- `updateable` (boolean, optional) — True if this field can be written when updating an existing record.
- `values` (list of PickValue, optional) — Stored field options as value and label pairs. Use value when configuring mappings. Omitted when no options are available; enumeration fields may still omit options.

### Mode

- `description` (string, optional) — Description of the operations performed in this mode.
- `label` (string, optional) — Human-readable label for the sync mode.
- `mode` (string, optional) — Identifier of the sync mode; use this value when configuring a sync.
- `requires_identity` (boolean, optional) — True if this mode requires a sync identity to match records on.
- `supports_field_sync_mode` (boolean, optional) — True if per-field sync modes (e.g. write-once vs. always-update) may be configured under this mode.
- `supports_target_filters` (boolean, optional) — True if this mode allows target filters to constrain which destination records are touched.

### SyncDestinationProperties

- `does_not_report_operation_counts` (boolean, optional) — True if execution reports for this destination will not break record counts out by operation (insert vs. update); typical for upsert-only destinations.
- `mappings_not_required` (boolean, optional) — True if a sync may be configured with only a target identity and no field mappings.
- `new_target_label` (string, optional) — Label to display when prompting for the name of a newly-created target (e.g. "Audience name", "Table name").
- `optional_target_mappings` (boolean, optional) — True if a sync may pick source fields without mapping each one to a specific target field (used by webhooks and target creators).
- `primary_metadata_object` (string, optional) — For destinations with multiple metadata dictionaries, identifies which dictionary new custom properties should be added to.
- `requires_configuration` (boolean, optional) — True if the destination requires target-level configuration before a sync can run.
- `supports_field_creation` (boolean, optional) — True if a sync may create new fields on this target as part of mapping.
- `supports_field_encryption` (boolean, optional) — True if the destination supports field-level encryption.
- `supports_field_type_selection` (boolean, optional) — True if the type of a newly-created field can be chosen at sync configuration time.
- `supports_filter_value_fields` (boolean, optional) — True if a target filter on this destination may compare against a model field's value, resolved separately for each record, rather than against a literal value.
- `supports_identity_field_creation` (boolean, optional) — True if a sync may create a new field on this target to use as the sync identity.
- `supports_multiple_identities` (boolean, optional) — True if the destination can match records on more than one identity mapping.
- `supports_target_filters` (boolean, optional) — True if target filters are supported on this destination; the chosen sync mode may further constrain availability.
- `target_creator` (boolean, optional) — True if writing to this target will create a new object in the destination system rather than write to an existing one.
- `use_field_names_as_labels` (boolean, optional) — True if field IDs (rather than display names) should be used when labeling records in previews and logs.

### SupportedFilterFunction

- `id` (enum, optional)
  - Allowed values: `Equality`, `Inequality`, `IsNull`, `IsNotNull`, `True`, `False`, `OnOrAfter`, `OnOrBefore`, `GreaterThan`, `GreaterThanEqual`, `LessThan`, `LessThanEqual`, `StringContains`, `StringStartsWith`, `StringEndsWith`, `StringDoesNotContain`, `StringDoesNotStartWith`, `StringDoesNotEndWith`, `StringOneOf`, `StringNotOneOf`, `Between`, `ArrayContains`, `ArrayDoesNotContain`, `InTheLast`, `RelativeOnOrBefore`, `RelativeOnOrAfter`, `StringLike`, `StringNotLike`, `StringMatchesTrimmed`
- `label` (string, optional) — Human-readable label for the comparison.
- `multi_value` (boolean, optional) — True if this comparison takes a list of values rather than a single one.
- `requires_value` (boolean, optional) — True if a condition using this comparison must carry a value; comparisons such as 'IsNotNull' take none.
- `values` (list of PickValue, optional, nullable) — Closed set of values this comparison accepts. A condition whose value is absent from this list is rejected when the sync is saved: the relative datetime comparisons ('InTheLast', 'RelativeOnOrAfter', 'RelativeOnOrBefore') take one of these duration keywords rather than a timestamp. Empty when the comparison accepts any value that coerces to the field's type.

### IdentityFunction

- `id` (string, optional) — Identifier of the identity function; use this value when configuring the sync identity.
- `label` (string, optional) — Human-readable label for the identity function.

### 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

**Response**

```json
{
  "data": {
    "fields": [
      {
        "association": false,
        "createable": true,
        "description": "Field description",
        "encryptable": false,
        "filter_functions": [
          {
            "id": "Equality",
            "label": "equals",
            "multi_value": false,
            "requires_value": true,
            "values": [
              {
                "depends_on": {},
                "label": "string",
                "value": "string"
              }
            ]
          }
        ],
        "filterable": true,
        "id": "field1",
        "identity_functions": [
          {
            "id": "Equality",
            "label": "Equality"
          }
        ],
        "multiple_associations": false,
        "name": "Field",
        "required": true,
        "source_type": "string",
        "supports_identity": false,
        "type": "string",
        "updateable": true,
        "values": [
          {
            "depends_on": {},
            "label": "string",
            "value": "string"
          }
        ]
      }
    ],
    "id": "database.table",
    "modes": [
      {
        "description": "Create records when they don't exist; don't update existing ones",
        "label": "Create",
        "mode": "create",
        "requires_identity": true,
        "supports_field_sync_mode": false,
        "supports_target_filters": false
      }
    ],
    "name": "Table",
    "properties": {
      "does_not_report_operation_counts": true,
      "mappings_not_required": true,
      "new_target_label": "string",
      "optional_target_mappings": true,
      "primary_metadata_object": "string",
      "requires_configuration": true,
      "supports_field_creation": true,
      "supports_field_encryption": true,
      "supports_field_type_selection": true,
      "supports_filter_value_fields": true,
      "supports_identity_field_creation": true,
      "supports_multiple_identities": true,
      "supports_target_filters": true,
      "target_creator": true,
      "use_field_names_as_labels": true
    },
    "refreshed_at": "2024-01-01T00:00:00Z"
  }
}
```

**SDK Code**

```python
import requests

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

headers = {"Authorization": "Bearer <token>"}

response = requests.get(url, headers=headers)

print(response.json())
```

```javascript
const url = 'https://app.polytomic.com/api/connections/248df4b7-aa70-47b8-a036-33ac447e668d/modelsync/target/fields';
const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};

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"
	"net/http"
	"io"
)

func main() {

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

	req, _ := http.NewRequest("GET", url, nil)

	req.Header.Add("Authorization", "Bearer <token>")

	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/modelsync/target/fields")

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

request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'

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.get("https://app.polytomic.com/api/connections/248df4b7-aa70-47b8-a036-33ac447e668d/modelsync/target/fields")
  .header("Authorization", "Bearer <token>")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('GET', 'https://app.polytomic.com/api/connections/248df4b7-aa70-47b8-a036-33ac447e668d/modelsync/target/fields', [
  'headers' => [
    'Authorization' => 'Bearer <token>',
  ],
]);

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

```csharp
using RestSharp;

var client = new RestClient("https://app.polytomic.com/api/connections/248df4b7-aa70-47b8-a036-33ac447e668d/modelsync/target/fields");
var request = new RestRequest(Method.GET);
request.AddHeader("Authorization", "Bearer <token>");
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = ["Authorization": "Bearer <token>"]

let request = NSMutableURLRequest(url: NSURL(string: "https://app.polytomic.com/api/connections/248df4b7-aa70-47b8-a036-33ac447e668d/modelsync/target/fields")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "GET"
request.allHTTPHeaderFields = headers

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()
```