# Model Variables

## List Model Variables

> Retrieves a paginated list of variables associated with a model.\
> Note: Model variables, filter values, and notes can all be attached to different entity types via \`model\_type\` and \`model\_id\`.

```json
{"openapi":"3.0.0","info":{"title":"Patchworks Core API","version":"1.0.0"},"tags":[{"name":"Model Variables"}],"servers":[{"url":"https://core.wearepatchworks.com"}],"security":[{"ApiKeyAuth":[]},{"BearerAuth":[]}],"components":{"securitySchemes":{"ApiKeyAuth":{"type":"apiKey","in":"header","name":"Authorization","description":"API key passed in the Authorization header. Format: `<api-key>`"},"BearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"JWT","description":"OAuth 2 Bearer token obtained from POST /fabric/api/login"}},"schemas":{"ModelVariablesListResponse":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/ModelVariables"}},"meta":{"$ref":"#/components/schemas/PaginationMeta"},"links":{"$ref":"#/components/schemas/PaginationLinks"}}},"ModelVariables":{"type":"object","properties":{"id":{"type":"integer","description":"Unique identifier"},"variable_id":{"type":"string"},"alias":{"type":"string"},"configurable":{"type":"string"},"required":{"type":"string"},"advanced":{"type":"string"},"model_type":{"type":"string"},"model_id":{"type":"string"},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"},"variable":{"type":"object"},"modified":{"type":"string"}}},"PaginationMeta":{"type":"object","properties":{"current_page":{"type":"integer"},"from":{"type":"integer","nullable":true},"last_page":{"type":"integer"},"path":{"type":"string"},"per_page":{"type":"integer"},"to":{"type":"integer","nullable":true},"total":{"type":"integer"}}},"PaginationLinks":{"type":"object","properties":{"first":{"type":"string","format":"uri"},"last":{"type":"string","format":"uri"},"prev":{"type":"string","format":"uri","nullable":true},"next":{"type":"string","format":"uri","nullable":true}}}}},"paths":{"/api/v1/model-variables":{"get":{"summary":"List Model Variables","description":"Retrieves a paginated list of variables associated with a model.\nNote: Model variables, filter values, and notes can all be attached to different entity types via `model_type` and `model_id`.","parameters":[{"name":"filter[variable_id]","in":"query","required":false,"schema":{"type":"string"},"description":"Filter results by variable_id."},{"name":"filter[model_type]","in":"query","required":false,"schema":{"type":"string"},"description":"Filter results by model_type."},{"name":"filter[model_id]","in":"query","required":false,"schema":{"type":"string"},"description":"Filter results by model_id."},{"name":"include","in":"query","required":false,"schema":{"type":"string"},"description":"Comma-separated list of relationships to include. Available: model, variable"},{"name":"sort","in":"query","required":false,"schema":{"type":"string"},"description":"Sort field. Prefix with - for descending. Available: variable_id, model_type, model_id"},{"name":"page","in":"query","required":false,"schema":{"type":"integer","minimum":1,"default":1},"description":"Page number for pagination."},{"name":"per_page","in":"query","required":false,"schema":{"type":"integer","minimum":1,"maximum":100},"description":"Number of results per page."}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ModelVariablesListResponse"}}}},"401":{"description":"Unauthenticated"},"403":{"description":"Unauthorized"}},"tags":["Model Variables"]}}}}
```

## Create Model Variable

> Creates a new variable association for a model.\
> Note: Model variables, filter values, and notes can all be attached to different entity types via \`model\_type\` and \`model\_id\`.

```json
{"openapi":"3.0.0","info":{"title":"Patchworks Core API","version":"1.0.0"},"tags":[{"name":"Model Variables"}],"servers":[{"url":"https://core.wearepatchworks.com"}],"security":[{"ApiKeyAuth":[]},{"BearerAuth":[]}],"components":{"securitySchemes":{"ApiKeyAuth":{"type":"apiKey","in":"header","name":"Authorization","description":"API key passed in the Authorization header. Format: `<api-key>`"},"BearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"JWT","description":"OAuth 2 Bearer token obtained from POST /fabric/api/login"}},"schemas":{"ModelVariablesResponse":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/ModelVariables"}}},"ModelVariables":{"type":"object","properties":{"id":{"type":"integer","description":"Unique identifier"},"variable_id":{"type":"string"},"alias":{"type":"string"},"configurable":{"type":"string"},"required":{"type":"string"},"advanced":{"type":"string"},"model_type":{"type":"string"},"model_id":{"type":"string"},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"},"variable":{"type":"object"},"modified":{"type":"string"}}},"ErrorResponse":{"type":"object","properties":{"message":{"type":"string"},"errors":{"type":"object","additionalProperties":{"type":"array","items":{"type":"string"}}}}},"ModelVariablesStoreRequest":{"type":"object","properties":{"variable_id":{"type":"string"},"alias":{"type":"string","nullable":true},"configurable":{"type":"string"},"required":{"type":"string"},"advanced":{"type":"string"},"model_type":{"type":"string"},"model_id":{"type":"string"}},"required":["model_id","model_type","variable_id"]}}},"paths":{"/api/v1/model-variables":{"post":{"summary":"Create Model Variable","description":"Creates a new variable association for a model.\nNote: Model variables, filter values, and notes can all be attached to different entity types via `model_type` and `model_id`.","responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ModelVariablesResponse"}}}},"401":{"description":"Unauthenticated"},"403":{"description":"Unauthorized"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ModelVariablesStoreRequest"}}}},"tags":["Model Variables"],"parameters":[]}}}}
```

## Get Model Variable

> Retrieves the details of a specific model variable.\
> Note: Model variables, filter values, and notes can all be attached to different entity types via \`model\_type\` and \`model\_id\`.

```json
{"openapi":"3.0.0","info":{"title":"Patchworks Core API","version":"1.0.0"},"tags":[{"name":"Model Variables"}],"servers":[{"url":"https://core.wearepatchworks.com"}],"security":[{"ApiKeyAuth":[]},{"BearerAuth":[]}],"components":{"securitySchemes":{"ApiKeyAuth":{"type":"apiKey","in":"header","name":"Authorization","description":"API key passed in the Authorization header. Format: `<api-key>`"},"BearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"JWT","description":"OAuth 2 Bearer token obtained from POST /fabric/api/login"}},"schemas":{"ModelVariablesResponse":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/ModelVariables"}}},"ModelVariables":{"type":"object","properties":{"id":{"type":"integer","description":"Unique identifier"},"variable_id":{"type":"string"},"alias":{"type":"string"},"configurable":{"type":"string"},"required":{"type":"string"},"advanced":{"type":"string"},"model_type":{"type":"string"},"model_id":{"type":"string"},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"},"variable":{"type":"object"},"modified":{"type":"string"}}}}},"paths":{"/api/v1/model-variables/{model_variable}":{"get":{"summary":"Get Model Variable","description":"Retrieves the details of a specific model variable.\nNote: Model variables, filter values, and notes can all be attached to different entity types via `model_type` and `model_id`.","parameters":[{"name":"model_variable","in":"path","required":true,"schema":{"type":"string"},"description":"The model variable identifier."},{"name":"filter[variable_id]","in":"query","required":false,"schema":{"type":"string"},"description":"Filter results by variable_id."},{"name":"filter[model_type]","in":"query","required":false,"schema":{"type":"string"},"description":"Filter results by model_type."},{"name":"filter[model_id]","in":"query","required":false,"schema":{"type":"string"},"description":"Filter results by model_id."},{"name":"include","in":"query","required":false,"schema":{"type":"string"},"description":"Comma-separated list of relationships to include. Available: model, variable"},{"name":"sort","in":"query","required":false,"schema":{"type":"string"},"description":"Sort field. Prefix with - for descending. Available: variable_id, model_type, model_id"},{"name":"page","in":"query","required":false,"schema":{"type":"integer","minimum":1,"default":1},"description":"Page number for pagination."},{"name":"per_page","in":"query","required":false,"schema":{"type":"integer","minimum":1,"maximum":100},"description":"Number of results per page."}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ModelVariablesResponse"}}}},"401":{"description":"Unauthenticated"},"403":{"description":"Unauthorized"}},"tags":["Model Variables"]}}}}
```

## Update Model Variable

> Updates an existing model variable.\
> Note: Model variables, filter values, and notes can all be attached to different entity types via \`model\_type\` and \`model\_id\`.

```json
{"openapi":"3.0.0","info":{"title":"Patchworks Core API","version":"1.0.0"},"tags":[{"name":"Model Variables"}],"servers":[{"url":"https://core.wearepatchworks.com"}],"security":[{"ApiKeyAuth":[]},{"BearerAuth":[]}],"components":{"securitySchemes":{"ApiKeyAuth":{"type":"apiKey","in":"header","name":"Authorization","description":"API key passed in the Authorization header. Format: `<api-key>`"},"BearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"JWT","description":"OAuth 2 Bearer token obtained from POST /fabric/api/login"}},"schemas":{"ModelVariablesResponse":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/ModelVariables"}}},"ModelVariables":{"type":"object","properties":{"id":{"type":"integer","description":"Unique identifier"},"variable_id":{"type":"string"},"alias":{"type":"string"},"configurable":{"type":"string"},"required":{"type":"string"},"advanced":{"type":"string"},"model_type":{"type":"string"},"model_id":{"type":"string"},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"},"variable":{"type":"object"},"modified":{"type":"string"}}},"ErrorResponse":{"type":"object","properties":{"message":{"type":"string"},"errors":{"type":"object","additionalProperties":{"type":"array","items":{"type":"string"}}}}},"ModelVariablesUpdateRequest":{"type":"object","properties":{"alias":{"type":"string","nullable":true},"configurable":{"type":"string"},"required":{"type":"string"},"advanced":{"type":"string"}}}}},"paths":{"/api/v1/model-variables/{model_variable}":{"put":{"summary":"Update Model Variable","description":"Updates an existing model variable.\nNote: Model variables, filter values, and notes can all be attached to different entity types via `model_type` and `model_id`.","parameters":[{"name":"model_variable","in":"path","required":true,"schema":{"type":"string"},"description":"The model variable identifier."}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ModelVariablesResponse"}}}},"401":{"description":"Unauthenticated"},"403":{"description":"Unauthorized"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ModelVariablesUpdateRequest"}}}},"tags":["Model Variables"]}}}}
```

## Delete Model Variable

> Permanently deletes a specific model variable.\
> Note: Model variables, filter values, and notes can all be attached to different entity types via \`model\_type\` and \`model\_id\`.

```json
{"openapi":"3.0.0","info":{"title":"Patchworks Core API","version":"1.0.0"},"tags":[{"name":"Model Variables"}],"servers":[{"url":"https://core.wearepatchworks.com"}],"security":[{"ApiKeyAuth":[]},{"BearerAuth":[]}],"components":{"securitySchemes":{"ApiKeyAuth":{"type":"apiKey","in":"header","name":"Authorization","description":"API key passed in the Authorization header. Format: `<api-key>`"},"BearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"JWT","description":"OAuth 2 Bearer token obtained from POST /fabric/api/login"}},"schemas":{"MessageResponse":{"type":"object","properties":{"message":{"type":"string"}}}}},"paths":{"/api/v1/model-variables/{model_variable}":{"delete":{"summary":"Delete Model Variable","description":"Permanently deletes a specific model variable.\nNote: Model variables, filter values, and notes can all be attached to different entity types via `model_type` and `model_id`.","parameters":[{"name":"model_variable","in":"path","required":true,"schema":{"type":"string"},"description":"The model variable identifier."}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MessageResponse"}}}},"401":{"description":"Unauthenticated"},"403":{"description":"Unauthorized"}},"tags":["Model Variables"]}}}}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://doc.wearepatchworks.com/product-documentation/api-reference/models/model-variables.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
