# Script Templates

## List Script Templates

> Retrieves a paginated list of script templates. Can be filtered by \`name\`, \`hidden\_from\_marketplace\`, \`visible\_for\_marketplace\`, and \`private\`.

```json
{"openapi":"3.0.0","info":{"title":"Patchworks Core API","version":"1.0.0"},"tags":[{"name":"Script Templates"}],"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":{"ScriptTemplatesListResponse":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/ScriptTemplates"}},"meta":{"$ref":"#/components/schemas/PaginationMeta"},"links":{"$ref":"#/components/schemas/PaginationLinks"}}},"ScriptTemplates":{"type":"object","properties":{"id":{"type":"integer","description":"Unique identifier"},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"},"name":{"type":"string"},"description":{"type":"string"},"language":{"type":"object"},"company_id":{"type":"object"},"canonical_key":{"type":"object"},"content":{"type":"object"},"marketplace_company_id":{"type":"object"},"marketplace_company":{"type":"object"},"tenant_script_version_id":{"type":"integer"}}},"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/patchworks/script-templates":{"get":{"summary":"List Script Templates","description":"Retrieves a paginated list of script templates. Can be filtered by `name`, `hidden_from_marketplace`, `visible_for_marketplace`, and `private`.","parameters":[{"name":"filter[name]","in":"query","required":false,"schema":{"type":"string"},"description":"Filter results by name."},{"name":"filter[hidden_from_marketplace]","in":"query","required":false,"schema":{"type":"string"},"description":"Filter results by hidden_from_marketplace."},{"name":"filter[visible_for_marketplace]","in":"query","required":false,"schema":{"type":"string"},"description":"Filter results by visible_for_marketplace."},{"name":"filter[private]","in":"query","required":false,"schema":{"type":"string"},"description":"Filter results by private."},{"name":"filter[visibility]","in":"query","required":false,"schema":{"type":"string"},"description":"Filter results by visibility."},{"name":"include","in":"query","required":false,"schema":{"type":"string"},"description":"Comma-separated list of relationships to include. Available: content, marketplace_company"},{"name":"sort","in":"query","required":false,"schema":{"type":"string"},"description":"Sort field. Prefix with - for descending. Available: name"},{"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/ScriptTemplatesListResponse"}}}},"401":{"description":"Unauthenticated"},"403":{"description":"Unauthorized"}},"tags":["Script Templates"]}}}}
```

## Get Script Template

> Retrieves the details of a specific script template.

```json
{"openapi":"3.0.0","info":{"title":"Patchworks Core API","version":"1.0.0"},"tags":[{"name":"Script Templates"}],"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":{"ScriptTemplatesResponse":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/ScriptTemplates"}}},"ScriptTemplates":{"type":"object","properties":{"id":{"type":"integer","description":"Unique identifier"},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"},"name":{"type":"string"},"description":{"type":"string"},"language":{"type":"object"},"company_id":{"type":"object"},"canonical_key":{"type":"object"},"content":{"type":"object"},"marketplace_company_id":{"type":"object"},"marketplace_company":{"type":"object"},"tenant_script_version_id":{"type":"integer"}}}}},"paths":{"/api/v1/patchworks/script-templates/{script_template}":{"get":{"summary":"Get Script Template","description":"Retrieves the details of a specific script template.","parameters":[{"name":"script_template","in":"path","required":true,"schema":{"type":"string"},"description":"The script template identifier."},{"name":"filter[name]","in":"query","required":false,"schema":{"type":"string"},"description":"Filter results by name."},{"name":"filter[hidden_from_marketplace]","in":"query","required":false,"schema":{"type":"string"},"description":"Filter results by hidden_from_marketplace."},{"name":"filter[visible_for_marketplace]","in":"query","required":false,"schema":{"type":"string"},"description":"Filter results by visible_for_marketplace."},{"name":"filter[private]","in":"query","required":false,"schema":{"type":"string"},"description":"Filter results by private."},{"name":"filter[visibility]","in":"query","required":false,"schema":{"type":"string"},"description":"Filter results by visibility."},{"name":"include","in":"query","required":false,"schema":{"type":"string"},"description":"Comma-separated list of relationships to include. Available: content, marketplace_company"},{"name":"sort","in":"query","required":false,"schema":{"type":"string"},"description":"Sort field. Prefix with - for descending. Available: name"},{"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/ScriptTemplatesResponse"}}}},"401":{"description":"Unauthenticated"},"403":{"description":"Unauthorized"}},"tags":["Script Templates"]}}}}
```

## Delete Script Template

> Permanently deletes a specific script template.

```json
{"openapi":"3.0.0","info":{"title":"Patchworks Core API","version":"1.0.0"},"tags":[{"name":"Script Templates"}],"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/patchworks/script-templates/{script_template}":{"delete":{"summary":"Delete Script Template","description":"Permanently deletes a specific script template.","parameters":[{"name":"script_template","in":"path","required":true,"schema":{"type":"string"},"description":"The script template identifier."}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MessageResponse"}}}},"401":{"description":"Unauthenticated"},"403":{"description":"Unauthorized"}},"tags":["Script Templates"]}}}}
```

## Install Script Template

> Installs a specific script template.

```json
{"openapi":"3.0.0","info":{"title":"Patchworks Core API","version":"1.0.0"},"tags":[{"name":"Script Templates"}],"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":{"ErrorResponse":{"type":"object","properties":{"message":{"type":"string"},"errors":{"type":"object","additionalProperties":{"type":"array","items":{"type":"string"}}}}}}},"paths":{"/api/v1/script-templates/{script_template}/install":{"post":{"summary":"Install Script Template","description":"Installs a specific script template.","parameters":[{"name":"script_template","in":"path","required":true,"schema":{"type":"string"},"description":"The script template identifier."}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object"}}}},"401":{"description":"Unauthenticated"},"403":{"description":"Unauthorized"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"tags":["Script Templates"]}}}}
```
