# Templates

> Search Shaw's live template catalog, inspect measured LOC credit costs, read launch notes, and unlock source bundles.

## Search Shaw template catalog

`GET https://shaw.ai/api/templates/search`

Search and paginate Shaw's Template Code Library catalog metadata (free, uses 0 credits). Returns opaque template ids, slugs, titles, channels, and approximate LOC / credit cost.

```json
{
  "openapi": "3.1.0",
  "info": {
    "description": "Shaw's API for people and agents. Everything you can do in the app, you can do here with an API key or an OAuth token, within the scopes you grant it.\n\nA scope only narrows a credential: every request still runs as the person who owns it, with their role in the organization.\n\nRoutes under /api/skills, /api/harness-profiles, /api/data-sync, /api/templates, /api/seo are reachable with the matching read or write scope (GET reads, everything else writes) even where no typed operation is listed here.\n\nWebhook events: approval.decided, session.completed, schedule.run.started, schedule.run.failed.\n\nMCP: https://shaw.ai/mcp (also https://shaw.ai/portal/mcp).",
    "title": "Shaw API",
    "version": "1.0.0"
  },
  "servers": [
    {
      "url": "https://shaw.ai"
    }
  ],
  "paths": {
    "/api/templates/search": {
      "get": {
        "description": "Search and paginate Shaw's Template Code Library catalog metadata (free, uses 0 credits). Returns opaque template ids, slugs, titles, channels, and approximate LOC / credit cost.",
        "operationId": "search_templates",
        "parameters": [
          {
            "$ref": "#/components/parameters/Tenant"
          },
          {
            "description": "Filter by brand slug or name.",
            "in": "query",
            "name": "brand",
            "required": false,
            "schema": {
              "description": "Filter by brand slug or name.",
              "type": "string"
            }
          },
          {
            "description": "Filter by category group or label.",
            "in": "query",
            "name": "category",
            "required": false,
            "schema": {
              "description": "Filter by category group or label.",
              "type": "string"
            }
          },
          {
            "description": "Filter by surface channel.",
            "in": "query",
            "name": "channel",
            "required": false,
            "schema": {
              "description": "Filter by surface channel.",
              "type": "string",
              "enum": [
                "websites",
                "emails",
                "apps",
                "ads"
              ]
            }
          },
          {
            "description": "Results per page (1-25, default 20).",
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "description": "Results per page (1-25, default 20).",
              "type": "integer"
            }
          },
          {
            "description": "Pagination offset (default 0).",
            "in": "query",
            "name": "offset",
            "required": false,
            "schema": {
              "description": "Pagination offset (default 0).",
              "type": "integer"
            }
          },
          {
            "description": "Search query across brand, title, surface, or subject.",
            "in": "query",
            "name": "q",
            "required": false,
            "schema": {
              "description": "Search query across brand, title, surface, or subject.",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "$ref": "#/components/responses/Ok"
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          }
        },
        "security": [
          {
            "apiKey": []
          },
          {
            "oauth2": [
              "pages:read"
            ]
          }
        ],
        "summary": "Search Shaw template catalog",
        "tags": [
          "Templates"
        ],
        "x-mcp-tool": "search_templates",
        "x-requires-confirmation": false,
        "x-required-scope": "pages:read"
      }
    }
  },
  "components": {
    "parameters": {
      "Tenant": {
        "description": "The organization to act for (an id from `GET /api/me`). Defaults to the key's pinned organization, else your first organization. You must be a member of it.",
        "in": "header",
        "name": "X-Shaw-Tenant",
        "required": false,
        "schema": {
          "type": "string"
        }
      }
    },
    "responses": {
      "Error": {
        "content": {
          "application/json": {
            "schema": {
              "properties": {
                "error": {
                  "type": "string"
                },
                "message": {
                  "type": "string"
                }
              },
              "type": "object"
            }
          }
        },
        "description": "The request was refused or failed; `error` is a stable code."
      },
      "Forbidden": {
        "content": {
          "application/json": {
            "schema": {
              "properties": {
                "error": {
                  "enum": [
                    "insufficient_scope",
                    "bearer_not_allowed",
                    "forbidden_workspace",
                    "tenant_pinned"
                  ],
                  "type": "string"
                },
                "message": {
                  "type": "string"
                },
                "scope": {
                  "type": "string"
                }
              },
              "type": "object"
            }
          }
        },
        "description": "The credential lacks the scope, can't call this route, or can't act for the organization."
      },
      "Ok": {
        "content": {
          "application/json": {
            "schema": {}
          }
        },
        "description": "Success. The body is JSON."
      },
      "Unauthorized": {
        "content": {
          "application/json": {
            "schema": {
              "properties": {
                "error": {
                  "type": "string"
                },
                "message": {
                  "type": "string"
                }
              },
              "type": "object"
            }
          }
        },
        "description": "The credential is missing, invalid, expired or revoked.",
        "headers": {
          "WWW-Authenticate": {
            "schema": {
              "type": "string"
            }
          }
        }
      }
    },
    "securitySchemes": {
      "apiKey": {
        "bearerFormat": "sk_…",
        "description": "A personal API key created in Settings → Developers. Send it as `Authorization: Bearer sk_…`.",
        "scheme": "bearer",
        "type": "http"
      },
      "oauth2": {
        "description": "OAuth 2.1 authorization code with S256 PKCE. Clients can register themselves (RFC 7591).",
        "flows": {
          "authorizationCode": {
            "authorizationUrl": "https://shaw.ai/api/auth/oauth2/authorize",
            "refreshUrl": "https://shaw.ai/api/auth/oauth2/token",
            "scopes": {
              "org:read": "See which organizations you belong to, their profile and runtime status.",
              "org:write": "Create organizations and rename the ones you administer.",
              "sessions:read": "Read chat sessions, their messages and artifacts.",
              "sessions:write": "Start, rename, fork, compact and archive chat sessions and send messages.",
              "approvals:review": "Approve or reject the actions a session is waiting on.",
              "files:read": "Read shared files and documents.",
              "files:write": "Create, edit and delete shared files and documents.",
              "memory:read": "Read the knowledge base and shared memory.",
              "memory:write": "Add, edit, restore and delete knowledge entries.",
              "schedules:read": "Read scheduled automations.",
              "schedules:write": "Change and run scheduled automations.",
              "campaigns:read": "Read synced advertising, sales and Meta/Google campaign data.",
              "campaigns:write": "Run syncs and publish or change ad campaigns.",
              "reports:read": "Read SEO reports and research.",
              "reports:write": "Run and change SEO reports and research.",
              "pages:read": "Read template catalog metadata, code size/credits, Brand Kit, remixes, hosted pages, custom domains, and Email Studio drafts.",
              "pages:write": "Update Brand Kit, create or edit remixes, publish hosted pages or domains, and edit or publish Email Studio drafts.",
              "connectors:read": "See which apps and providers are connected, without any credentials.",
              "connectors:manage": "Disconnect apps, forget saved provider keys and manage MCP servers. Connecting an app or entering a credential needs you signed in.",
              "members:read": "See who belongs to an organization and their roles.",
              "members:manage": "Invite people and change or remove members.",
              "settings:read": "Read workspace settings, tool policy, skills and models.",
              "settings:write": "Change workspace settings, tool policy and skills.",
              "webhooks:manage": "Create, list and delete outbound webhooks.",
              "events:read": "Read the activity feed and webhook delivery log.",
              "tools:read": "Use read-only integration tools (Shopify, Klaviyo and others) the organization has connected.",
              "tools:write": "Use integration tools that change data in connected apps. Writes still follow the organization's tool policy."
            },
            "tokenUrl": "https://shaw.ai/api/auth/oauth2/token"
          }
        },
        "type": "oauth2"
      }
    },
    "schemas": {}
  }
}
```

