> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://developers.meshapi.ai/api-reference/mesh-api/templates/llms.txt.
> For full documentation content, see https://developers.meshapi.ai/api-reference/mesh-api/templates/llms-full.txt.

# Get a template

GET https://api.meshapi.ai/v1/templates/{template_id}

Returns a single template owned by the authenticated owner.

Unlike chat-time template resolution, this endpoint does not allow
fetching another owner's template by UUID.


Reference: https://developers.meshapi.ai/api-reference/mesh-api/templates/get-template

## OpenAPI Specification

```yaml
openapi: 3.1.0
info:
  title: openapi
  version: 1.0.0
paths:
  /v1/templates/{template_id}:
    get:
      operationId: get-template
      summary: Get a template
      description: |
        Returns a single template owned by the authenticated owner.

        Unlike chat-time template resolution, this endpoint does not allow
        fetching another owner's template by UUID.
      tags:
        - subpackage_templates
      parameters:
        - name: template_id
          in: path
          required: true
          schema:
            type: string
        - name: Authorization
          in: header
          description: Bearer authentication
          required: true
          schema:
            type: string
      responses:
        '200':
          description: The requested template.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TemplateSummary'
        '401':
          description: Missing, malformed, or invalid bearer token.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorEnvelope'
        '403':
          description: The bearer token is valid but not currently active.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorEnvelope'
        '404':
          description: The requested resource was not found.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorEnvelope'
servers:
  - url: https://api.meshapi.ai
components:
  schemas:
    ChatMessageRole:
      type: string
      enum:
        - system
        - user
        - assistant
        - tool
      title: ChatMessageRole
    TextContentPart:
      type: object
      properties:
        type:
          type: string
          enum:
            - text
        text:
          type: string
      required:
        - type
        - text
      title: TextContentPart
    ImageUrlDetail:
      type: string
      enum:
        - auto
        - low
        - high
      default: auto
      title: ImageUrlDetail
    ImageUrl:
      type: object
      properties:
        url:
          type: string
          description: Remote URL or `data:` URI.
        detail:
          $ref: '#/components/schemas/ImageUrlDetail'
      required:
        - url
      title: ImageUrl
    ImageContentPart:
      type: object
      properties:
        type:
          type: string
          enum:
            - image_url
        image_url:
          $ref: '#/components/schemas/ImageUrl'
      required:
        - type
        - image_url
      title: ImageContentPart
    ContentPart:
      oneOf:
        - $ref: '#/components/schemas/TextContentPart'
        - $ref: '#/components/schemas/ImageContentPart'
      title: ContentPart
    ChatMessageContent1:
      type: array
      items:
        $ref: '#/components/schemas/ContentPart'
      title: ChatMessageContent1
    ChatMessageContent:
      oneOf:
        - type: string
        - $ref: '#/components/schemas/ChatMessageContent1'
      title: ChatMessageContent
    ToolCallFunction:
      type: object
      properties:
        name:
          type: string
        arguments:
          type: string
          description: JSON-encoded argument object.
      required:
        - name
        - arguments
      title: ToolCallFunction
    ToolCall:
      type: object
      properties:
        id:
          type: string
        type:
          type: string
          enum:
            - function
        function:
          $ref: '#/components/schemas/ToolCallFunction'
      required:
        - id
        - type
        - function
      title: ToolCall
    ChatMessage:
      type: object
      properties:
        role:
          $ref: '#/components/schemas/ChatMessageRole'
        content:
          oneOf:
            - $ref: '#/components/schemas/ChatMessageContent'
            - type: 'null'
        name:
          type:
            - string
            - 'null'
        tool_call_id:
          type:
            - string
            - 'null'
        tool_calls:
          type:
            - array
            - 'null'
          items:
            $ref: '#/components/schemas/ToolCall'
      required:
        - role
      title: ChatMessage
    TemplateDefaultsStop:
      oneOf:
        - type: string
        - type: array
          items:
            type: string
      description: One or more stop sequences that end generation when encountered.
      title: TemplateDefaultsStop
    TemplateDefaults:
      type: object
      properties:
        temperature:
          type:
            - number
            - 'null'
          format: double
          description: >-
            Sampling temperature used for token selection. Lower values make
            output more deterministic; higher values increase randomness and
            variation.
        max_tokens:
          type:
            - integer
            - 'null'
          description: Maximum number of completion tokens to generate.
        top_p:
          type:
            - number
            - 'null'
          format: double
          description: >-
            Nucleus sampling threshold. The model samples from the smallest set
            of tokens whose cumulative probability reaches `top_p`.
        frequency_penalty:
          type:
            - number
            - 'null'
          format: double
          description: >-
            Penalizes tokens that have already appeared in the generated output,
            reducing repeated phrasing.
        presence_penalty:
          type:
            - number
            - 'null'
          format: double
          description: >-
            Penalizes tokens that have already appeared at least once, nudging
            the model toward introducing new topics.
        stop:
          oneOf:
            - $ref: '#/components/schemas/TemplateDefaultsStop'
            - type: 'null'
          description: One or more stop sequences that end generation when encountered.
        seed:
          type:
            - integer
            - 'null'
          description: >-
            Optional seed for best-effort deterministic sampling across repeated
            requests with the same parameters.
      title: TemplateDefaults
    TemplateSummary:
      type: object
      properties:
        id:
          type: string
          format: uuid
        name:
          type: string
        owner:
          type:
            - string
            - 'null'
        is_global:
          type: boolean
        description:
          type:
            - string
            - 'null'
        system:
          type:
            - string
            - 'null'
        messages:
          type:
            - array
            - 'null'
          items:
            $ref: '#/components/schemas/ChatMessage'
        model:
          type:
            - string
            - 'null'
        params:
          oneOf:
            - $ref: '#/components/schemas/TemplateDefaults'
            - type: 'null'
        variables:
          type:
            - array
            - 'null'
          items:
            type: string
        created_at:
          type: string
          format: date-time
        updated_at:
          type: string
          format: date-time
      required:
        - id
        - name
        - is_global
        - created_at
        - updated_at
      title: TemplateSummary
    ErrorBodyCode:
      type: string
      enum:
        - unauthorized
        - forbidden
        - not_found
        - model_not_found
        - validation_error
        - unprocessable_entity
        - rate_limit_exceeded
        - spend_limit_exceeded
        - conflict
        - upstream_error
        - provider_not_available
        - gateway_timeout
      title: ErrorBodyCode
    ValidationErrorDetailLocItems:
      oneOf:
        - type: string
        - type: integer
      title: ValidationErrorDetailLocItems
    ValidationErrorDetail:
      type: object
      properties:
        loc:
          type: array
          items:
            $ref: '#/components/schemas/ValidationErrorDetailLocItems'
        msg:
          type: string
        type:
          type: string
      required:
        - loc
        - msg
        - type
      title: ValidationErrorDetail
    ProviderError:
      type: object
      properties:
        provider:
          type: string
        status:
          type:
            - integer
            - 'null'
        message:
          type:
            - string
            - 'null'
      title: ProviderError
    ErrorBody:
      type: object
      properties:
        code:
          $ref: '#/components/schemas/ErrorBodyCode'
        message:
          type: string
        param:
          type:
            - string
            - 'null'
        details:
          type:
            - array
            - 'null'
          items:
            $ref: '#/components/schemas/ValidationErrorDetail'
        provider_error:
          oneOf:
            - $ref: '#/components/schemas/ProviderError'
            - type: 'null'
        retry_after_seconds:
          type:
            - integer
            - 'null'
      required:
        - code
        - message
      title: ErrorBody
    ErrorEnvelope:
      type: object
      properties:
        error:
          $ref: '#/components/schemas/ErrorBody'
        request_id:
          type: string
      required:
        - error
        - request_id
      title: ErrorEnvelope
  securitySchemes:
    HTTPBearer:
      type: http
      scheme: bearer

```

