API Docs
Examples

Code Examples

These examples use JSON request bodies, stable resource IDs, and the standard v1 response envelope. Send the credential matching each API family in api-key.

Create And Read A Link

JavaScript
const apiKey = process.env.SHORTIFY_SERVER_API_KEY;
const baseUrl = 'https://api.shortify.com';

async function request(path, options = {}) {
  const response = await fetch(`${baseUrl}${path}`, {
    ...options,
    headers: {
      'api-key': apiKey,
      'Content-Type': 'application/json',
      ...options.headers,
    },
  });
  const body = await response.json();
  if (!response.ok || !body.success) {
    throw new Error(body.error?.message || 'Shortify request failed');
  }
  return body;
}

async function createAndReadLink() {
  const created = await request('/v1/links', {
    method: 'POST',
    headers: {'Idempotency-Key': 'pricing-2026-create'},
    body: JSON.stringify({
      url: 'https://example.com/pricing',
      domain: 'go.example.com',
      key: 'pricing-2026',
      title: 'Pricing campaign',
      tags: ['pricing', 'email'],
      objects: {campaign: 'spring-2026'},
    }),
  });

  const fetched = await request(`/v1/links/${created.data.id}`);
  return {created: created.data, fetched: fetched.data};
}

Publish Events From A Server

Backends use the Server API Key and /v1/events. The event payload matches the client event shape.

Node.js backend
const response = await fetch('https://api.shortify.com/v1/events', {
  method: 'POST',
  headers: {
    'api-key': process.env.SHORTIFY_SERVER_API_KEY,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    events: [{
      name: 'purchase',
      eventId: 'order-1001',
      linkId: 'link_01HV5A4W7QJ9K2X4Q8ZW5FGZ2R',
      properties: {currency: 'USD', value: 49},
    }],
  }),
});

if (!response.ok) throw new Error('Shortify event request failed');

Short-link Client Flow

Browser or SDK wrapper
const shortLinkClientKey = 'pk_live_your_short_link_client_key';
const baseUrl = 'https://api.shortify.com';

async function clientRequest(path, body) {
  const response = await fetch(`${baseUrl}${path}`, {
    method: 'POST',
    headers: {
      'api-key': shortLinkClientKey,
      'x-shortify-platform': 'browser',
      'Content-Type': 'application/json',
    },
    body: JSON.stringify(body),
  });
  const data = await response.json();
  if (!response.ok || !data.success) {
    throw new Error(data.error?.message || 'Shortify client request failed');
  }
  return data.data;
}

const click = await clientRequest('/v1/client/short-links/click', {
  shortLink: 'https://go.example.com/invite-abc',
  sessionId: 'anon-session-123',
});

await clientRequest('/v1/client/short-links/events', {
  events: [{
    name: 'signup_completed',
    eventId: 'signup-123',
    attributionId: click.attributionId,
    properties: {plan: 'pro'},
  }],
});

Server Deep-link Creation

Create app-bound links from a trusted backend with required appId andkey fields.

Create a deep link from a server
curl -X POST "https://api.shortify.com/v1/deep-links" \
  -H "api-key: sk_live_your_server_key" \
  -H "Content-Type: application/json" \
  --data '{
    "appId": "app_01HV4Z4Y6W3D4J9B2Y8QH6P8JS",
    "key": "invite",
    "url": "https://example.com/app-open",
    "title": "Invite flow",
    "objects": {"campaign": "invite-2026"},
    "comments": "Created by the backend",
    "tracking": {"utmSource": "app", "utmCampaign": "invite-2026"}
  }'

Analytics Export

Raw events
curl "https://api.shortify.com/v1/analytics/events?range=30d&eventType=customer_event&limit=50" \
  -H "api-key: sk_live_your_server_key"