> ## Documentation Index
> Fetch the complete documentation index at: https://docs.lithoblocks.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Get all templates

> Get all templates with optional inclusion of related data



## OpenAPI

````yaml /api-reference/openapi.json get /v1/templates
openapi: 3.0.0
info:
  version: 0.0.1
  title: LithoBlocks API
  description: >-

    # LithoBlocks API


    Welcome to the LithoBlocks API documentation. This API enables you to manage
    templates, entities, and organizations with a powerful, scope-based
    authorization system.


    ## API versioning


    Documented operations are under the `/v1` path prefix (for example, `GET
    /v1/templates`). **Older integrations** may still call the same routes
    without the `/v1` prefix (for example, `GET /templates`); those URLs remain
    supported for backward compatibility but are not listed in this OpenAPI
    document. **New integrations** should use `/v1` URLs.


    ## JSON and query naming


    Canonical names in JSON bodies, query strings, and path parameter names
    documented here are **snake_case** (for example `organization_id`,
    `template_id`, `include_author`). During a deprecation window, many inputs
    still accept legacy **camelCase** keys for the same values (for example
    `templateId` in place of `template_id`). **Responses** use snake_case for
    multi-word keys. Prefer snake_case for new clients; camelCase on input may
    be removed in a future version.


    ## Authentication & Authorization


    This API uses **LithoBlocks API Keys** for authentication with **scope-based
    authorization** for granular access control.


    ### Getting Your API Key


    1. **Log into your LithoBlocks organization dashboard**

    2. **Navigate to API Keys** in your account settings

    3. **Create a new API key** and select the required scopes

    4. **Copy your API key** (it will only be shown once for security)


    ### Using Your API Key


    Include your API key in the Authorization header:


    ```

    Authorization: Bearer lb_live_sk_example_key_here

    ```


    ### API Key Scopes & Role Requirements


    Your available scopes depend on your **organization role**. When creating an
    API key, you can only select scopes your role permits:


    #### 👥 **All Roles** (Viewer, Member, Admin, Owner)

    | Scope | Description |

    |-------|-------------|

    | `templates:read` | Read access to organization templates |

    | `messages:create` | Compile templates into messages |

    | `entities:read` | Read access to data entities |


    #### ✏️ **Member+** (Member, Admin, Owner)

    | Scope | Description |

    |-------|-------------|

    | `templates:write` | Create, update, and manage templates |

    | `entities:write` | Create, update, and manage entities |


    #### 🔑 **Admin+** (Admin, Owner)

    | Scope | Description |

    |-------|-------------|

    | `organizations:admin` | Update organization settings, manage members |

    | `users:admin` | View and manage organization users |


    ### API Key Management


    - **Multiple Keys**: Create multiple API keys with different scopes for
    different use cases

    - **Key Rotation**: Regularly rotate your API keys for security

    - **Scope Limitation**: Only request the minimum scopes needed for your
    application

    - **Organization Scoped**: All API keys are scoped to your organization


    ### Security Best Practices


    - **Never share API keys** or commit them to version control

    - **Use environment variables** to store API keys in your applications

    - **Create separate keys** for development, staging, and production

    - **Revoke unused keys** from your dashboard regularly


    ### Multi-Tenant Isolation


    All API endpoints enforce **organization-level isolation**:

    - You can only access resources within your organization

    - API keys are tied to the organization where they were created

    - Cross-organization access is never permitted


    ## Role-Based Access Control


    ### 👀 **Viewer Role**

    - Can read templates and entities

    - Can compile templates into messages

    - **Cannot** create or modify resources

    - **Cannot** access admin functions


    ### ✏️ **Member Role** 

    - All Viewer permissions

    - Can create and update templates

    - Can create and update entities

    - **Cannot** access admin functions


    ### 🔧 **Admin Role**

    - All Member permissions  

    - Can manage organization settings

    - Can view and manage users

    - **Cannot** delete the organization


    ### 👑 **Owner Role**

    - All Admin permissions

    - Full organization control

    - Can delete the organization

    - Can transfer ownership
                
  contact:
    name: LithoBlocks
    url: https://lithoblocks.com
    email: support@lithoblocks.com
servers:
  - url: https://api.lithoblocks.com
    description: Production (paths in this spec are rooted at /v1/...)
  - url: https://staging.api.lithoblocks.com
    description: Staging (paths in this spec are rooted at /v1/...)
  - url: http://localhost:8787
    description: Local dev (paths in this spec are rooted at /v1/...)
security: []
paths:
  /v1/templates:
    get:
      tags:
        - Templates
      summary: Get all templates
      description: Get all templates with optional inclusion of related data
      parameters:
        - schema:
            type: string
            default: 'true'
          required: false
          name: include_author
          in: query
        - schema:
            type: string
            default: 'false'
          required: false
          name: include_message
          in: query
        - schema:
            type: string
            default: 'false'
          required: false
          name: include_sample_data
          in: query
        - schema:
            type: string
            default: 'true'
          required: false
          name: include_request_format
          in: query
      responses:
        '200':
          description: Templates
          content:
            application/json:
              schema:
                type: array
                items:
                  type: object
                  properties:
                    id:
                      type: string
                    name:
                      type: string
                    description:
                      type: string
                    created_at:
                      type: string
                    updated_at:
                      type: string
                    is_public:
                      type: boolean
                    current_version_id:
                      type: string
                    author_id:
                      type: string
                    author:
                      type: object
                      properties:
                        id:
                          type: string
                        name:
                          type: string
                        email:
                          type: string
                      required:
                        - id
                        - name
                        - email
                    request_format:
                      type: object
                      additionalProperties:
                        type: string
                    cc_users:
                      type: array
                      items:
                        type: string
                    icon_emoji:
                      type: string
                    user_name:
                      type: string
                    current_version:
                      type: object
                      properties:
                        id:
                          type: string
                        name:
                          type: string
                        description:
                          type: string
                        created_at:
                          type: string
                        updated_at:
                          type: string
                        status:
                          type: string
                        type:
                          type: string
                        icon_emoji:
                          type: string
                        user_name:
                          type: string
                        cc_users:
                          type: array
                          items:
                            type: string
                        author_id:
                          type: string
                        request_format:
                          type: object
                          additionalProperties:
                            type: string
                      required:
                        - id
                        - name
                        - description
                        - created_at
                        - updated_at
                        - status
                        - type
                        - icon_emoji
                        - user_name
                        - cc_users
                        - author_id
                        - request_format
                  required:
                    - id
                    - name
                    - description
                    - created_at
                    - updated_at
                    - is_public
                    - current_version_id
                    - author_id
                    - request_format
                    - cc_users
                    - icon_emoji
                    - user_name
        '401':
          description: Authentication required
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                  message:
                    type: string
                required:
                  - error
                  - message
        '403':
          description: Insufficient permissions
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                  message:
                    type: string
                  required_scopes:
                    type: array
                    items:
                      type: string
                  user_scopes:
                    type: array
                    items:
                      type: string
                required:
                  - error
                  - message
                  - required_scopes
                  - user_scopes
        '404':
          description: Templates not found
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                  details:
                    type: string
                required:
                  - error
                  - details
      security:
        - bearerAuth:
            - templates:read
components:
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: API Key
      description: LithoBlocks API key obtained from your organization dashboard

````