> This page is for version 2024-02-08.
> 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.

# Model Sync Field Query

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

Returns the source fields available on a connection for a given source configuration.

Pass the model's source configuration as query parameters to resolve the
fields that the connection will expose for that specific configuration. The
returned fields are what can be referenced in sync field mappings.

> 📘 Results depend on the source configuration you supply. A different
> table or query in the configuration may return a completely different field
> list.

The available source configuration parameters are described by
[`GET /api/connections/{id}/modelsync/source`](../../../../../../api-reference/model-sync/get-source).

## Query parameter format

Send each source setting as a bracketed key with a single string value. For
example, a source configured with `stream_id: "deals"` uses
`params[stream_id]=deals`.

With Polytomic MCP, pass the bracketed key directly in `query`:

```javascript
async () => {
  return polytomic.request({
    method: "GET",
    path: "/api/connections/<connection_id>/modelsync/source/fields",
    query: {"params[stream_id]": "deals"}
  });
}
```

> ⚠️ Send one value per setting
>
> Each setting uses only the first value if you repeat its query key. An empty
> array suffix, such as `params[stream_id][]=deals`, is rejected with
> `400 Bad Request`. Use `params[stream_id]=deals` instead.

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

## Authentication

- `Authorization` header (basic auth, required) — This is the Polytomic deployment key (on-premises only)
- `Authorization` header (bearer token, required) — This is the Polytomic API key

## Request

### Path parameters

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

### Query parameters

- `params` (map from string to string, optional) — Source configuration, matching the params used with GET /api/connections/\{id}/modelsync/source, that selects the specific source to return fields for.

## Response

### 200

OK

- `data` (list of V2ModelField, optional, nullable)

## Errors

### 400 Bad Request Error

Bad Request

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

### 401 Unauthorized Error

Unauthorized

- `code` (integer, optional) — Application-specific error code.
- `context` (map from string to any, optional) — Application context.
- `error` (string, optional) — Error message.
- `status` (string, optional) — Status text.

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

### V2ModelField

- `created_at` (string, optional)
- `created_by` (OutputActor, optional)
- `description` (string, optional)
- `example` (any, optional)
- `id` (string, optional)
- `label` (string, optional)
- `name` (string, optional)
- `remote_type` (string, optional)
- `type` (string, optional)
- `unique` (boolean, optional)
- `updated_at` (string, optional)
- `user_added` (boolean, optional)

### OutputActor

- `id` (string, optional)
- `name` (string, optional)
- `type` (string, optional)

## Examples

**Response**

```json
{
  "data": [
    {
      "created_at": "2024-01-15T09:30:00Z",
      "created_by": {
        "id": "12345678-1234-1234-1234-123456789012",
        "name": "John Doe",
        "type": "user"
      },
      "description": "Unique identifier",
      "example": null,
      "id": "248df4b7-aa70-47b8-a036-33ac447e668d",
      "label": "ID",
      "name": "id",
      "remote_type": "string",
      "type": "string",
      "unique": true,
      "updated_at": "2024-01-15T09:30:00Z",
      "user_added": false
    }
  ]
}
```

**SDK Code**

```python
import requests

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

headers = {
    "X-Polytomic-Version": "X-Polytomic-Version"
}

response = requests.get(url, headers=headers, auth=("<username>", "<password>"))

print(response.json())
```

```javascript
const url = 'https://app.polytomic.com/api/connections/248df4b7-aa70-47b8-a036-33ac447e668d/modelsync/source/fields';
const credentials = btoa("<username>:<password>");

const options = {
  method: 'GET',
  headers: {
    'X-Polytomic-Version': 'X-Polytomic-Version',
    Authorization: `Basic ${credentials}`
  }
};

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/source/fields"

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

	req.Header.Add("X-Polytomic-Version", "X-Polytomic-Version")
	req.SetBasicAuth("<username>", "<password>")

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

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

request = Net::HTTP::Get.new(url)
request["X-Polytomic-Version"] = 'X-Polytomic-Version'
request.basic_auth("<username>", "<password>")

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/source/fields")
  .header("X-Polytomic-Version", "X-Polytomic-Version")
  .basicAuth("<username>", "<password>")
  .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/source/fields', [
  'headers' => [
    'X-Polytomic-Version' => 'X-Polytomic-Version',
  ],
    'auth' => ['<username>', '<password>'],
]);

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

```csharp
using RestSharp;
using RestSharp.Authenticators;

var client = new RestClient("https://app.polytomic.com/api/connections/248df4b7-aa70-47b8-a036-33ac447e668d/modelsync/source/fields");
client.Authenticator = new HttpBasicAuthenticator("<username>", "<password>");
var request = new RestRequest(Method.GET);
request.AddHeader("X-Polytomic-Version", "X-Polytomic-Version");

IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let credentials = Data("<username>:<password>".utf8).base64EncodedString()

let headers = [
  "X-Polytomic-Version": "X-Polytomic-Version",
  "Authorization": "Basic \(credentials)"
]

let request = NSMutableURLRequest(url: NSURL(string: "https://app.polytomic.com/api/connections/248df4b7-aa70-47b8-a036-33ac447e668d/modelsync/source/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()
```