## Get template details and LOC credit cost

`GET https://shaw.ai/api/templates/detail/{id}`

Read detailed metadata, pages, brand DNA, and per-page measured LOC / credit cost for one template (free, uses 0 credits). 1 credit = 1 LOC: emails cost max(2,500, LOC) credits (2,500 credits minimum); website and app pages cost 5,000 to 15,000 credits per page. Pass the opaque template id from search_templates (e.g. tpl_...).

```json
{
  "openapi": "3.1.0",
  "info": {
    "description": "Shaw's API for people and agents. Everything you can do in the app, you can do here with an API key or an OAuth token, within the scopes you grant it.\n\nA scope only narrows a credential: every request still runs as the person who owns it, with their role in the organization.\n\nRoutes under /api/skills, /api/harness-profiles, /api/data-sync, /api/templates, /api/seo are reachable with the matching read or write scope (GET reads, everything else writes) even where no typed operation is listed here.\n\nWebhook events: approval.decided, session.completed, schedule.run.started, schedule.run.failed.\n\nMCP: https://shaw.ai/mcp (also https://shaw.ai/portal/mcp).",
    "title": "Shaw API",
    "version": "1.0.0"
  },
  "servers": [
    {
      "url": "https://shaw.ai"
    }
  ],
  "paths": {
    "/api/templates/detail/{id}": {
      "get": {
        "description": "Read detailed metadata, pages, brand DNA, and per-page measured LOC / credit cost for one template (free, uses 0 credits). 1 credit = 1 LOC: emails cost max(2,500, LOC) credits (2,500 credits minimum); website and app pages cost 5,000 to 15,000 credits per page. Pass the opaque template id from search_templates (e.g. tpl_...).",
        "operationId": "get_template",
        "parameters": [
          {
            "$ref": "#/components/parameters/Tenant"
          },
          {
            "description": "Template id (`tpl_...`) from search_templates.",
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Optional page path within the template (defaults to `/`).",
            "in": "query",
            "name": "path",
            "required": false,
            "schema": {
              "description": "Optional page path within the template (defaults to `/`).",
              "type": "string"
            }
          },
          {
            "description": "Optional template version id (YYYY-MM-DD).",
            "in": "query",
            "name": "version",
            "required": false,
            "schema": {
              "description": "Optional template version id (YYYY-MM-DD).",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "$ref": "#/components/responses/Ok"
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          }
        },
        "security": [
          {
            "apiKey": []
          },
          {
            "oauth2": [
              "pages:read"
            ]
          }
        ],
        "summary": "Get template details and LOC credit cost",
        "tags": [
          "Templates"
        ],
        "x-mcp-tool": "get_template",
        "x-requires-confirmation": false,
        "x-required-scope": "pages:read"
      }
    }
  },
  "components": {
    "parameters": {
      "Tenant": {
        "description": "The organization to act for (an id from `GET /api/me`). Defaults to the key's pinned organization, else your first organization. You must be a member of it.",
        "in": "header",
        "name": "X-Shaw-Tenant",
        "required": false,
        "schema": {
          "type": "string"
        }
      }
    },
    "responses": {
      "Error": {
        "content": {
          "application/json": {
            "schema": {
              "properties": {
                "error": {
                  "type": "string"
                },
                "message": {
                  "type": "string"
                }
              },
              "type": "object"
            }
          }
        },
        "description": "The request was refused or failed; `error` is a stable code."
      },
      "Forbidden": {
        "content": {
          "application/json": {
            "schema": {
              "properties": {
                "error": {
                  "enum": [
                    "insufficient_scope",
                    "bearer_not_allowed",
                    "forbidden_workspace",
                    "tenant_pinned"
                  ],
                  "type": "string"
                },
                "message": {
                  "type": "string"
                },
                "scope": {
                  "type": "string"
                }
              },
              "type": "object"
            }
          }
        },
        "description": "The credential lacks the scope, can't call this route, or can't act for the organization."
      },
      "Ok": {
        "content": {
          "application/json": {
            "schema": {}
          }
        },
        "description": "Success. The body is JSON."
      },
      "Unauthorized": {
        "content": {
          "application/json": {
            "schema": {
              "properties": {
                "error": {
                  "type": "string"
                },
                "message": {
                  "type": "string"
                }
              },
              "type": "object"
            }
          }
        },
        "description": "The credential is missing, invalid, expired or revoked.",
        "headers": {
          "WWW-Authenticate": {
            "schema": {
              "type": "string"
            }
          }
        }
      }
    },
    "securitySchemes": {
      "apiKey": {
        "bearerFormat": "sk_…",
        "description": "A personal API key created in Settings → Developers. Send it as `Authorization: Bearer sk_…`.",
        "scheme": "bearer",
        "type": "http"
      },
      "oauth2": {
        "description": "OAuth 2.1 authorization code with S256 PKCE. Clients can register themselves (RFC 7591).",
        "flows": {
          "authorizationCode": {
            "authorizationUrl": "https://shaw.ai/api/auth/oauth2/authorize",
            "refreshUrl": "https://shaw.ai/api/auth/oauth2/token",
            "scopes": {
              "org:read": "See which organizations you belong to, their profile and runtime status.",
              "org:write": "Create organizations and rename the ones you administer.",
              "sessions:read": "Read chat sessions, their messages and artifacts.",
              "sessions:write": "Start, rename, fork, compact and archive chat sessions and send messages.",
              "approvals:review": "Approve or reject the actions a session is waiting on.",
              "files:read": "Read shared files and documents.",
              "files:write": "Create, edit and delete shared files and documents.",
              "memory:read": "Read the knowledge base and shared memory.",
              "memory:write": "Add, edit, restore and delete knowledge entries.",
              "schedules:read": "Read scheduled automations.",
              "schedules:write": "Change and run scheduled automations.",
              "campaigns:read": "Read synced advertising, sales and Meta/Google campaign data.",
              "campaigns:write": "Run syncs and publish or change ad campaigns.",
              "reports:read": "Read SEO reports and research.",
              "reports:write": "Run and change SEO reports and research.",
              "pages:read": "Read template catalog metadata, code size/credits, Brand Kit, remixes, hosted pages, custom domains, and Email Studio drafts.",
              "pages:write": "Update Brand Kit, create or edit remixes, publish hosted pages or domains, and edit or publish Email Studio drafts.",
              "connectors:read": "See which apps and providers are connected, without any credentials.",
              "connectors:manage": "Disconnect apps, forget saved provider keys and manage MCP servers. Connecting an app or entering a credential needs you signed in.",
              "members:read": "See who belongs to an organization and their roles.",
              "members:manage": "Invite people and change or remove members.",
              "settings:read": "Read workspace settings, tool policy, skills and models.",
              "settings:write": "Change workspace settings, tool policy and skills.",
              "webhooks:manage": "Create, list and delete outbound webhooks.",
              "events:read": "Read the activity feed and webhook delivery log.",
              "tools:read": "Use read-only integration tools (Shopify, Klaviyo and others) the organization has connected.",
              "tools:write": "Use integration tools that change data in connected apps. Writes still follow the organization's tool policy."
            },
            "tokenUrl": "https://shaw.ai/api/auth/oauth2/token"
          }
        },
        "type": "oauth2"
      }
    },
    "schemas": {}
  }
}
```

