Link shortener API: create links programmatically
Teams that ship campaigns at scale need links created by scripts, CRMs, or internal tools. Nimriz exposes a server-side REST API on api.nimriz.com so your automation code can create, update, and track branded short links without touching the dashboard.
- Create, check, and update branded short links via HTTPS REST API on api.nimriz.com - retry-safe and idempotent
- Bulk-create up to 25 links per request with per-row idempotency keys so imports never produce duplicates on retry
- No-code path available: connect Zapier, Make, or n8n with scoped tokens for teams that want workflow automation without writing code
A three-step pattern: preflight, create, store. Safe to retry at every step.
Creating, branding, and tracking short links by hand does not scale. When a campaign management system needs to generate thousands of unique branded URLs, a CRM needs to attach a short link to every new deal, or an e-commerce platform needs to bulk-produce product links from a catalog, a manual workflow becomes an immediate bottleneck. Mistakes compound: duplicate slugs, wrong destinations, missing expiry dates, and orphaned links all accumulate faster than a dashboard user can catch them.
Nimriz exposes a server-side REST API on api.nimriz.com so your backend can create, update, and read branded short links programmatically. Authentication uses a Workspace API Key passed as Authorization: Bearer <key> or X-Nim-Api-Key: <key>. The key is workspace-scoped and must live in a server-side environment variable only. It must never appear in browser code, mobile apps, or public repositories. All write operations, including link creation, slug updates, and password changes, must come from a trusted backend.
For teams that do not want to write code, Nimriz connects to Zapier, Make, and n8n through scoped installation tokens, available now. These no-code connectors let marketing operations, RevOps, and automation builders trigger link creation from any workflow tool without a backend deployment.
The result is branded links and per-link analytics generated reliably at whatever volume your system demands: single-link creation is idempotent by slug, bulk creation via POST /api/shorten/bulk supports up to 25 links per request with per-row idempotency keys, and lifecycle operations let you update destinations, slugs, and expiry dates without disrupting already-distributed URLs.
Who it is for
Needs a stable, documented REST API with predictable auth, idempotent bulk creation, and lifecycle management endpoints so link generation fits cleanly into existing CI/CD pipelines and backend services.
Wants to wire Zapier, Make, or n8n to create campaign links automatically on deal creation, form submission, or campaign launch without deploying a backend service.
Manages multiple client domains from one workspace and needs domain-bound link creation, idempotent bulk imports from spreadsheets or CRM exports, and per-link analytics retrieval to include in client reports.
What you get
Create single links with POST /api/shorten, check slug availability with POST /api/check-slug, and update slugs, expiration dates, or passwords via dedicated PUT endpoints. All endpoints live on api.nimriz.com, authenticate with a workspace API key, and are built with retry-safe patterns so transient failures do not leave your automation code in an inconsistent state.
Slug conventions, destination validation, redirect status code rules, and domain policies are all enforced centrally on the server, so your automation code stays lightweight and does not need to re-implement business rules locally. Forbidden schemes, loop prevention, and reserved-path protection are applied automatically before any link is created, keeping your workspace clean without per-request validation logic in your codebase.
POST /api/shorten/bulk accepts up to 25 links per request, each with a per-row client_row_id and idempotency_key. Replaying the same idempotency_key returns the stored result instead of creating a duplicate, so network failures and retries during large imports are safe. Validation failures are returned per-row so a single bad row does not block the rest of the batch from completing successfully.
After creation you can update a link's slug (PUT /api/update-slug), change or remove its expiration date (PUT /api/update-expiration), and set or clear a password gate (PUT /api/update-password) without taking the link offline. Always store the url_id returned at creation time as your stable reference: slugs can change, but the url_id is permanent for the lifetime of the link.
How it works
Build once, create links everywhere
A three-step automation pattern: preflight slug availability, create the link, store the result. Each step is safe to retry. All policy enforcement happens on the server so your client code stays thin.
Preflight slug availability (POST /api/check-slug) before creation - returns { available: true } or an error code so deterministic slug workflows never hit a surprise conflict.
Create the short link (POST /api/shorten) with optional custom_slug, expires_at, password, and redirect_status_code - policy validation runs server-side.
Store url_id as your durable reference - slugs can change via PUT /api/update-slug, but url_id is permanent for the life of the link.
Setup
- 1Generate a Workspace API KeyGo to Dashboard - Settings - Integrations - API access and click Generate API key. Copy the key immediately and store it in a server-side environment variable. It is shown only once and must never appear in browser code, mobile apps, or public repositories.
- 2Create your first link from your backend
Call POST /api/shorten from your server with the Authorization: Bearer header. A minimal request looks like this:
curl examplecurl -X POST https://api.nimriz.com/api/shorten \-H "Authorization: Bearer $WORKSPACE_API_KEY" \-H "Content-Type: application/json" \-d '{"domain_id": "YOUR_DOMAIN_UUID","long_url": "https://example.com/landing?utm_source=email","custom_slug": "spring-launch","expires_at": "2026-12-31T23:59:59Z","redirect_status_code": 302}'Response{"url_id": "22222222-2222-2222-2222-222222222222","short_code": "spring-launch","short_url": "https://links.example.com/spring-launch","expires_at": "2026-12-31T23:59:59.000Z"}Store the returned url_id as your durable reference. Use short_url as the display and share value.
- 3Use bulk creation with idempotency keys for imports
For catalog imports, batch campaigns, or any job-style link creation, use POST /api/shorten/bulk. Send up to 25 items per request. Each item carries a client_row_id (your stable row identifier) and an idempotency_key (a stable key for the exact intended outcome). Replaying the same key on retry returns the stored result instead of creating a duplicate.
JS fetch example (server-side)const res = await fetch('https://api.nimriz.com/api/shorten/bulk',{ method: 'POST',headers: {'Authorization': `Bearer ${WORKSPACE_API_KEY}`,'Content-Type': 'application/json'},body: JSON.stringify({domain_id: DOMAIN_ID,items: rows.map(row => ({client_row_id: row.id,idempotency_key: `import-${sessionId}-${row.id}`,long_url: row.destinationUrl,custom_slug: row.slug}))})});const { results } = await res.json();// Per-row: check result.ok, result.url_id, result.short_url - 4Read analytics via the links APIRetrieve per-day click totals for any link with GET /api/v1/links/:id/analytics. Pass range_days (1-365, default 30), include_bots (0 or 1), and touch_type (short_link_click or qr_scan) as query parameters. You can also list all links in the workspace with GET /api/v1/links or look up a specific link by short URL with GET /api/v1/links/find.
- 5Connect Zapier, Make, or n8n for a no-code pathTeams that do not want to write backend code can connect Zapier, Make, or n8n using scoped installation tokens, available now from Dashboard - Settings - Integrations. These connectors let you trigger link creation from any supported trigger: a new CRM deal, a completed form submission, a spreadsheet row, or any other workflow event. Rotating a key in the Integrations settings does not require reconnecting the platform integration.
What good looks like
All three lifecycle endpoints require only the url_id returned at creation time. The original short URL continues to work while the update is applied.
Frequently asked questions
Where do I get an API key and is it safe to use client-side?
Can I create multiple links in one API call?
Do you have a no-code option for teams that do not want to write code?
How is the Conversion API different from the workspace API key?
What are the rate limits and what happens when I hit them?
Can I update a link's destination, slug, or expiry after it is created?
Can I automate QR code generation via the API?
How do I look up a link or retrieve analytics via the API?
Related use cases
Deeper reading
Ready to get started?
Create your account and start with the Starter workflow. Compare plans when you need higher limits or supported-plan capabilities.