Templates
Requires a Pro plan or higher.
All template endpoints are scoped to a workspace: /api/workspaces/:wsId/templates.
Templates store reusable link configurations. When creating a link with template_id, the template’s config is applied as defaults - any field set on the link overrides the template.
POST /workspaces/:wsId/templates
Create a link template.
Role: admin+
curl -X POST https://nobsredir.com/api/workspaces/ws_abc123/templates \ -H "X-API-Key: nobs_your_key" \ -H "Content-Type: application/json" \ -d '{ "name": "Newsletter links", "config": { "domain": "go.yourco.com", "utm_params": {"source": "newsletter", "medium": "email"}, "tags": ["newsletter"], "expires_in_days": 90 } }'Body:
| Field | Type | Required | Description |
|---|---|---|---|
name | string | yes | Template name, max 100 characters. |
config | object | yes | Link configuration to save as defaults. Can include any link field: domain, utm_params, tags, expires_in_days, routing_rules, rules, og_title, og_description, og_image, interstitial, sequence, etc. |
The config object supports a special field expires_in_days (integer) that is not a regular link field. When a link is created with this template, expires_at is set to N days from the creation time.
Response 201:
{ "id": "tmpl_abc123", "name": "Newsletter links", "config": { "domain": "go.yourco.com", "utm_params": {"source": "newsletter", "medium": "email"}, "tags": ["newsletter"], "expires_in_days": 90 }, "created_at": "2026-03-09T12:00:00.000Z"}Errors:
400- Name or config missing402- Plan limit reached for templates (Pro: 5, Team: 20, Agency: 50)402- Templates require a Pro plan or higher
GET /workspaces/:wsId/templates
List all templates in the workspace.
Role: viewer+
curl https://nobsredir.com/api/workspaces/ws_abc123/templates \ -H "X-API-Key: nobs_your_key"Response 200:
{ "templates": [ { "id": "tmpl_abc123", "workspace_id": "ws_abc123", "name": "Newsletter links", "config": {"domain": "go.yourco.com", "utm_params": {"source": "newsletter"}}, "created_by": "usr_abc123", "created_at": "2026-03-09T12:00:00.000Z", "updated_at": "2026-03-09T12:00:00.000Z" } ]}GET /workspaces/:wsId/templates/:templateId
Get a single template by ID.
Role: viewer+
curl https://nobsredir.com/api/workspaces/ws_abc123/templates/tmpl_abc123 \ -H "X-API-Key: nobs_your_key"Response 200: Same shape as a single item in the list response.
Errors: 404 - Template not found.
PATCH /workspaces/:wsId/templates/:templateId
Update a template’s name or config.
Role: admin+
curl -X PATCH https://nobsredir.com/api/workspaces/ws_abc123/templates/tmpl_abc123 \ -H "X-API-Key: nobs_your_key" \ -H "Content-Type: application/json" \ -d '{"name": "Updated newsletter links", "config": {"domain": "go.yourco.com", "utm_params": {"source": "newsletter", "medium": "email", "campaign": "weekly"}}}'Body:
| Field | Type | Required | Description |
|---|---|---|---|
name | string | no | New name, max 100 characters. |
config | object | no | New config object (replaces the entire config). |
Response 200:
{"ok": true}Errors: 400 - No updates provided. 404 - Template not found.
DELETE /workspaces/:wsId/templates/:templateId
Delete a template. Existing links created from this template are not affected.
Role: admin+
curl -X DELETE https://nobsredir.com/api/workspaces/ws_abc123/templates/tmpl_abc123 \ -H "X-API-Key: nobs_your_key"Response 200:
{"ok": true}Errors: 404 - Template not found.
Using templates when creating links
Pass template_id when creating a link to apply template defaults:
curl -X POST https://nobsredir.com/api/workspaces/ws_abc123/links \ -H "X-API-Key: nobs_your_key" \ -H "Content-Type: application/json" \ -d '{ "target": "https://example.com/article", "template_id": "tmpl_abc123", "utm_params": {"campaign": "march-issue"} }'In this example, the template provides domain, utm_source, utm_medium, tags, and expires_in_days. The link overrides utm_campaign with its own value. The final link gets all merged settings.
See the Links API reference for the full template_id field documentation.