## List catalog brands

`GET https://shaw.ai/api/templates/brands`

List brands in Shaw's catalog (free, uses 0 credits).

```json
{
  "openapi": "3.1.0",
  "info": {
    "description": "Shaw's API for people and agents. Everything you can do in the app, you can do here with an API key or an OAuth token, within the scopes you grant it.\n\nA scope only narrows a credential: every request still runs as the person who owns it, with their role in the organization.\n\nRoutes under /api/skills, /api/harness-profiles, /api/data-sync, /api/templates, /api/seo are reachable with the matching read or write scope (GET reads, everything else writes) even where no typed operation is listed here.\n\nWebhook events: approval.decided, session.completed, schedule.run.started, schedule.run.failed.\n\nMCP: https://shaw.ai/mcp (also https://shaw.ai/portal/mcp).",
    "title": "Shaw API",
    "version": "1.0.0"
  },
  "servers": [
    {
      "url": "https://shaw.ai"
    }
  ],
  "paths": {
    "/api/templates/brands": {
      "get": {
        "description": "List brands in Shaw's catalog (free, uses 0 credits).",
        "operationId": "list_brands",
        "parameters": [
          {
            "$ref": "#/components/parameters/Tenant"
          }
        ],
        "responses": {
          "200": {
            "$ref": "#/components/responses/Ok"
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          }
        },
        "security": [
          {
            "apiKey": []
          },
          {
            "oauth2": [
              "pages:read"
            ]
          }
        ],
        "summary": "List catalog brands",
        "tags": [
          "Templates"
        ],
        "x-mcp-tool": "list_brands",
        "x-requires-confirmation": false,
        "x-required-scope": "pages:read"
      }
    }
  },
  "components": {
    "parameters": {
      "Tenant": {
        "description": "The organization to act for (an id from `GET /api/me`). Defaults to the key's pinned organization, else your first organization. You must be a member of it.",
        "in": "header",
        "name": "X-Shaw-Tenant",
        "required": false,
        "schema": {
          "type": "string"
        }
      }
    },
    "responses": {
      "Error": {
        "content": {
          "application/json": {
            "schema": {
              "properties": {
                "error": {
                  "type": "string"
                },
                "message": {
                  "type": "string"
                }
              },
              "type": "object"
            }
          }
        },
        "description": "The request was refused or failed; `error` is a stable code."
      },
      "Forbidden": {
        "content": {
          "application/json": {
            "schema": {
              "properties": {
                "error": {
                  "enum": [
                    "insufficient_scope",
                    "bearer_not_allowed",
                    "forbidden_workspace",
                    "tenant_pinned"
                  ],
                  "type": "string"
                },
                "message": {
                  "type": "string"
                },
                "scope": {
                  "type": "string"
                }
              },
              "type": "object"
            }
          }
        },
        "description": "The credential lacks the scope, can't call this route, or can't act for the organization."
      },
      "Ok": {
        "content": {
          "application/json": {
            "schema": {}
          }
        },
        "description": "Success. The body is JSON."
      },
      "Unauthorized": {
        "content": {
          "application/json": {
            "schema": {
              "properties": {
                "error": {
                  "type": "string"
                },
                "message": {
                  "type": "string"
                }
              },
              "type": "object"
            }
          }
        },
        "description": "The credential is missing, invalid, expired or revoked.",
        "headers": {
          "WWW-Authenticate": {
            "schema": {
              "type": "string"
            }
          }
        }
      }
    },
    "securitySchemes": {
      "apiKey": {
        "bearerFormat": "sk_…",
        "description": "A personal API key created in Settings → Developers. Send it as `Authorization: Bearer sk_…`.",
        "scheme": "bearer",
        "type": "http"
      },
      "oauth2": {
        "description": "OAuth 2.1 authorization code with S256 PKCE. Clients can register themselves (RFC 7591).",
        "flows": {
          "authorizationCode": {
            "authorizationUrl": "https://shaw.ai/api/auth/oauth2/authorize",
            "refreshUrl": "https://shaw.ai/api/auth/oauth2/token",
            "scopes": {
              "org:read": "See which organizations you belong to, their profile and runtime status.",
              "org:write": "Create organizations and rename the ones you administer.",
              "sessions:read": "Read chat sessions, their messages and artifacts.",
              "sessions:write": "Start, rename, fork, compact and archive chat sessions and send messages.",
              "approvals:review": "Approve or reject the actions a session is waiting on.",
              "files:read": "Read shared files and documents.",
              "files:write": "Create, edit and delete shared files and documents.",
              "memory:read": "Read the knowledge base and shared memory.",
              "memory:write": "Add, edit, restore and delete knowledge entries.",
              "schedules:read": "Read scheduled automations.",
              "schedules:write": "Change and run scheduled automations.",
              "campaigns:read": "Read synced advertising, sales and Meta/Google campaign data.",
              "campaigns:write": "Run syncs and publish or change ad campaigns.",
              "reports:read": "Read SEO reports and research.",
              "reports:write": "Run and change SEO reports and research.",
              "pages:read": "Read template catalog metadata, code size/credits, Brand Kit, remixes, hosted pages, custom domains, and Email Studio drafts.",
              "pages:write": "Update Brand Kit, create or edit remixes, publish hosted pages or domains, and edit or publish Email Studio drafts.",
              "connectors:read": "See which apps and providers are connected, without any credentials.",
              "connectors:manage": "Disconnect apps, forget saved provider keys and manage MCP servers. Connecting an app or entering a credential needs you signed in.",
              "members:read": "See who belongs to an organization and their roles.",
              "members:manage": "Invite people and change or remove members.",
              "settings:read": "Read workspace settings, tool policy, skills and models.",
              "settings:write": "Change workspace settings, tool policy and skills.",
              "webhooks:manage": "Create, list and delete outbound webhooks.",
              "events:read": "Read the activity feed and webhook delivery log.",
              "tools:read": "Use read-only integration tools (Shopify, Klaviyo and others) the organization has connected.",
              "tools:write": "Use integration tools that change data in connected apps. Writes still follow the organization's tool policy."
            },
            "tokenUrl": "https://shaw.ai/api/auth/oauth2/token"
          }
        },
        "type": "oauth2"
      }
    },
    "schemas": {}
  }
}
```

