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

GET https://app.polytomic.com/api/models/{id}

Returns a single model by ID, including its source fields, identity, and filters.

The response includes the model's source fields, identity column, and any
configured filters. To preview the data a model would return without saving
changes, use [`GET /api/models/{id}/sample`](../../../api-reference/models/sample).

Reference: https://apidocs.polytomic.com/api-reference/models/get

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

### Query parameters

- `async` (boolean, optional)

## Response

### 200

OK

- `data` (V2ModelResponse, optional)
- `job` (V2JobResponse, optional)

## Errors

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

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

### V2ModelResponse

- `configuration` (map from string to any, optional)
- `connection_id` (string, optional)
- `created_at` (string, optional)
- `created_by` (OutputActor, optional)
- `enricher` (V2Enrichment, optional)
- `fields` (list of V2ModelField, optional)
- `id` (string, optional)
- `identifier` (string, optional)
- `labels` (list of LabelLabel, optional)
- `name` (string, optional)
- `organization_id` (string, optional)
- `policies` (list of string, optional)
- `relations` (list of V2Relation, optional)
- `tracking_columns` (list of string, optional)
- `type` (string, optional)
- `updated_at` (string, optional)
- `updated_by` (OutputActor, optional)
- `version` (integer, optional)

### V2JobResponse

- `error` (string, optional, nullable) — Error message if the job failed.
- `job_id` (string, optional) — Identifier of the job.
- `result` (any, optional) — Job result. Shape depends on the job type; only populated once status is done.
- `status` (enum, optional)
  - Allowed values: `created`, `running`, `done`, `failed`
- `type` (string, optional) — Job type. Matches the type used to fetch the job.

### OutputActor

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

### V2Enrichment

- `configuration` (map from string to any, optional) — Similar to a model configuration, this configures the enricher. For example, if you wanted to use Apollo to enrich people, you would send `{"object": "people"}` as the configuration. Each enricher configuration can be found in the connection configuration docs.
- `connection_id` (string, optional)
- `enricher_id` (string, optional) — Must be provided to update an existing enrichment
- `fields` (list of V2ModelField, optional) — If not provided, all fields will be enabled.
- `mappings` (map from string to string, optional) — A map of parent model Source Name to child model Source Name. For example, if your model has a field called `work_email` and the enricher accepts a field called `email`, you'd send a map of `{"work_email":"email"}`. The set of required input mappings varies based on the configuration of the enrichment. You can use the `enrichment/{connection_id}/inputfields` API to discover available input field combinations for a given configuration.

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

### LabelLabel

### V2Relation

- `from` (string, optional)
- `to` (V2RelationTo, optional)

### V2RelationTo

- `field` (string, optional)
- `model_id` (string, optional)

## Examples

**Response**

```json
{
  "data": {
    "configuration": {
      "table": "public.contacts"
    },
    "connection_id": "248df4b7-aa70-47b8-a036-33ac447e668d",
    "created_at": "2024-01-15T09:30:00Z",
    "created_by": {
      "id": "12345678-1234-1234-1234-123456789012",
      "name": "John Doe",
      "type": "user"
    },
    "enricher": {
      "configuration": {},
      "connection_id": "248df4b7-aa70-47b8-a036-33ac447e668d",
      "enricher_id": "248df4b7-aa70-47b8-a036-33ac447e668d",
      "fields": [
        {
          "name": "phone_number"
        }
      ],
      "mappings": {}
    },
    "fields": [
      {
        "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
      }
    ],
    "id": "248df4b7-aa70-47b8-a036-33ac447e668d",
    "identifier": "id",
    "labels": [
      {}
    ],
    "name": "Contacts",
    "organization_id": "248df4b7-aa70-47b8-a036-33ac447e668d",
    "policies": [
      "248df4b7-aa70-47b8-a036-33ac447e668d"
    ],
    "relations": [
      {
        "from": "id",
        "to": {
          "field": "user_id",
          "model_id": "248df4b7-aa70-47b8-a036-33ac447e668d"
        }
      }
    ],
    "tracking_columns": [
      "string"
    ],
    "type": "postgresql",
    "updated_at": "2024-01-15T09:30:00Z",
    "updated_by": {
      "id": "12345678-1234-1234-1234-123456789012",
      "name": "John Doe",
      "type": "user"
    },
    "version": 1
  },
  "job": {
    "error": "error message",
    "job_id": "248df4b7-aa70-47b8-a036-33ac447e668d",
    "result": null,
    "status": "created",
    "type": "createmodel"
  }
}
```

**SDK Code**

```python
import requests

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

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/models/248df4b7-aa70-47b8-a036-33ac447e668d';
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/models/248df4b7-aa70-47b8-a036-33ac447e668d"

	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/models/248df4b7-aa70-47b8-a036-33ac447e668d")

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/models/248df4b7-aa70-47b8-a036-33ac447e668d")
  .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/models/248df4b7-aa70-47b8-a036-33ac447e668d', [
  '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/models/248df4b7-aa70-47b8-a036-33ac447e668d");
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/models/248df4b7-aa70-47b8-a036-33ac447e668d")! 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()
```