## SDK Code Examples

```typescript TypeScript (SDK)
import { MeshAPI } from "meshapi-node-sdk";

const client = new MeshAPI({
  baseUrl: "https://api.meshapi.ai",
  token: "<dashboard-jwt-or-rsk-key>",
});

const template = await client.templates.get("550e8400-e29b-41d4-a716-446655440000");
console.log(template.name);

```

```python Python (SDK)
from meshapi import MeshAPI

client = MeshAPI(
  base_url="https://api.meshapi.ai",
  token="<dashboard-jwt-or-rsk-key>",
)

template = client.templates.get("550e8400-e29b-41d4-a716-446655440000")
print(template.name)

```

```go
package main

import (
	"fmt"
	"net/http"
	"io"
)

func main() {

	url := "https://api.meshapi.ai/v1/templates/template_id"

	req, _ := http.NewRequest("GET", url, nil)

	req.Header.Add("Authorization", "Bearer <token>")

	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://api.meshapi.ai/v1/templates/template_id")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'

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://api.meshapi.ai/v1/templates/template_id")
  .header("Authorization", "Bearer <token>")
  .asString();
```

```php
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('GET', 'https://api.meshapi.ai/v1/templates/template_id', [
  'headers' => [
    'Authorization' => 'Bearer <token>',
  ],
]);

echo $response->getBody();
```

```csharp
using RestSharp;

var client = new RestClient("https://api.meshapi.ai/v1/templates/template_id");
var request = new RestRequest(Method.GET);
request.AddHeader("Authorization", "Bearer <token>");
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = ["Authorization": "Bearer <token>"]

let request = NSMutableURLRequest(url: NSURL(string: "https://api.meshapi.ai/v1/templates/template_id")! 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()
```