## Read template launch notes

`GET https://shaw.ai/api/templates/notes/{id}`

Read AI launch notes and design context for a template (free, uses 0 credits). Pass the opaque template id (`tpl_...`).

```json
{
  "openapi": "3.1.0",
  "info": {
    "description": "Shaw's API for people and agents. Everything you can do in the app, you can do here with an API key or an OAuth token, within the scopes you grant it.\n\nA scope only narrows a credential: every request still runs as the person who owns it, with their role in the organization.\n\nRoutes under /api/skills, /api/harness-profiles, /api/data-sync, /api/templates, /api/seo are reachable with the matching read or write scope (GET reads, everything else writes) even where no typed operation is listed here.\n\nWebhook events: approval.decided, session.completed, schedule.run.started, schedule.run.failed.\n\nMCP: https://shaw.ai/mcp (also https://shaw.ai/portal/mcp).",
    "title": "Shaw API",
    "version": "1.0.0"
  },
  "servers": [
    {
      "url": "https://shaw.ai"
    }
  ],
  "paths": {
    "/api/templates/notes/{id}": {
      "get": {
        "description": "Read AI launch notes and design context for a template (free, uses 0 credits). Pass the opaque template id (`tpl_...`).",
        "operationId": "get_template_notes",
        "parameters": [
          {
            "$ref": "#/components/parameters/Tenant"
          },
          {
            "description": "Template id (`tpl_...`) from search_templates.",
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "$ref": "#/components/responses/Ok"
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          }
        },
        "security": [
          {
            "apiKey": []
          },
          {
            "oauth2": [
              "pages:read"
            ]
          }
        ],
        "summary": "Read template launch notes",
        "tags": [
          "Templates"
        ],
        "x-mcp-tool": "get_template_notes",
        "x-requires-confirmation": false,
        "x-required-scope": "pages:read"
      }
    }
  },
  "components": {
    "parameters": {
      "Tenant": {
        "description": "The organization to act for (an id from `GET /api/me`). Defaults to the key's pinned organization, else your first organization. You must be a member of it.",
        "in": "header",
        "name": "X-Shaw-Tenant",
        "required": false,
        "schema": {
          "type": "string"
        }
      }
    },
    "responses": {
      "Error": {
        "content": {
          "application/json": {
            "schema": {
              "properties": {
                "error": {
                  "type": "string"
                },
                "message": {
                  "type": "string"
                }
              },
              "type": "object"
            }
          }
        },
        "description": "The request was refused or failed; `error` is a stable code."
      },
      "Forbidden": {
        "content": {
          "application/json": {
            "schema": {
              "properties": {
                "error": {
                  "enum": [
                    "insufficient_scope",
                    "bearer_not_allowed",
                    "forbidden_workspace",
                    "tenant_pinned"
                  ],
                  "type": "string"
                },
                "message": {
                  "type": "string"
                },
                "scope": {
                  "type": "string"
                }
              },
              "type": "object"
            }
          }
        },
        "description": "The credential lacks the scope, can't call this route, or can't act for the organization."
      },
      "Ok": {
        "content": {
          "application/json": {
            "schema": {}
          }
        },
        "description": "Success. The body is JSON."
      },
      "Unauthorized": {
        "content": {
          "application/json": {
            "schema": {
              "properties": {
                "error": {
                  "type": "string"
                },
                "message": {
                  "type": "string"
                }
              },
              "type": "object"
            }
          }
        },
        "description": "The credential is missing, invalid, expired or revoked.",
        "headers": {
          "WWW-Authenticate": {
            "schema": {
              "type": "string"
            }
          }
        }
      }
    },
    "securitySchemes": {
      "apiKey": {
        "bearerFormat": "sk_…",
        "description": "A personal API key created in Settings → Developers. Send it as `Authorization: Bearer sk_…`.",
        "scheme": "bearer",
        "type": "http"
      },
      "oauth2": {
        "description": "OAuth 2.1 authorization code with S256 PKCE. Clients can register themselves (RFC 7591).",
        "flows": {
          "authorizationCode": {
            "authorizationUrl": "https://shaw.ai/api/auth/oauth2/authorize",
            "refreshUrl": "https://shaw.ai/api/auth/oauth2/token",
            "scopes": {
              "org:read": "See which organizations you belong to, their profile and runtime status.",
              "org:write": "Create organizations and rename the ones you administer.",
              "sessions:read": "Read chat sessions, their messages and artifacts.",
              "sessions:write": "Start, rename, fork, compact and archive chat sessions and send messages.",
              "approvals:review": "Approve or reject the actions a session is waiting on.",
              "files:read": "Read shared files and documents.",
              "files:write": "Create, edit and delete shared files and documents.",
              "memory:read": "Read the knowledge base and shared memory.",
              "memory:write": "Add, edit, restore and delete knowledge entries.",
              "schedules:read": "Read scheduled automations.",
              "schedules:write": "Change and run scheduled automations.",
              "campaigns:read": "Read synced advertising, sales and Meta/Google campaign data.",
              "campaigns:write": "Run syncs and publish or change ad campaigns.",
              "reports:read": "Read SEO reports and research.",
              "reports:write": "Run and change SEO reports and research.",
              "pages:read": "Read template catalog metadata, code size/credits, Brand Kit, remixes, hosted pages, custom domains, and Email Studio drafts.",
              "pages:write": "Update Brand Kit, create or edit remixes, publish hosted pages or domains, and edit or publish Email Studio drafts.",
              "connectors:read": "See which apps and providers are connected, without any credentials.",
              "connectors:manage": "Disconnect apps, forget saved provider keys and manage MCP servers. Connecting an app or entering a credential needs you signed in.",
              "members:read": "See who belongs to an organization and their roles.",
              "members:manage": "Invite people and change or remove members.",
              "settings:read": "Read workspace settings, tool policy, skills and models.",
              "settings:write": "Change workspace settings, tool policy and skills.",
              "webhooks:manage": "Create, list and delete outbound webhooks.",
              "events:read": "Read the activity feed and webhook delivery log.",
              "tools:read": "Use read-only integration tools (Shopify, Klaviyo and others) the organization has connected.",
              "tools:write": "Use integration tools that change data in connected apps. Writes still follow the organization's tool policy."
            },
            "tokenUrl": "https://shaw.ai/api/auth/oauth2/token"
          }
        },
        "type": "oauth2"
      }
    },
    "schemas": {}
  }
}
```

