| title | Customize Templates in Developer Portal |
|---|---|
| description | How to customize templates in developer portal |
| sidebarTitle | Templates |
Templates are a fundamental component of the Tyk Enterprise Developer Portal, enabling dynamic content generation and customization. The portal uses Golang templates to render the live portal views, allowing you to generate dynamic HTML by embedding directives inside HTML that are replaced with values when the template is executed.
Golang's templates use the following syntax:
{{ . }}to output a value{{ .FieldName }}to access a field of an object{{ .MethodName }}to call a method on an object{{ if }} {{ else }} {{ end }}for conditionals{{ range . }} {{ . }} {{ end }}to iterate over a slice- Functions can be called like
{{ FuncName . }}or just{{ FuncName }}
These templates are part of the default theme that ships with the portal, which can be fully customized by modifying the template files. The templates have access to template data which contains dynamic values that can be rendered into the HTML. There are also a number of global helper functions available to transform data before output.
The Tyk Enterprise Developer Portal uses several types of templates to render different parts of the portal:
- Public Pages Templates: Render the portal's publicly accessible pages (such as Home, About Us, and Blog pages), forming the foundation of your portal's public-facing content. These can be customized through the Pages section of the admin dashboard.
- Private Pages Templates: Responsible for rendering the portal's authenticated user pages, like Profile settings and My Apps.
- Email Templates: Define the structure and content of emails sent by the portal, such as signup confirmations or access request approvals.
Both Public and Private Pages Templates have access to global helper functions (funcmaps) and template-specific data. Email templates can include template data and specific template functions, but do not have access to the global helper functions.
The following sections provide comprehensive information on the various components of the Tyk Enterprise Developer Portal templates:
- Template Data: Detailed explanation of the data structures available in different templates.
- Global Helper Functions: A list of global functions that can be used across templates to manipulate and display data.
- Email Templates: Information about email-specific templates and their available data.
This section outlines the Tyk Enterprise Developer Portal templates that have access to specific template data. It's important to note that data availability varies between templates, depending on their context and purpose. For instance, a product detail template has access to product-specific data that may not be available in a blog listing template.
- Analytics
- Application Create
- Application Detail
- Blogs
- Blog Detail
- Cart Checkout
- Organization User Detail
- Organization User Edit
- Organization Users List
- Product Detail
- Product OAS Documentation
Template Path: themes/default/views/analytics.tmpl
This template is used to render the analytics page.
{{ .errors }}: Map of template errors (Key: category, Value: error message){{ .apps }}: List of available applications
Accessible via {{ range .apps }}
| Attribute | Description |
|---|---|
{{ .ID }} |
Application ID |
{{ .Name }} |
Application name |
{{ .Description }} |
Application description |
{{ .RedirectURLs }} |
Application redirect URLs |
<select id="analytics-overview-select-apps" class="analytics-select-overview">
<option value="0" selected>All apps</option>
{{ range $app := .apps }}
<option value="{{ $app.ID }}">
{{ $app.Name }}
</option>
{{ end }}
</select>Template Path: themes/default/views/app_form_create.tmpl
This template is used to render the application creation form.
{{ .errors }}: Map of template errors (Key: category, Value: error message)
{{ if .errors }}
{{ range $key, $errs := .errors }}
<div class="alert alert-warning cart-error" role="alert">
<i class="tyk-icon tykon tykon-warning"></i>
<div class="alert__content">
<strong>{{ $key }}</strong>
<ul>
{{ range $errs }}
<li>{{ . }}</li>
{{ end }}
</ul>
</div>
</div>
{{ end }}
{{ end }}Template Path: themes/default/views/app_form_update.tmpl
This template is used to render the application detail and update form.
{{ .errors }}: Map of template errors (Key: category, Value: error message){{ .app }}: Selected application object.{{ .appCerts }}: Map of application MTLS certificates if applicable (Key: access request ID, Value: certificate){{ .allCerts }}: Map of all MTLS certificates stored if applicable (Key: cert fingerprint, Value: cert)
| Attribute | Description |
|---|---|
{{ .ID }} |
Certificate ID |
{{ .Name }} |
Certificate name |
{{ .Fingerprint }} |
Certificate fingerprint |
{{ .SignatureAlgorithm }} |
Signature algorithm |
{{ .Issuer }} |
Certificate issuer |
{{ .IsValid }} |
Boolean indicating if the certificate is valid |
{{ .ValidNotBefore }} |
Start date of validity |
{{ .ValidNotAfter }} |
End date of validity |
{{ .Subject }} |
Certificate subject |
| Attribute | Description |
|---|---|
{{ .ID }} |
Certificate ID |
{{ .Name }} |
Certificate name |
Accessible via {{ .app }}
| Attribute | Description |
|---|---|
{{ .ID }} |
Client ID |
{{ .Name }} |
Client name |
{{ .Description }} |
Client description |
{{ .RedirectURLs }} |
Client redirect URLs |
{{ .Credentials }} |
Array of client credentials |
{{ .AccessRequests }} |
Array of client access requests |
Accessible via {{ range $cred := .app.Credentials }}
| Attribute | Description |
|---|---|
{{ .ID }} |
Credential ID |
{{ .Credential }} |
Credential |
{{ .CredentialHash }} |
Credential hash |
{{ .OAuthClientID }} |
OAuth client ID |
{{ .OAuthClientSecret }} |
OAuth client secret |
{{ .Expires }} |
Credential expiration |
{{ .AccessRequestID }} |
Access request ID associated with the credential |
Accessible via {{ range $acreq := .app.AccessRequests }}
| Attribute | Description |
|---|---|
{{ .ID }} |
Access request ID |
{{ .Status }} |
Access request status |
{{ .UserID }} |
User ID associated with access request |
{{ .AuthType }} |
Access request auth type |
{{ .DCREnabled }} |
true if access request DCR enabled |
{{ .ProvisionImmediately }} |
true if provisioned immediately is enabled |
{{ .CatalogueID }} |
Catalogue ID |
Accessible via {{ $product := $acreq.Product }}
| Attribute | Description |
|---|---|
{{ .ID }} |
Product ID |
{{ .Name }} |
Product name |
{{ .DisplayName }} |
Product display name |
{{ .Path }} |
Product path |
{{ .Description }} |
Product description |
{{ .Content }} |
Product content |
{{ .AuthType }} |
Product auth type |
{{ .DCREnabled }} |
true if product DCR enabled |
Accessible via {{ $acreq.Plan }}
| Attribute | Description |
|---|---|
{{ .Name }} |
Plan name |
{{ .DisplayName }} |
Plan display name |
{{ .Description }} |
Plan description |
{{ .AuthType }} |
Plan auth type |
{{ .Rate }} |
Plan rate |
{{ .Per }} |
Plan period |
{{ .QuotaMax }} |
Plan quota maximum |
{{ .QuotaRenewalRate }} |
Plan quota renewal rate |
{{ .AutoApproveAccessRequests }} |
true if auto-approve access requests is enabled |
<h1>{{ .app.Name >}}</h1>
<p>{{ .app.Description }}</p>
<h2>Credentials</h2>
{{ range $cred := .app.Credentials }}
<div>
<p>ID: {{ $cred.ID }}</p>
<p>OAuth Client ID: {{ $cred.OAuthClientID }}</p>
<p>Expires: {{ $cred.Expires }}</p>
</div>
{{ end }}
<h2>Access Requests</h2>
{{ range $acreq := .app.AccessRequests }}
<div>
<p>ID: {{ $acreq.ID }}</p>
<p>Status: {{ $acreq.Status }}</p>
<p>Product: {{ $acreq.Product.Name }}</p>
<p>Plan: {{ $acreq.Plan.Name }}</p>
</div>
{{ end }}Template Path: themes/default/views/blog_listing.tmpl
This template is used to render the blog listing page.
{{ .posts }}: List of all published blog posts
Accessible via {{ range .posts }}
| Attribute | Description |
|---|---|
{{ .Title }} |
Blog post title |
{{ .Lede }} |
Blog post summary |
{{ .Content }} |
Blog post content |
{{ .MarkdownContent }} |
Markdown content (see Markdown reference) |
{{ .MarkdownEnabled }} |
Boolean for Markdown enablement |
{{ .Path }} |
Blog post path |
{{ .HeaderImage.URL }} |
Header image URL |
{{ .BlogSiteID }} |
Blog site ID |
{{ .ProductID }} |
Associated product ID |
{{ .AuthorID }} |
Author ID |
{{ .URL }} |
Full URL of the blog post |
<h1>Blog Posts</h1>
{{ range .posts }}
<div class="blog-post">
<h2><a href="{{ .URL }}">{{ .Title }}</a></h2>
<img src="{{ .HeaderImage.URL }}" alt="{{ .Title }}">
<p>{{ .Lede }}</p>
</div>
{{ end }}Template Path: themes/default/views/blog_detail.tmpl
This template is used to render the blog detail page.
{{ .post }}: The selected blog post object.{{ .latest_posts }}: List of 3 latest blog posts.
Accessible via {{ .post }} or {{ range .latest_posts }}
| Attribute | Description |
|---|---|
{{ .Title }} |
Blog post title |
{{ .Lede }} |
Blog post summary |
{{ .Content }} |
Blog post content |
{{ .MarkdownContent }} |
Markdown content (see Markdown reference) |
{{ .MarkdownEnabled }} |
Boolean for Markdown enablement |
{{ .Path }} |
Blog post path |
{{ .HeaderImage.URL }} |
Header image URL |
{{ .BlogSiteID }} |
Blog site ID |
{{ .ProductID }} |
Associated product ID |
{{ .AuthorID }} |
Author ID |
{{ .URL }} |
Full URL of the blog post |
<h1>{{ .post.Title }}</h1>
<img src="{{ .post.HeaderImage.URL }}" alt="{{ .post.Title }}">
<p>{{ .post.Lede }}</p>
{{ if .post.MarkdownEnabled }}
{{ .post.MarkdownContent | markdownify }}
{{ else }}
{{ .post.Content }}
{{ end }}
<p>Read more at: <a href="{{ .post.URL }}">{{ .post.URL }}</a></p>
<h2>Latest Posts</h2>
{{ range .latest_posts }}
<div>
<h3><a href="{{ .URL }}">{{ .Title }}</a></h3>
<p>{{ .Lede }}</p>
</div>
{{ end }}
Template Path: themes/default/views/portal_checkout.tmpl
This template is used to render the cart checkout page.
{{ .cart }}: Map with the cart items for the current user{{ .apps }}: List of applications for the current user{{ .catalogue_count }}: Cart catalogues count{{ .certs }}: List of MTLS certificates if applicable{{ .errors }}: Map of template errors (Key: category, Value: error message){{ .provisioned }}: Boolean indicating whether an access request has been provisioned for the cart
Accessible via {{ range .apps }}
| Attribute | Description |
|---|---|
{{ .Name }} |
Application name |
{{ .Description }} |
Application description |
{{ .RedirectURLs }} |
Application redirect URLs |
Accessible via {{ range .certs }}
| Attribute | Description |
|---|---|
{{ .ID }} |
Certificate ID |
{{ .Name }} |
Certificate name |
Accessible via {{ range $key, $value := .cart }}
| Attribute | Description |
|---|---|
{{ $value.AuthType }} |
Cart item auth type |
{{ $value.Catalogue }} |
Cart item catalogue |
{{ $value.Products }} |
Cart item array of products |
{{ $value.Plan }} |
Cart item plan |
{{ $value.DCREnabled }} |
true if cart order consists of DCR products |
Accessible via {{ $plan := $value.Plan }}
| Attribute | Description |
|---|---|
{{ .ID }} |
Plan ID |
{{ .PlanName }} |
Plan name |
{{ .FormatQuota }} |
Formatted quota information |
{{ .FormatRateLimit }} |
Formatted rate limit information |
Accessible via {{ $catalogue := $value.Catalogue }}
| Attribute | Description |
|---|---|
{{ .ID }} |
Catalogue ID |
Accessible via {{ range $product := $value.Products }}
| Attribute | Description |
|---|---|
{{ .ID }} |
Product ID |
{{ .Name }} |
Product name |
{{ .DisplayName }} |
Product display name |
{{ .Path }} |
Product path |
{{ .Description }} |
Product description |
{{ .Content }} |
Product content |
{{ .AuthType }} |
Product auth type |
{{ .DCREnabled }} |
true if product DCR enabled |
{{ .AuthTypes }} |
List of product auth types |
Accessible via {{ range $auth_type := $product.AuthTypes }}
| Attribute | Description |
|---|---|
{{ .AuthType }} |
Auth type |
Accessible via {{ range $template := $product.Templates }}
| Attribute | Description |
|---|---|
{{ .ID }} |
Template ID |
{{ .Name }} |
Template name |
{{ .GrantType }} |
Template grant type |
{{ .ResponseTypes }} |
Template response types |
{{ .TokenEndpointAuthMethod }} |
Template token endpoint auth method |
{{ .OktaAppType }} |
Template Okta app type |
Auth Type: {{ $value.AuthType }}
Plan: {{ $value.Plan.Name }}
{{ range $product := $value.Products }} {{ end }}ID: {{ $cert.ID }}
Name: {{ $cert.Name }}
Template Path: themes/default/views/user_detail.tmpl
This template is used to render the organization user detail page.
{{ .errors }}: Map of template errors (Key: category, Value: error message){{ .user }}: The organization user object.
Accessible via {{ .user }}
| Attribute/Method | Description |
|---|---|
{{ .ID }} |
User ID |
{{ .First }} |
User name |
{{ .Last }} |
User surname |
{{ .Email }} |
User email |
{{ .OrganisationID }} |
User organization ID |
{{ .DisplayName }} |
User complete name |
{{ .IdentityProvider }} |
User provider (Portal or Tyk Identity Broker) |
{{ .GetOrganisationID }} |
User's organization ID |
{{ .IsAdmin }} |
true if user is an admin |
{{ .IsOrgAdmin }} |
true if user is an organization admin |
{{ .DisplayRole }} |
User's role |
-
{{ range $errs }}
- {{ . }} {{ end }}
Name: {{ .user.DisplayName }}
Email: {{ .user.Email }}
Role: {{ .user.DisplayRole }}
```Template Path: themes/default/views/user_edit.tmpl
This template is used to render the edit page for organization user.
{{ .errors }}: Map of template errors (Key: category, Value: error message){{ .roles }}: List of possible roles{{ .user }}: The organization user object.
Accessible via {{ range .roles }}
| Attribute | Description |
|---|---|
{{ .ID }} |
Role ID |
{{ .DisplayName }} |
Role display name |
Accessible via {{ .user }}
| Attribute/Method | Description |
|---|---|
{{ .ID }} |
User ID |
{{ .First }} |
User name |
{{ .Last }} |
User surname |
{{ .Email }} |
User email |
{{ .OrganisationID }} |
User organization ID |
{{ .DisplayName }} |
User complete name |
{{ .IdentityProvider }} |
User provider (Portal or Tyk Identity Broker) |
{{ .GetOrganisationID }} |
User's organization ID |
{{ .IsAdmin }} |
true if user is an admin |
{{ .IsOrgAdmin }} |
true if user is an organization admin |
{{ .DisplayRole }} |
User's role |
Template Path: themes/default/views/user_list.tmpl
This template is used to render the list of organization users.
{{ .roles }}: Map of available roles (Key: role, Value: role display name)
<td> {{ index $roles $userInvite.Role }} </td>
{{ end }}Template Path: themes/default/views/portal_product_detail.tmpl
This template is used to render the product detail page.
{{ .product }}: The selected product object{{ .catalogues }}: List of catalogue objects including the selected product{{ .unique_plans }}: List of plan objects available for the product{{ .scopes }}: Product scopes as an array of strings{{ .posts }}: List of related blog post objects{{ .errors }}: Map of template errors (Key: category, Value: error message){{ .added }}: Boolean indicating if the product is added to the cart
Accessible via {{ .product }}
| Attribute | Description |
|---|---|
{{ .ID }} |
Product ID |
{{ .Name }} |
Product name |
{{ .DisplayName }} |
Product display name |
{{ .Path }} |
Product path |
{{ .ReferenceID }} |
Product reference ID |
{{ .Description }} |
Product description |
{{ .AuthType }} |
Product auth type |
{{ .Logo.URL }} |
Product logo URL |
{{ .Feature }} |
true if the product is featured |
{{ .DCREnabled }} |
true if DCR is enabled |
{{ .ProviderID }} |
Provider ID |
{{ .Tags }} |
List of tags associated with the product |
Accessible via {{ .product.APIDetails }}
| Attribute | Description |
|---|---|
{{ .Name }} |
API name |
{{ .Description }} |
API description |
{{ .APIType }} |
API type |
{{ .TargetURL }} |
API target URL |
{{ .ListenPath }} |
API listen path |
{{ .OASUrl }} |
API OAS URL |
{{ .Status }} |
"Active" if API status is active, otherwise "Inactive" |
Accessible via {{ .product.Docs }}
| Attribute | Description |
|---|---|
{{ .Title }} |
Document title |
{{ .ID }} |
Document identifier |
{{ .Content }} |
Document content |
{{ .MarkdownContent }} |
Markdown content (see Markdown reference) |
{{ .MarkdownEnabled }} |
Boolean for Markdown enablement |
Accessible via {{ .product.Tags }}
| Attribute | Description |
|---|---|
{{ .ID }} |
Tag ID |
{{ .Name }} |
Tag name |
Accessible via {{ range .catalogues }}
| Attribute | Description |
|---|---|
{{ .Name }} |
Catalogue name |
{{ .VisibilityStatus }} |
Catalogue visibility status |
Accessible via {{ range .unique_plans }}
| Attribute | Description |
|---|---|
{{ .Name }} |
Plan name |
{{ .ID }} |
Plan ID |
{{ .DisplayName }} |
Plan display name |
{{ .Description }} |
Plan description |
{{ .AuthType }} |
Plan authentication type |
{{ .Rate }} |
Plan rate |
{{ .Per }} |
Plan rate per time unit |
{{ .QuotaMax }} |
Plan maximum quota |
{{ .QuotaRenewalRate }} |
Plan quota renewal rate |
{{ .AutoApproveAccessRequests }} |
Boolean for auto-approval of access requests |
Accessible via {{ range .posts }}
| Attribute | Description |
|---|---|
{{ .Title }} |
Post title |
{{ .Lede }} |
Post summary |
{{ .Content }} |
Post content |
{{ .MarkdownContent }} |
Markdown content (see Markdown reference) |
{{ .MarkdownEnabled }} |
Boolean for Markdown enablement |
{{ .Path }} |
Post path |
{{ .HeaderImage.URL }} |
Header image URL |
{{ .BlogSiteID }} |
Blog site ID |
{{ .ProductID }} |
Associated product ID |
{{ .AuthorID }} |
Author ID |
{{ .product.Description }}
{{ range .product.APIDetails }}Status: {{ .Status }}
Target URL: {{ .TargetURL }}
{{ end }} {{ range .product.Docs }} {{ if .MarkdownEnabled }} {{ .MarkdownContent | markdownify }} {{ else }} {{ .Content }} {{ end }} {{ end }}-
{{ range .catalogues }}
- {{ .Name }} ({{ .VisibilityStatus }}) {{ end }}
Template Paths:
themes/default/views/product_doc_stoplight_spec.tmplthemes/default/views/product_doc_redoc.tmpl
These templates are used to render the OpenAPI Specification (OAS) documentation for a product. The Stoplight Spec and ReDoc versions are available.
| Attribute | Description |
|---|---|
{{ .Name }} |
Product name |
{{ .Description }} |
Product description |
{{ .Path }} |
Product path |
{{ .Url }} |
OAS document URL |
{{ .Description }}
This section provides a detailed overview of the global helper functions available in the Tyk Enterprise Developer Portal templates. These functions are accessible across the public and private templates and allow you to perform various operations, retrieve specific data, and create dynamic content within your templates.
- CanCreateOrganisation
- Clients
- Current User
- FeaturedProducts
- FilterUserInvites
- FormatTime
- GetCart
- GetCatalogueList
- GetCataloguesForProduct
- GetClientDescription
- GetClientName
- GetMenus
- GetProducts
- IsPortalDisabled
- IsPortalPrivate
- ProductDocRenderer
- ProviderUpstreamURL
- SplitStrings
- TruncateString
- TypeOfCredential
Returns true if user can create an organization.
{{ if CanCreateOrganisation req }}
...
{{ end }}
Returns the list of applications for the current user. Expects the request as argument.
Accessible via {{ range $client := Clients req }}
| Attribute | Description |
|---|---|
{{ $client.ID }} |
Client ID |
{{ $client.Name }} |
Client name |
{{ $client.Description }} |
Client description |
{{ $client.RedirectURLs }} |
Client redirect URLs |
{{ $client.Credentials }} |
Array of client credentials |
{{ $client.AccessRequests }} |
Array of client access requests |
Accessible via {{ range $cred := $client.Credentials }}
| Attribute | Description |
|---|---|
{{ $cred.ID }} |
Credential ID |
{{ $cred.Credential }} |
Credential |
{{ $cred.CredentialHash }} |
Credential hash |
{{ $cred.OAuthClientID }} |
OAuth client ID |
{{ $cred.OAuthClientSecret }} |
OAuth client secret |
{{ $cred.Expires }} |
Credential expiration |
{{ $cred.AccessRequestID }} |
Access request ID associated with the credential |
Accessible via {{ range $acreq := $client.AccessRequests }}
| Attribute | Description |
|---|---|
{{ $acreq.ID }} |
Access request ID |
{{ $acreq.Status }} |
Access request status |
{{ $acreq.UserID }} |
User ID associated with access request |
{{ $acreq.AuthType }} |
Access request auth type |
{{ $acreq.DCREnabled }} |
true if access request DCR enabled |
{{ $acreq.ProvisionImmediately }} |
true if provisioned immediately is enabled |
{{ $acreq.CatalogueID }} |
Catalogue ID |
Accessible via {{ range $product := $acreq.Products }}
| Attribute | Description |
|---|---|
{{ $product.ID }} |
Product ID |
{{ $product.Name }} |
Product name |
{{ $product.DisplayName }} |
Product display name |
{{ $product.Path }} |
Product path |
{{ $product.Description }} |
Product description |
{{ $product.Content }} |
Product content |
{{ $product.AuthType }} |
Product auth type |
{{ $product.DCREnabled }} |
true if product DCR enabled |
Accessible via {{ $acreq.Plan }}
| Attribute | Description |
|---|---|
{{ .Name }} |
Plan name |
{{ .DisplayName }} |
Plan display name |
{{ .Description }} |
Plan description |
{{ .AuthType }} |
Plan auth type |
{{ .Rate }} |
Plan rate |
{{ .Per }} |
Plan period |
{{ .QuotaMax }} |
Plan quota maximum |
{{ .QuotaRenewalRate }} |
Plan quota renewal rate |
{{ .AutoApproveAccessRequests }} |
true if auto-approve access requests is enabled |
{{ range $client := Clients req }}
<div class="client">
<h2>Client: {{ $client.Name }}</h2>
{{ range $acreq := $client.AccessRequests }}
<h4>Products:</h4>
<ul>
{{ range $product := $acreq.Products }}
<li>
<strong>{{ $product.Name }}</strong>
{{ $product.Description }}
</li>
{{ end }}
</ul>
<h4>Plan:</h4>
<p><strong>Name:</strong> {{ $acreq.Plan.Name }}</p>
<p><strong>Rate:</strong> {{ $acreq.Plan.Rate }} per {{ $acreq.Plan.Per }}</p>
<p><strong>Quota Max:</strong> {{ $acreq.Plan.QuotaMax }}</p>
{{ end }}
</div>
{{ end }}The CurrentUser function returns the current user object if a user is logged in. It expects the request as an argument.
Accessible via {{ $user := CurrentUser req }}
| Attribute/Method | Description |
|---|---|
{{ $user.ID }} |
User ID |
{{ $user.First }} |
User name |
{{ $user.Last }} |
User surname |
{{ $user.Email }} |
User email |
{{ $user.OrganisationID }} |
User organization ID |
{{ $user.DisplayName }} |
User complete name |
{{ $user.IdentityProvider }} |
User provider (Portal or Tyk Identity Broker) |
{{ $user.GetOrganisationID }} |
User's organization ID |
{{ $user.IsAdmin }} |
true if user is an admin |
{{ $user.IsOrgAdmin }} |
true if user is an organization admin |
{{ $user.DisplayRole }} |
User's role |
{{ $user := CurrentUser req }}
{{ if $user }}
<div class="user-info">
<h2>Welcome, {{ $user.DisplayName }}!</h2>
<p>Email: {{ $user.Email }}</p>
{{ if $user.IsAdmin }}
<p>You have admin privileges.</p>
{{ else if $user.IsOrgAdmin }}
<p>You are an organization admin.</p>
{{ else }}
<p>Your role: {{ $user.DisplayRole }}</p>
{{ end }}
</div>
{{ else }}
<p>Please log in to view your account information.</p>
{{ end }}Returns a list of featured products.
Accessible via {{ range FeaturedProducts }}
| Attribute | Description |
|---|---|
{{ .ID }} |
Product ID |
{{ .Name }} |
Product name |
{{ .DisplayName }} |
Product display name |
{{ .Path }} |
Product path |
{{ .ReferenceID }} |
Product reference ID |
{{ .Description }} |
Product description |
{{ .AuthType }} |
Product auth type |
{{ .Scopes }} |
Product scopes |
{{ .Logo.URL }} |
Product logo URL |
{{ .Feature }} |
true if the product is featured |
{{ .DCREnabled }} |
true if DCR is enabled |
{{ .ProviderID }} |
Provider ID |
{{ .APIDetails }} |
Array of API details associated with the product |
{{ .Catalogues }} |
Array of catalogues associated with the product |
Accessible via {{ range .APIDetails }}
| Attribute | Description |
|---|---|
{{ .Name }} |
API name |
{{ .Description }} |
API description |
{{ .APIType }} |
API type |
{{ .TargetURL }} |
API target URL |
{{ .ListenPath }} |
API listen path |
{{ .OASUrl }} |
API OAS URL |
{{ .Status }} |
"Active" if API status is active, otherwise "Inactive" |
Accessible via {{ range .Catalogues }}
| Attribute | Description |
|---|---|
{{ .Name }} |
Catalogue name |
{{ .VisibilityStatus }} |
Catalogue visibility status |
Explore our highlighted API offerings
Returns a list of users that were invited to the current user's organization, if the user became an organization. Expects the request as a parameter.
Accessible via {{ range $invite := FilterUserInvites req }}
| Attribute | Description |
|---|---|
{{ $invite.ID }} |
User ID |
{{ $invite.Email }} |
User email |
{{ $invite.First }} |
User first name |
{{ $invite.Last }} |
User last name |
{{ $invite.Role }} |
User role |
{{ $invite.JoinedAt }} |
User joined at time |
{{ $invite.Joined }} |
Whether the user has joined |
{{ $invite.Uactive }} |
Whether the user is active |
| Name | Role | Status | |
|---|---|---|---|
| {{ $invite.First }} {{ $invite.Last }} | {{ $invite.Email }} | {{ $invite.Role }} | {{ if $invite.Joined }} Joined {{ else if $invite.Uactive }} Pending {{ else }} Inactive {{ end }} |
No pending invitations.
{{ end }} ```Formats a given time with a given format.
{{ $user := CurrentUser req }}
{{ if $user}}
{{$time := FormatTime $user.CreatedAt "2 Jan, 2006 at 3:04:00 PM (MST)"}}
{/* Use $time or other variables here */}
...
{{end}}
Returns a map with the cart items for a given user ID. Expects the user ID as an argument. This function is useful for retrieving and displaying the contents of a user's cart, including detailed information about the products, their authentication types, and associated templates.
Accessible via {{ range $key, $value := GetCart $user.ID }}
| Attribute | Description |
|---|---|
{{ $value.AuthType }} |
Cart item auth type |
{{ $value.Catalogue }} |
Cart item catalogue |
{{ $value.DCREnabled }} |
true if cart order consists of DCR products |
{{ $value.Plan }} |
Cart item plan |
{{ $value.Products }} |
Cart item array of products |
Accessible via {{ $plan := $value.Plan }}
| Attribute | Description |
|---|---|
{{ .ID }} |
Plan ID |
{{ .PlanName }} |
Plan name |
{{ .FormatQuota }} |
Formatted quota information |
{{ .FormatRateLimit }} |
Formatted rate limit information |
Accessible via {{ $catalogue := $value.Catalogue }}
| Attribute | Description |
|---|---|
{{ .ID }} |
Catalogue ID |
Accessible via {{ range $product := $value.Products }}
| Attribute | Description |
|---|---|
{{ .ID }} |
Product ID |
{{ .Name }} |
Product name |
{{ .DisplayName }} |
Product display name |
{{ .Path }} |
Product path |
{{ .Description }} |
Product description |
{{ .Content }} |
Product content |
{{ .AuthType }} |
Product auth type |
{{ .DCREnabled }} |
true if product DCR enabled |
{{ .AuthTypes }} |
List of product auth types |
Accessible via {{ range $template := $product.Templates }}
| Attribute | Description |
|---|---|
{{ .ID }} |
Template ID |
{{ .Name }} |
Template name |
{{ .GrantType }} |
Template grant type |
{{ .ResponseTypes }} |
Template response types |
{{ .TokenEndpointAuthMethod }} |
Template token endpoint auth method |
{{ .OktaAppType }} |
Template Okta app type |
{{ $user := CurrentUser req }}
{{ if $user }}
{{ $cart := GetCart $user.ID }}
{{ if $cart }}
<h2>Your Cart</h2>
{{ range $key, $value := $cart }}
<div class="cart-item">
<h3>{{ $value.Catalogue.Name }}</h3>
<p>Auth Type: {{ $value.AuthType }}</p>
{{ range $product := $value.Products }}
<div class="product">
<h4>{{ $product.DisplayName }}</h4>
<p>{{ $product.Description }}</p>
</div>
{{ end }}
</div>
{{ end }}
{{ else }}
<p>Your cart is empty.</p>
{{ end }}
{{ end }}Returns a list of catalogue names. Expects the request as parameter.
{{ range $key, $value := GetCatalogueList req }}
<option value="{{ $key }}" {{ if eq $value.Selected true }} selected {{ end }}>{{ $value.Name }}</option>
{{ end }}
Returns a list of products for a given user and product ID. Expects the request, a user and a product ID as parameters.
Accessible via {{ range GetCataloguesForProduct req $user $product.ID }}
| Attribute | Description |
|---|---|
{{ .VisibilityStatus }} |
Catalogue visibility status |
{{ .Name }} |
Catalogue name |
{{ $thisProduct := .product }}
{{ $user := CurrentUser req }}
{{ $catalogues_for_product := GetCataloguesForProduct req $user $thisProduct.ID }}
<h3>Catalogues for {{ $thisProduct.Name }}</h3>
<ul>
{{ range $catalogues_for_product }}
<li>
<strong>{{ .Name }}</strong>
(Visibility: {{ .VisibilityStatus }})
</li>
{{ end }}
</ul>Returns an application description given a credential ID.
{{ range $app.Credentials }}
...
{{ GetClientDescription .ID}}
{{end}}
Returns an application name given a credential ID.
{{ range $app.Credentials }}
...
{{ GetClientName .ID}}
{{end}}
Returns a map of all menus.
{{ if GetMenus.Primary }}
{{ range GetMenus.Primary.Children }}
{{ range .Children }}
<li class="nav-item">
<a class="dropdown-item" href="{{ .Path }}">{{ .Tag }}</a>
</li>
{{ end }}
{{ end }}
{{ end }}Returns the list of products for the current user. Expects the request as an argument.
Accessible via {{ range $product := GetProducts req }}
| Attribute | Description |
|---|---|
{{ $product.ID }} |
Product ID |
{{ $product.Name }} |
Product name |
{{ $product.DisplayName }} |
Product display name |
{{ $product.Path }} |
Product path |
{{ $product.ReferenceID }} |
Product reference ID |
{{ $product.Description }} |
Product description |
{{ $product.AuthType }} |
Product auth type |
{{ $product.Scopes }} |
Product scopes |
{{ $product.Logo.URL }} |
Product logo URL |
{{ $product.Feature }} |
true if the product is featured |
{{ $product.DCREnabled }} |
true if DCR is enabled |
{{ $product.ProviderID }} |
Provider ID |
{{ $product.APIDetails }} |
Array of API details associated with the product |
{{ $product.Catalogues }} |
Array of catalogues associated with the product |
Accessible via {{ range $api := $product.APIDetails }}
| Attribute | Description |
|---|---|
{{ $api.Name }} |
API name |
{{ $api.Description }} |
API description |
{{ $api.APIType }} |
API type |
{{ $api.TargetURL }} |
API target URL |
{{ $api.ListenPath }} |
API listen path |
{{ $api.OASUrl }} |
API OAS URL |
{{ $api.Status }} |
"Active" if API status is active, otherwise "Inactive" |
Accessible via {{ range $catalogue := $product.Catalogues }}
| Attribute | Description |
|---|---|
{{ $catalogue.Name }} |
Catalogue name |
{{ $catalogue.VisibilityStatus }} |
Catalogue visibility status |
Returns true (exception: for admins is always enabled) if portal visibility was set to hidden. Expects the request as parameter.
{{ $portalDisabled := IsPortalDisabled req }}
Returns true (exception: for admins is always enabled) if portal visibility was set to private. Expects the request as parameter.
{{ $portalPrivate := IsPortalPrivate req }}
Returns the configured product OAS renderer (redoc or stoplight).
{{ $oas_template := ProductDocRenderer }}
Returns the provider upstream URL for a given providerID. Expects the request and a provider ID as parameters.
{{ $upstreamURL := ProviderUpstreamURL req $thisProduct.ProviderID }}
Splits a given string with given separator and returns a slice of split strings.
{{ range $app.Credentials }}
...
{{ range SplitStrings .GrantType "," }}
...
{{ end }}
{{ end }}
Truncates a given string to a given length, returning the truncated string followed by three dots (…).
{{ TruncateString $api.Description 60 }}
Returns the credential type ("oAuth2.0" or "authToken") given the credential.
{{ range $app.Credentials }}
...
{{ if eq (TypeOfCredential . ) "oAuth2.0" }}
...
{{ end }}
{{end}}
This section provides a detailed overview of the email template data available in the Tyk Enterprise Developer Portal. The Tyk Enterprise Developer Portal uses a variety of email templates for different purposes, such as user registration and access request status or organization status updates. Each template has access to specific data or functions relevant to its purpose.
It's important to note that while email templates can include template data or specific template functions, they do not have access to the global helper functions available in other portal templates.
Please refer to email workflow for additional detail on email notifications sent by the portal.
- Access Request Approve/Reject
- Access Request Submitted
- Activate and Deactivate
- New User Request
- Organization Approve
- Organization Reject
- Organization Request
- Reset Password
- Targeted Invite
- Welcome User
Template Paths:
themes/default/mailers/approve.tmplthemes/default/mailers/reject.tmpl
These templates are used for sending notifications to users when their access requests are approved or rejected.
There's no data sent to these templates.
Hi,
The API Credentials you provisioned have been rejected.
Thanks,
The Team
Template Path: themes/default/mailers/submitted.tmpl
This template is used for notifying administrators about pending access requests.
{{ .requests }}: Returns the list of access requests pending approval.
Accessible via {{ range .requests }}
| Attribute | Description |
|---|---|
{{ .PlanID }} |
Plan ID associated with access request |
{{ .Status }} |
Request status |
{{ .AuthType }} |
Request authentication type |
{{ .UserID }} |
User ID associated with the request |
{{ .ClientID }} |
Client ID associated with the request |
{{ .DCREnabled }} |
Indicates if DCR (Dynamic Client Registration) is enabled for the request |
{{ .ProvisionImmediately }} |
Indicates if provisioning is immediate for the request |
{{ .CatalogueID }} |
Catalogue ID associated with the request |
Accessible via {{ range $product := $acreq.Products }}
| Attribute | Description |
|---|---|
{{ $product.ID }} |
Product ID |
{{ $product.Name }} |
Product name |
{{ $product.DisplayName }} |
Product display name |
{{ $product.Description }} |
Product description |
{{ $product.AuthType }} |
Product authentication type |
{{ $product.DCREnabled }} |
Indicates if DCR (Dynamic Client Registration) is enabled for the product |
<p>A new Access request has been submitted. Please log in to the administration dashboard to view the request.</p>
<ul>
{{ range $acreq := .requests }}
<li>
<strong>Status:</strong> {{ $acreq.Status }}<br />
<strong>User ID:</strong> {{ $acreq.UserID }}<br />
<strong>Products:</strong>
<ul>
{{ range $product := $acreq.Products }}
<li>{{ $product.DisplayName }} ({{ $product.AuthType }})</li>
{{ end }}
</ul>
</li>
{{ end }}
</ul>Template Paths:
themes/default/mailers/activate.tmplthemes/default/mailers/deactivate.tmpl
These templates are used for sending activation and deactivation notifications to users.
{{ .name }}: Returns the user's full name.
Hi, <strong>{{.name}}</strong><br/>
Your account has been activated.
Template Path: themes/default/mailers/newuser.tmpl
This template is used for notifying administrators about new user registration requests pending activation.
{{ .user }}: Returns the new user pending activation.
Accessible via {{ .user }}
| Attribute/Method | Description |
|---|---|
{{ .ID }} |
User ID |
{{ .First }} |
User name |
{{ .Last }} |
User surname |
{{ .Email }} |
User email |
{{ .OrganisationID }} |
User organization ID |
{{ .DisplayName }} |
User complete name |
{{ .IdentityProvider }} |
User provider (Portal or Tyk Identity Broker) |
{{ .GetOrganisationID }} |
User's organization ID |
{{ .IsAdmin }} |
true if user is an admin |
{{ .IsOrgAdmin }} |
true if user is an organization admin |
{{ .DisplayRole }} |
User's role |
{{ .Organisation.Name }} |
Organization name |
{{ .Teams }} |
Array of user teams |
{{ .Teams.ID }} |
Team ID |
{{ .Teams.Name }} |
Team name |
{{ .Teams.Default }} |
Indicates if the team is the default team (true/false) |
<p>There is a new user request pending. Please approve it from the admin console.</p>
<p>
Id: {{ .user.ID }}<br/>
User: {{ .user.DisplayName }} ({{ .user.Email }})<br/>
Role: {{ .user.Role }}<br/>
{{ if gt .user.OrganisationID 0 }}
Organisation: {{ .user.Organisation.Name }}<br/>
{{ else }}
Organisation: Administrators' organisation<br/>
{{ end }}
{{ if gt (len .user.Teams) 0 }}
Teams:<br/>
<ul>
{{ range .user.Teams }}
<li>{{ .Name }}</li>
{{ end }}
</ul>
{{ else }}
Teams: none
{{ end }}
</p>
Template Path: themes/default/mailers/organisation_request.tmpl
This template is used for notifying users that their organization creation request has been approved.
{{ site }}: Returns the application host.
Hello,
The organization registration request has been approved. You can now manage your organization in your dashboard here: https://{{.site}}/portal/private/dashboard
Thanks,
The team
Template Path: themes/default/mailers/organisation_reject.tmpl
This template is used for notifying users that their organization creation request has been rejected.
There's no data sent to this template.
Hello,
The organization registration request has been rejected.
Thanks,
The team
Template Path: themes/default/mailers/organisation_request.tmpl
This template is used for notifying administrators about new organization creation requests.
{{ .user }}: Returns the user who made the request.{{ .organisationName }}: Returns the new organization name.
Accessible via {{ .user }}
| Attribute/Method | Description |
|---|---|
{{ .ID }} |
User ID |
{{ .First }} |
User name |
{{ .Last }} |
User surname |
{{ .Email }} |
User email |
{{ .OrganisationID }} |
User organization ID |
{{ .DisplayName }} |
User complete name |
{{ .IdentityProvider }} |
User provider (Portal or Tyk Identity Broker) |
{{ .GetOrganisationID }} |
User's organization ID |
{{ .IsAdmin }} |
true if user is an admin |
{{ .IsOrgAdmin }} |
true if user is an organization admin |
{{ .DisplayRole }} |
User's role |
There is a new organization registration request pending. Please approve it from the admin console.
The organization name: {{ .organisationName }}.
The user: {{ .user.DisplayName }} ({{ .user.Email }}).
Template Path: themes/default/mailers/auth/reset_password.tmpl
This template is used for sending password reset emails to users.
{{ current_user }}: Returns the current user object.{{ reset_password_url }}: Returns the URL with the token for setting the password.
Accessible via {{ current_user }}
| Attribute/Method | Description |
|---|---|
{{ .ID }} |
User ID |
{{ .First }} |
User name |
{{ .Last }} |
User surname |
{{ .Email }} |
User email |
{{ .Role }} |
User role |
{{ .OrganisationID }} |
User organization ID |
{{ .DisplayName }} |
User complete name |
{{ .IdentityProvider }} |
User provider (Portal or Tyk Identity Broker) |
{{ .GetOrganisationID }} |
User's organization ID |
{{ .IsAdmin }} |
true if user is an admin |
{{ .IsOrgAdmin }} |
true if user is an organization admin |
{{ .DisplayRole }} |
User's role |
{{ $user := current_user}}
<p>Hello {{ $user.DisplayName }},</p>
<p>Someone has requested a link to change your password. You can do this through the link below.</p>
<p>{{reset_password_url}}</p>
<p>If you didn't request this, please ignore this email.</p>
<p>Your password won't change until you access the link above and create a new one.</p>
Template Path: themes/default/mailers/auth/targeted_invite.tmpl
This template is used for sending targeted invitations to users.
{{ user }}: Returns the targeted user object.{{ team }}: Returns the team name to which the user is being invited.{{ invite_url }}: Returns the URL with the token for setting the password.
Accessible via {{ user }}
| Attribute/Method | Description |
|---|---|
{{ .ID }} |
User ID |
{{ .First }} |
User name |
{{ .Last }} |
User surname |
{{ .Email }} |
User email |
{{ .Role }} |
User role |
{{ .OrganisationID }} |
User organization ID |
{{ .DisplayName }} |
User complete name |
{{ .IdentityProvider }} |
User provider (Portal or Tyk Identity Broker) |
{{ .GetOrganisationID }} |
User's organization ID |
{{ .IsAdmin }} |
true if user is an admin |
{{ .IsOrgAdmin }} |
true if user is an organization admin |
{{ .DisplayRole }} |
User's role |
{{ $u := user }}
Hi, <strong>{{ $u.DisplayName }}</strong><br/>
<p>Someone is inviting you to join {{ if $u.IsAdmin }}as an Administrator{{ else }}the {{ team }} team{{end }}. You can do this through the link below.</p>
<p>{{ invite_url }}</p>
<p>If you didn't request this, please ignore this email.</p>Template Paths:
themes/default/mailers/welcome_admin.tmplthemes/default/mailers/welcome_dev.tmpl
These templates are used for sending welcome emails to new users, with separate templates for administrators and developers.
{{ .user }}: Returns the user who made the request. Refer to the CurrentUser section for accessible attributes and methods.
Accessible via {{ .user }}
| Attribute/Method | Description |
|---|---|
{{ .ID }} |
User ID |
{{ .First }} |
User name |
{{ .Last }} |
User surname |
{{ .Email }} |
User email |
{{ .OrganisationID }} |
User organization ID |
{{ .DisplayName }} |
User complete name |
{{ .IdentityProvider }} |
User provider (Portal or Tyk Identity Broker) |
{{ .GetOrganisationID }} |
User's organization ID |
{{ .IsAdmin }} |
true if user is an admin |
{{ .IsOrgAdmin }} |
true if user is an organization admin |
{{ .DisplayRole }} |
User's role |
{{ .Organisation.Name }} |
organization name |
{{ .Teams }} |
Array of user teams |
{{ .Teams.ID }} |
Team ID |
{{ .Teams.Name }} |
Team name |
{{ .Teams.Default }} |
Indicates if the team is the default team (true/false) |
Hello {{ .user.DisplayName }},
Your account has been created for the {{ .user.Organisation.Name }} organisation.
Your assigned teams:
-
{{ range .user.Teams }}
- {{ .Name }}{{ if .Default }} (Default){{ end }} {{ end }}
We're excited to have you on board!
```