## Unlock and read template source bundle using credits

`POST https://shaw.ai/api/templates/use`

Unlock a single template page permanently for the organization (with lifetime updates across future versions) and return its HTML and linked CSS bundle. 1 credit = 1 LOC: emails spend max(2,500, LOC) credits; website and app pages spend 5,000 to 15,000 credits based on per-page HTML + CSS LOC. Re-fetching an unlocked page or newer version costs 0 credits forever. Triggers Auto Top-Up if enabled and within cap; returns 402 `You need more credits` when remaining credits are too low.

```json
{
  "openapi": "3.1.0",
  "info": {
    "description": "Shaw's API for people and agents. Everything you can do in the app, you can do here with an API key or an OAuth token, within the scopes you grant it.\n\nA scope only narrows a credential: every request still runs as the person who owns it, with their role in the organization.\n\nRoutes under /api/skills, /api/harness-profiles, /api/data-sync, /api/templates, /api/seo are reachable with the matching read or write scope (GET reads, everything else writes) even where no typed operation is listed here.\n\nWebhook events: approval.decided, session.completed, schedule.run.started, schedule.run.failed.\n\nMCP: https://shaw.ai/mcp (also https://shaw.ai/portal/mcp).",
    "title": "Shaw API",
    "version": "1.0.0"
  },
  "servers": [
    {
      "url": "https://shaw.ai"
    }
  ],
  "paths": {
    "/api/templates/use": {
      "post": {
        "description": "Unlock a single template page permanently for the organization (with lifetime updates across future versions) and return its HTML and linked CSS bundle. 1 credit = 1 LOC: emails spend max(2,500, LOC) credits; website and app pages spend 5,000 to 15,000 credits based on per-page HTML + CSS LOC. Re-fetching an unlocked page or newer version costs 0 credits forever. Triggers Auto Top-Up if enabled and within cap; returns 402 `You need more credits` when remaining credits are too low.",
        "operationId": "use_template",
        "parameters": [
          {
            "$ref": "#/components/parameters/Tenant"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "properties": {
                  "path": {
                    "description": "Page path within the template (defaults to `/`).",
                    "type": "string"
                  },
                  "slug": {
                    "description": "Template slug (e.g. `rhode/landing`), if templateId is omitted.",
                    "type": "string"
                  },
                  "templateId": {
                    "description": "Template id (`tpl_...`) from search_templates.",
                    "type": "string"
                  },
                  "version": {
                    "description": "Optional template version id.",
                    "type": "string"
                  }
                },
                "type": "object"
              }
            }
          },
          "required": false
        },
        "responses": {
          "200": {
            "$ref": "#/components/responses/Ok"
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          }
        },
        "security": [
          {
            "apiKey": []
          },
          {
            "oauth2": [
              "pages:read"
            ]
          }
        ],
        "summary": "Unlock and read template source bundle using credits",
        "tags": [
          "Templates"
        ],
        "x-mcp-tool": "use_template",
        "x-requires-confirmation": true,
        "x-required-scope": "pages:read"
      }
    }
  },
  "components": {
    "parameters": {
      "Tenant": {
        "description": "The organization to act for (an id from `GET /api/me`). Defaults to the key's pinned organization, else your first organization. You must be a member of it.",
        "in": "header",
        "name": "X-Shaw-Tenant",
        "required": false,
        "schema": {
          "type": "string"
        }
      }
    },
    "responses": {
      "Error": {
        "content": {
          "application/json": {
            "schema": {
              "properties": {
                "error": {
                  "type": "string"
                },
                "message": {
                  "type": "string"
                }
              },
              "type": "object"
            }
          }
        },
        "description": "The request was refused or failed; `error` is a stable code."
      },
      "Forbidden": {
        "content": {
          "application/json": {
            "schema": {
              "properties": {
                "error": {
                  "enum": [
                    "insufficient_scope",
                    "bearer_not_allowed",
                    "forbidden_workspace",
                    "tenant_pinned"
                  ],
                  "type": "string"
                },
                "message": {
                  "type": "string"
                },
                "scope": {
                  "type": "string"
                }
              },
              "type": "object"
            }
          }
        },
        "description": "The credential lacks the scope, can't call this route, or can't act for the organization."
      },
      "Ok": {
        "content": {
          "application/json": {
            "schema": {}
          }
        },
        "description": "Success. The body is JSON."
      },
      "Unauthorized": {
        "content": {
          "application/json": {
            "schema": {
              "properties": {
                "error": {
                  "type": "string"
                },
                "message": {
                  "type": "string"
                }
              },
              "type": "object"
            }
          }
        },
        "description": "The credential is missing, invalid, expired or revoked.",
        "headers": {
          "WWW-Authenticate": {
            "schema": {
              "type": "string"
            }
          }
        }
      }
    },
    "securitySchemes": {
      "apiKey": {
        "bearerFormat": "sk_…",
        "description": "A personal API key created in Settings → Developers. Send it as `Authorization: Bearer sk_…`.",
        "scheme": "bearer",
        "type": "http"
      },
      "oauth2": {
        "description": "OAuth 2.1 authorization code with S256 PKCE. Clients can register themselves (RFC 7591).",
        "flows": {
          "authorizationCode": {
            "authorizationUrl": "https://shaw.ai/api/auth/oauth2/authorize",
            "refreshUrl": "https://shaw.ai/api/auth/oauth2/token",
            "scopes": {
              "org:read": "See which organizations you belong to, their profile and runtime status.",
              "org:write": "Create organizations and rename the ones you administer.",
              "sessions:read": "Read chat sessions, their messages and artifacts.",
              "sessions:write": "Start, rename, fork, compact and archive chat sessions and send messages.",
              "approvals:review": "Approve or reject the actions a session is waiting on.",
              "files:read": "Read shared files and documents.",
              "files:write": "Create, edit and delete shared files and documents.",
              "memory:read": "Read the knowledge base and shared memory.",
              "memory:write": "Add, edit, restore and delete knowledge entries.",
              "schedules:read": "Read scheduled automations.",
              "schedules:write": "Change and run scheduled automations.",
              "campaigns:read": "Read synced advertising, sales and Meta/Google campaign data.",
              "campaigns:write": "Run syncs and publish or change ad campaigns.",
              "reports:read": "Read SEO reports and research.",
              "reports:write": "Run and change SEO reports and research.",
              "pages:read": "Read template catalog metadata, code size/credits, Brand Kit, remixes, hosted pages, custom domains, and Email Studio drafts.",
              "pages:write": "Update Brand Kit, create or edit remixes, publish hosted pages or domains, and edit or publish Email Studio drafts.",
              "connectors:read": "See which apps and providers are connected, without any credentials.",
              "connectors:manage": "Disconnect apps, forget saved provider keys and manage MCP servers. Connecting an app or entering a credential needs you signed in.",
              "members:read": "See who belongs to an organization and their roles.",
              "members:manage": "Invite people and change or remove members.",
              "settings:read": "Read workspace settings, tool policy, skills and models.",
              "settings:write": "Change workspace settings, tool policy and skills.",
              "webhooks:manage": "Create, list and delete outbound webhooks.",
              "events:read": "Read the activity feed and webhook delivery log.",
              "tools:read": "Use read-only integration tools (Shopify, Klaviyo and others) the organization has connected.",
              "tools:write": "Use integration tools that change data in connected apps. Writes still follow the organization's tool policy."
            },
            "tokenUrl": "https://shaw.ai/api/auth/oauth2/token"
          }
        },
        "type": "oauth2"
      }
    },
    "schemas": {}
  }
}
```
