CINXE.COM
Getting started with the Pxl API - Pxl Help
<!DOCTYPE html><html class="antialiased [font-feature-settings:'ss01']" lang="en"><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width"/><title>Getting started with the Pxl API - Pxl Help</title><meta name="description" content="Create and manage Pxl assets programmatically using the official Pxl API. We currently support the creation of short links and reading of analytics."/><meta name="next-head-count" content="4"/><meta property="og:image" content="https://help.pxl.to/tiny.png"/><meta name="twitter:image" content="https://help.pxl.to/tiny.png"/><script> let mediaQuery = window.matchMedia('(prefers-color-scheme: light)') function updateTheme(savedTheme) { let theme = 'system' try { if (!savedTheme) { savedTheme = window.localStorage.theme } if (savedTheme === 'dark') { theme = 'dark' document.documentElement.classList.add('dark') } else if (savedTheme === 'light') { theme = 'light' document.documentElement.classList.remove('dark') } else if (mediaQuery.matches) { document.documentElement.classList.add('dark') } else { document.documentElement.classList.remove('dark') } } catch { theme = 'light' document.documentElement.classList.remove('dark') } return theme } function updateThemeWithoutTransitions(savedTheme) { updateTheme(savedTheme) document.documentElement.classList.add('[&_*]:!transition-none') window.setTimeout(() => { document.documentElement.classList.remove('[&_*]:!transition-none') }, 0) } document.documentElement.setAttribute('data-theme', updateTheme()) new MutationObserver(([{ oldValue }]) => { let newValue = document.documentElement.getAttribute('data-theme') if (newValue !== oldValue) { try { window.localStorage.setItem('theme', newValue) } catch {} updateThemeWithoutTransitions(newValue) } }).observe(document.documentElement, { attributeFilter: ['data-theme'], attributeOldValue: true }) mediaQuery.addEventListener('change', updateThemeWithoutTransitions) window.addEventListener('storage', updateThemeWithoutTransitions) </script><script defer="" data-domain="help.pxl.to" data-api="/pa/api/event" src="/pa/js/script.js"></script><script> window.plausible = window.plausible || function() { (window.plausible.q = window.plausible.q || []).push(arguments) } </script><link rel="preload" href="/_next/static/css/cc0c89da4477359a.css" as="style"/><link rel="stylesheet" href="/_next/static/css/cc0c89da4477359a.css" data-n-g=""/><noscript data-n-css=""></noscript><script defer="" nomodule="" src="/_next/static/chunks/polyfills-0d1b80a048d4787e.js"></script><script src="/_next/static/chunks/webpack-5752944655d749a0.js" defer=""></script><script src="/_next/static/chunks/framework-4556c45dd113b893.js" defer=""></script><script src="/_next/static/chunks/main-c7a0ff793fffb508.js" defer=""></script><script src="/_next/static/chunks/pages/_app-f6d2f5d118e3834c.js" defer=""></script><script src="/_next/static/chunks/605040ef-b1de146bca0cbdd3.js" defer=""></script><script src="/_next/static/chunks/951-1eccf3723e92029a.js" defer=""></script><script src="/_next/static/chunks/909-64cbdfde64ae71ab.js" defer=""></script><script src="/_next/static/chunks/pages/docs/api-requests-8bb0593ef230247b.js" defer=""></script><script src="/_next/static/PkQ8gH5vl9Ff98ShyLQes/_buildManifest.js" defer=""></script><script src="/_next/static/PkQ8gH5vl9Ff98ShyLQes/_ssgManifest.js" defer=""></script></head><body class="bg-white dark:bg-slate-900"><div id="__next"><header class="sticky top-0 z-50 flex flex-wrap items-center justify-between bg-white px-4 py-5 transition duration-500 sm:px-6 lg:px-8 dark:bg-transparent"><div class="mr-6 flex lg:hidden"><button type="button" class="relative" aria-label="Open navigation"><svg aria-hidden="true" viewBox="0 0 24 24" fill="none" stroke-width="2" stroke-linecap="round" class="h-6 w-6 stroke-slate-500"><path d="M4 7h16M4 12h16M4 17h16"></path></svg></button><div style="position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0, 0, 0, 0);white-space:nowrap;border-width:0;display:none"></div></div><div class="relative flex flex-grow basis-0 items-center"><a aria-label="Home page" class="mt-1" href="/"><div class="hidden [[data-theme=light]_&]:block"><span style="box-sizing:border-box;display:inline-block;overflow:hidden;width:initial;height:initial;background:none;opacity:1;border:0;margin:0;padding:0;position:relative;max-width:100%"><span style="box-sizing:border-box;display:block;width:initial;height:initial;background:none;opacity:1;border:0;margin:0;padding:0;max-width:100%"><img style="display:block;max-width:100%;width:initial;height:initial;background:none;opacity:1;border:0;margin:0;padding:0" alt="" aria-hidden="true" src="data:image/svg+xml,%3csvg%20xmlns=%27http://www.w3.org/2000/svg%27%20version=%271.1%27%20width=%27100%27%20height=%2738%27/%3e"/></span><img alt="pxl.to" src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" decoding="async" data-nimg="intrinsic" style="position:absolute;top:0;left:0;bottom:0;right:0;box-sizing:border-box;padding:0;border:none;margin:auto;display:block;width:0;height:0;min-width:100%;max-width:100%;min-height:100%;max-height:100%"/><noscript><img alt="pxl.to" srcSet="/_next/static/media/tiny.58a8ac3c.svg 1x, /_next/static/media/tiny.58a8ac3c.svg 2x" src="/_next/static/media/tiny.58a8ac3c.svg" decoding="async" data-nimg="intrinsic" style="position:absolute;top:0;left:0;bottom:0;right:0;box-sizing:border-box;padding:0;border:none;margin:auto;display:block;width:0;height:0;min-width:100%;max-width:100%;min-height:100%;max-height:100%" loading="lazy"/></noscript></span></div><div class="hidden [[data-theme=dark]_&]:block"><span style="box-sizing:border-box;display:inline-block;overflow:hidden;width:initial;height:initial;background:none;opacity:1;border:0;margin:0;padding:0;position:relative;max-width:100%"><span style="box-sizing:border-box;display:block;width:initial;height:initial;background:none;opacity:1;border:0;margin:0;padding:0;max-width:100%"><img style="display:block;max-width:100%;width:initial;height:initial;background:none;opacity:1;border:0;margin:0;padding:0" alt="" aria-hidden="true" src="data:image/svg+xml,%3csvg%20xmlns=%27http://www.w3.org/2000/svg%27%20version=%271.1%27%20width=%27100%27%20height=%2738%27/%3e"/></span><img alt="pxl.to" src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" decoding="async" data-nimg="intrinsic" style="position:absolute;top:0;left:0;bottom:0;right:0;box-sizing:border-box;padding:0;border:none;margin:auto;display:block;width:0;height:0;min-width:100%;max-width:100%;min-height:100%;max-height:100%"/><noscript><img alt="pxl.to" srcSet="/_next/static/media/tinywhite.93d07320.svg 1x, /_next/static/media/tinywhite.93d07320.svg 2x" src="/_next/static/media/tinywhite.93d07320.svg" decoding="async" data-nimg="intrinsic" style="position:absolute;top:0;left:0;bottom:0;right:0;box-sizing:border-box;padding:0;border:none;margin:auto;display:block;width:0;height:0;min-width:100%;max-width:100%;min-height:100%;max-height:100%" loading="lazy"/></noscript></span></div><div class="hidden [:not(.dark)[data-theme=system]_&]:block"><span style="box-sizing:border-box;display:inline-block;overflow:hidden;width:initial;height:initial;background:none;opacity:1;border:0;margin:0;padding:0;position:relative;max-width:100%"><span style="box-sizing:border-box;display:block;width:initial;height:initial;background:none;opacity:1;border:0;margin:0;padding:0;max-width:100%"><img style="display:block;max-width:100%;width:initial;height:initial;background:none;opacity:1;border:0;margin:0;padding:0" alt="" aria-hidden="true" src="data:image/svg+xml,%3csvg%20xmlns=%27http://www.w3.org/2000/svg%27%20version=%271.1%27%20width=%27100%27%20height=%2738%27/%3e"/></span><img alt="pxl.to" src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" decoding="async" data-nimg="intrinsic" style="position:absolute;top:0;left:0;bottom:0;right:0;box-sizing:border-box;padding:0;border:none;margin:auto;display:block;width:0;height:0;min-width:100%;max-width:100%;min-height:100%;max-height:100%"/><noscript><img alt="pxl.to" srcSet="/_next/static/media/tiny.58a8ac3c.svg 1x, /_next/static/media/tiny.58a8ac3c.svg 2x" src="/_next/static/media/tiny.58a8ac3c.svg" decoding="async" data-nimg="intrinsic" style="position:absolute;top:0;left:0;bottom:0;right:0;box-sizing:border-box;padding:0;border:none;margin:auto;display:block;width:0;height:0;min-width:100%;max-width:100%;min-height:100%;max-height:100%" loading="lazy"/></noscript></span></div><div class="hidden [.dark[data-theme=system]_&]:block"><span style="box-sizing:border-box;display:inline-block;overflow:hidden;width:initial;height:initial;background:none;opacity:1;border:0;margin:0;padding:0;position:relative;max-width:100%"><span style="box-sizing:border-box;display:block;width:initial;height:initial;background:none;opacity:1;border:0;margin:0;padding:0;max-width:100%"><img style="display:block;max-width:100%;width:initial;height:initial;background:none;opacity:1;border:0;margin:0;padding:0" alt="" aria-hidden="true" src="data:image/svg+xml,%3csvg%20xmlns=%27http://www.w3.org/2000/svg%27%20version=%271.1%27%20width=%27100%27%20height=%2738%27/%3e"/></span><img alt="pxl.to" src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" decoding="async" data-nimg="intrinsic" style="position:absolute;top:0;left:0;bottom:0;right:0;box-sizing:border-box;padding:0;border:none;margin:auto;display:block;width:0;height:0;min-width:100%;max-width:100%;min-height:100%;max-height:100%"/><noscript><img alt="pxl.to" srcSet="/_next/static/media/tinywhite.93d07320.svg 1x, /_next/static/media/tinywhite.93d07320.svg 2x" src="/_next/static/media/tinywhite.93d07320.svg" decoding="async" data-nimg="intrinsic" style="position:absolute;top:0;left:0;bottom:0;right:0;box-sizing:border-box;padding:0;border:none;margin:auto;display:block;width:0;height:0;min-width:100%;max-width:100%;min-height:100%;max-height:100%" loading="lazy"/></noscript></span></div></a></div><div class="-my-5 mr-6 sm:mr-8 md:mr-0"><button type="button" class="group flex h-6 w-6 items-center justify-center sm:justify-start md:h-auto md:w-80 md:flex-none md:rounded-lg md:py-2.5 md:pl-4 md:pr-3.5 md:text-sm md:ring-1 md:ring-slate-200 md:hover:ring-slate-300 dark:md:bg-slate-800/75 dark:md:ring-inset dark:md:ring-white/5 dark:md:hover:bg-slate-700/40 dark:md:hover:ring-slate-500 lg:w-96"><svg aria-hidden="true" viewBox="0 0 20 20" class="h-5 w-5 flex-none fill-slate-400 group-hover:fill-slate-500 dark:fill-slate-500 md:group-hover:fill-slate-400"><path d="M16.293 17.707a1 1 0 0 0 1.414-1.414l-1.414 1.414ZM9 14a5 5 0 0 1-5-5H2a7 7 0 0 0 7 7v-2ZM4 9a5 5 0 0 1 5-5V2a7 7 0 0 0-7 7h2Zm5-5a5 5 0 0 1 5 5h2a7 7 0 0 0-7-7v2Zm8.707 12.293-3.757-3.757-1.414 1.414 3.757 3.757 1.414-1.414ZM14 9a4.98 4.98 0 0 1-1.464 3.536l1.414 1.414A6.98 6.98 0 0 0 16 9h-2Zm-1.464 3.536A4.98 4.98 0 0 1 9 14v2a6.98 6.98 0 0 0 4.95-2.05l-1.414-1.414Z"></path></svg><span class="sr-only md:not-sr-only md:ml-2 md:text-slate-500 md:dark:text-slate-400">Search docs</span></button></div><div class="relative flex basis-0 justify-end gap-6 sm:gap-8 md:flex-grow"><div class="relative z-10"><label class="sr-only" id="headlessui-listbox-label-:Rd36:">Theme</label><button class="flex h-6 w-6 items-center justify-center rounded-lg shadow-md shadow-black/5 ring-1 ring-black/5 dark:bg-slate-700 dark:ring-inset dark:ring-white/5" id="headlessui-listbox-button-:Rl36:" type="button" aria-haspopup="true" aria-expanded="false"><svg aria-hidden="true" viewBox="0 0 16 16" class="hidden h-4 w-4 fill-sky-400 [[data-theme=light]_&]:block"><path fill-rule="evenodd" clip-rule="evenodd" d="M7 1a1 1 0 0 1 2 0v1a1 1 0 1 1-2 0V1Zm4 7a3 3 0 1 1-6 0 3 3 0 0 1 6 0Zm2.657-5.657a1 1 0 0 0-1.414 0l-.707.707a1 1 0 0 0 1.414 1.414l.707-.707a1 1 0 0 0 0-1.414Zm-1.415 11.313-.707-.707a1 1 0 0 1 1.415-1.415l.707.708a1 1 0 0 1-1.415 1.414ZM16 7.999a1 1 0 0 0-1-1h-1a1 1 0 1 0 0 2h1a1 1 0 0 0 1-1ZM7 14a1 1 0 1 1 2 0v1a1 1 0 1 1-2 0v-1Zm-2.536-2.464a1 1 0 0 0-1.414 0l-.707.707a1 1 0 0 0 1.414 1.414l.707-.707a1 1 0 0 0 0-1.414Zm0-8.486A1 1 0 0 1 3.05 4.464l-.707-.707a1 1 0 0 1 1.414-1.414l.707.707ZM3 8a1 1 0 0 0-1-1H1a1 1 0 0 0 0 2h1a1 1 0 0 0 1-1Z"></path></svg><svg aria-hidden="true" viewBox="0 0 16 16" class="hidden h-4 w-4 fill-sky-400 [[data-theme=dark]_&]:block"><path fill-rule="evenodd" clip-rule="evenodd" d="M7.23 3.333C7.757 2.905 7.68 2 7 2a6 6 0 1 0 0 12c.68 0 .758-.905.23-1.332A5.989 5.989 0 0 1 5 8c0-1.885.87-3.568 2.23-4.668ZM12 5a1 1 0 0 1 1 1 1 1 0 0 0 1 1 1 1 0 1 1 0 2 1 1 0 0 0-1 1 1 1 0 1 1-2 0 1 1 0 0 0-1-1 1 1 0 1 1 0-2 1 1 0 0 0 1-1 1 1 0 0 1 1-1Z"></path></svg><svg aria-hidden="true" viewBox="0 0 16 16" class="hidden h-4 w-4 fill-slate-400 [:not(.dark)[data-theme=system]_&]:block"><path fill-rule="evenodd" clip-rule="evenodd" d="M7 1a1 1 0 0 1 2 0v1a1 1 0 1 1-2 0V1Zm4 7a3 3 0 1 1-6 0 3 3 0 0 1 6 0Zm2.657-5.657a1 1 0 0 0-1.414 0l-.707.707a1 1 0 0 0 1.414 1.414l.707-.707a1 1 0 0 0 0-1.414Zm-1.415 11.313-.707-.707a1 1 0 0 1 1.415-1.415l.707.708a1 1 0 0 1-1.415 1.414ZM16 7.999a1 1 0 0 0-1-1h-1a1 1 0 1 0 0 2h1a1 1 0 0 0 1-1ZM7 14a1 1 0 1 1 2 0v1a1 1 0 1 1-2 0v-1Zm-2.536-2.464a1 1 0 0 0-1.414 0l-.707.707a1 1 0 0 0 1.414 1.414l.707-.707a1 1 0 0 0 0-1.414Zm0-8.486A1 1 0 0 1 3.05 4.464l-.707-.707a1 1 0 0 1 1.414-1.414l.707.707ZM3 8a1 1 0 0 0-1-1H1a1 1 0 0 0 0 2h1a1 1 0 0 0 1-1Z"></path></svg><svg aria-hidden="true" viewBox="0 0 16 16" class="hidden h-4 w-4 fill-slate-400 [.dark[data-theme=system]_&]:block"><path fill-rule="evenodd" clip-rule="evenodd" d="M7.23 3.333C7.757 2.905 7.68 2 7 2a6 6 0 1 0 0 12c.68 0 .758-.905.23-1.332A5.989 5.989 0 0 1 5 8c0-1.885.87-3.568 2.23-4.668ZM12 5a1 1 0 0 1 1 1 1 1 0 0 0 1 1 1 1 0 1 1 0 2 1 1 0 0 0-1 1 1 1 0 1 1-2 0 1 1 0 0 0-1-1 1 1 0 1 1 0-2 1 1 0 0 0 1-1 1 1 0 0 1 1-1Z"></path></svg></button></div></div></header><div class="relative mx-auto flex max-w-8xl justify-center sm:px-2 lg:px-8 xl:px-12" id="article"><div class="hidden lg:relative lg:block lg:flex-none"><div class="absolute inset-y-0 right-0 w-[50vw] bg-slate-50 dark:hidden"></div><div class="sticky top-[4.5rem] -ml-0.5 h-[calc(100vh-4.5rem)] overflow-y-auto py-16 pl-0.5"><div class="absolute top-16 bottom-0 right-0 hidden h-12 w-px bg-gradient-to-t from-slate-800 dark:block"></div><div class="absolute top-28 bottom-0 right-0 hidden w-px bg-slate-800 dark:block"></div><nav class="text-base lg:text-sm w-64 pr-8 xl:w-72 xl:pr-16"><ul role="list" class="space-y-9"><li><h2 class="font-display font-medium text-slate-900 dark:text-white">Introduction</h2><ul role="list" class="mt-2 space-y-2 border-l-2 border-slate-100 dark:border-slate-800 lg:mt-4 lg:space-y-4 lg:border-slate-200"><li class="relative"><a class="block w-full pl-3.5 before:pointer-events-none before:absolute before:-left-1 before:top-1/2 before:h-1.5 before:w-1.5 before:-translate-y-1/2 before:rounded-full text-slate-500 before:hidden before:bg-slate-300 hover:text-slate-600 hover:before:block dark:text-slate-400 dark:before:bg-slate-700 dark:hover:text-slate-300" href="/">Getting Started</a></li><li class="relative"><a class="block w-full pl-3.5 before:pointer-events-none before:absolute before:-left-1 before:top-1/2 before:h-1.5 before:w-1.5 before:-translate-y-1/2 before:rounded-full text-slate-500 before:hidden before:bg-slate-300 hover:text-slate-600 hover:before:block dark:text-slate-400 dark:before:bg-slate-700 dark:hover:text-slate-300" href="/docs/faq">Frequently Asked Questions</a></li><li class="relative"><a class="block w-full pl-3.5 before:pointer-events-none before:absolute before:-left-1 before:top-1/2 before:h-1.5 before:w-1.5 before:-translate-y-1/2 before:rounded-full text-slate-500 before:hidden before:bg-slate-300 hover:text-slate-600 hover:before:block dark:text-slate-400 dark:before:bg-slate-700 dark:hover:text-slate-300" href="/docs/troubleshooting">Troubleshooting</a></li></ul></li><li><h2 class="font-display font-medium text-slate-900 dark:text-white">Core Features</h2><ul role="list" class="mt-2 space-y-2 border-l-2 border-slate-100 dark:border-slate-800 lg:mt-4 lg:space-y-4 lg:border-slate-200"><li class="relative"><a class="block w-full pl-3.5 before:pointer-events-none before:absolute before:-left-1 before:top-1/2 before:h-1.5 before:w-1.5 before:-translate-y-1/2 before:rounded-full text-slate-500 before:hidden before:bg-slate-300 hover:text-slate-600 hover:before:block dark:text-slate-400 dark:before:bg-slate-700 dark:hover:text-slate-300" href="/docs/links">Short Links</a></li><li class="relative"><a class="block w-full pl-3.5 before:pointer-events-none before:absolute before:-left-1 before:top-1/2 before:h-1.5 before:w-1.5 before:-translate-y-1/2 before:rounded-full text-slate-500 before:hidden before:bg-slate-300 hover:text-slate-600 hover:before:block dark:text-slate-400 dark:before:bg-slate-700 dark:hover:text-slate-300" href="/docs/dynamic-qr-codes">Dynamic QR Codes</a></li><li class="relative"><a class="block w-full pl-3.5 before:pointer-events-none before:absolute before:-left-1 before:top-1/2 before:h-1.5 before:w-1.5 before:-translate-y-1/2 before:rounded-full text-slate-500 before:hidden before:bg-slate-300 hover:text-slate-600 hover:before:block dark:text-slate-400 dark:before:bg-slate-700 dark:hover:text-slate-300" href="/docs/microsites">Microsites</a></li></ul></li><li><h2 class="font-display font-medium text-slate-900 dark:text-white">Additional Features</h2><ul role="list" class="mt-2 space-y-2 border-l-2 border-slate-100 dark:border-slate-800 lg:mt-4 lg:space-y-4 lg:border-slate-200"><li class="relative"><a class="block w-full pl-3.5 before:pointer-events-none before:absolute before:-left-1 before:top-1/2 before:h-1.5 before:w-1.5 before:-translate-y-1/2 before:rounded-full text-slate-500 before:hidden before:bg-slate-300 hover:text-slate-600 hover:before:block dark:text-slate-400 dark:before:bg-slate-700 dark:hover:text-slate-300" href="/docs/analytics">Analytics</a></li><li class="relative"><a class="block w-full pl-3.5 before:pointer-events-none before:absolute before:-left-1 before:top-1/2 before:h-1.5 before:w-1.5 before:-translate-y-1/2 before:rounded-full text-slate-500 before:hidden before:bg-slate-300 hover:text-slate-600 hover:before:block dark:text-slate-400 dark:before:bg-slate-700 dark:hover:text-slate-300" href="/docs/custom-domains">Custom Domains</a></li><li class="relative"><a class="block w-full pl-3.5 before:pointer-events-none before:absolute before:-left-1 before:top-1/2 before:h-1.5 before:w-1.5 before:-translate-y-1/2 before:rounded-full text-slate-500 before:hidden before:bg-slate-300 hover:text-slate-600 hover:before:block dark:text-slate-400 dark:before:bg-slate-700 dark:hover:text-slate-300" href="/docs/integrations">Integrations</a></li><li class="relative"><a class="block w-full pl-3.5 before:pointer-events-none before:absolute before:-left-1 before:top-1/2 before:h-1.5 before:w-1.5 before:-translate-y-1/2 before:rounded-full text-slate-500 before:hidden before:bg-slate-300 hover:text-slate-600 hover:before:block dark:text-slate-400 dark:before:bg-slate-700 dark:hover:text-slate-300" href="/docs/retargeting">Retargeting & Tracking</a></li><li class="relative"><a class="block w-full pl-3.5 before:pointer-events-none before:absolute before:-left-1 before:top-1/2 before:h-1.5 before:w-1.5 before:-translate-y-1/2 before:rounded-full text-slate-500 before:hidden before:bg-slate-300 hover:text-slate-600 hover:before:block dark:text-slate-400 dark:before:bg-slate-700 dark:hover:text-slate-300" href="/docs/smart-links">Smart Links</a></li><li class="relative"><a class="block w-full pl-3.5 before:pointer-events-none before:absolute before:-left-1 before:top-1/2 before:h-1.5 before:w-1.5 before:-translate-y-1/2 before:rounded-full text-slate-500 before:hidden before:bg-slate-300 hover:text-slate-600 hover:before:block dark:text-slate-400 dark:before:bg-slate-700 dark:hover:text-slate-300" href="/docs/spam-protection">Spam Protection</a></li><li class="relative"><a class="block w-full pl-3.5 before:pointer-events-none before:absolute before:-left-1 before:top-1/2 before:h-1.5 before:w-1.5 before:-translate-y-1/2 before:rounded-full text-slate-500 before:hidden before:bg-slate-300 hover:text-slate-600 hover:before:block dark:text-slate-400 dark:before:bg-slate-700 dark:hover:text-slate-300" href="/docs/team-members">Team Members</a></li><li class="relative"><a class="block w-full pl-3.5 before:pointer-events-none before:absolute before:-left-1 before:top-1/2 before:h-1.5 before:w-1.5 before:-translate-y-1/2 before:rounded-full text-slate-500 before:hidden before:bg-slate-300 hover:text-slate-600 hover:before:block dark:text-slate-400 dark:before:bg-slate-700 dark:hover:text-slate-300" href="/docs/workspaces">Workspaces</a></li></ul></li><li><h2 class="font-display font-medium text-slate-900 dark:text-white">API Reference</h2><ul role="list" class="mt-2 space-y-2 border-l-2 border-slate-100 dark:border-slate-800 lg:mt-4 lg:space-y-4 lg:border-slate-200"><li class="relative"><a class="block w-full pl-3.5 before:pointer-events-none before:absolute before:-left-1 before:top-1/2 before:h-1.5 before:w-1.5 before:-translate-y-1/2 before:rounded-full font-semibold text-sky-500 before:bg-sky-500" href="/docs/api-requests">Getting Started</a></li><li class="relative"><a class="block w-full pl-3.5 before:pointer-events-none before:absolute before:-left-1 before:top-1/2 before:h-1.5 before:w-1.5 before:-translate-y-1/2 before:rounded-full text-slate-500 before:hidden before:bg-slate-300 hover:text-slate-600 hover:before:block dark:text-slate-400 dark:before:bg-slate-700 dark:hover:text-slate-300" href="/docs/api-shorts">Short Links</a></li><li class="relative"><a class="block w-full pl-3.5 before:pointer-events-none before:absolute before:-left-1 before:top-1/2 before:h-1.5 before:w-1.5 before:-translate-y-1/2 before:rounded-full text-slate-500 before:hidden before:bg-slate-300 hover:text-slate-600 hover:before:block dark:text-slate-400 dark:before:bg-slate-700 dark:hover:text-slate-300" href="/docs/api-insight">Analytics</a></li></ul></li><li><h2 class="font-display font-medium text-slate-900 dark:text-white">Earning Money with Pxl</h2><ul role="list" class="mt-2 space-y-2 border-l-2 border-slate-100 dark:border-slate-800 lg:mt-4 lg:space-y-4 lg:border-slate-200"><li class="relative"><a class="block w-full pl-3.5 before:pointer-events-none before:absolute before:-left-1 before:top-1/2 before:h-1.5 before:w-1.5 before:-translate-y-1/2 before:rounded-full text-slate-500 before:hidden before:bg-slate-300 hover:text-slate-600 hover:before:block dark:text-slate-400 dark:before:bg-slate-700 dark:hover:text-slate-300" href="/docs/pxl-partner-program">Pxl Partner Program</a></li></ul></li><li><h2 class="font-display font-medium text-slate-900 dark:text-white">Moving to Pxl</h2><ul role="list" class="mt-2 space-y-2 border-l-2 border-slate-100 dark:border-slate-800 lg:mt-4 lg:space-y-4 lg:border-slate-200"><li class="relative"><a class="block w-full pl-3.5 before:pointer-events-none before:absolute before:-left-1 before:top-1/2 before:h-1.5 before:w-1.5 before:-translate-y-1/2 before:rounded-full text-slate-500 before:hidden before:bg-slate-300 hover:text-slate-600 hover:before:block dark:text-slate-400 dark:before:bg-slate-700 dark:hover:text-slate-300" href="/docs/import-bitly-links-to-pxl">Import Bitly Links to Pxl</a></li></ul></li><li><h2 class="font-display font-medium text-slate-900 dark:text-white">Data & Privacy</h2><ul role="list" class="mt-2 space-y-2 border-l-2 border-slate-100 dark:border-slate-800 lg:mt-4 lg:space-y-4 lg:border-slate-200"><li class="relative"><a class="block w-full pl-3.5 before:pointer-events-none before:absolute before:-left-1 before:top-1/2 before:h-1.5 before:w-1.5 before:-translate-y-1/2 before:rounded-full text-slate-500 before:hidden before:bg-slate-300 hover:text-slate-600 hover:before:block dark:text-slate-400 dark:before:bg-slate-700 dark:hover:text-slate-300" href="/docs/retargeting-consent">Consent for Retargeting</a></li><li class="relative"><a class="block w-full pl-3.5 before:pointer-events-none before:absolute before:-left-1 before:top-1/2 before:h-1.5 before:w-1.5 before:-translate-y-1/2 before:rounded-full text-slate-500 before:hidden before:bg-slate-300 hover:text-slate-600 hover:before:block dark:text-slate-400 dark:before:bg-slate-700 dark:hover:text-slate-300" href="/docs/gdpr-compliance">GDPR Compliance</a></li></ul></li></ul></nav></div></div><div class="min-w-0 max-w-2xl flex-auto px-4 py-16 lg:max-w-none lg:pr-0 lg:pl-8 xl:px-16"><article><header class="mb-9 space-y-1"><p class="font-display text-sm font-medium text-sky-500">API Reference</p><h1 class="font-display text-3xl tracking-tight text-slate-900 dark:text-white">Getting started with the Pxl API</h1></header><div class="prose prose-slate max-w-none dark:prose-invert dark:text-slate-400 prose-headings:scroll-mt-28 prose-headings:font-display prose-headings:font-normal lg:prose-headings:scroll-mt-[8.5rem] prose-lead:text-slate-500 dark:prose-lead:text-slate-400 prose-a:font-semibold dark:prose-a:text-sky-400 prose-a:no-underline prose-a:shadow-[inset_0_-2px_0_0_var(--tw-prose-background,#fff),inset_0_calc(-1*(var(--tw-prose-underline-size,4px)+2px))_0_0_var(--tw-prose-underline,theme(colors.sky.300))] hover:prose-a:[--tw-prose-underline-size:6px] dark:[--tw-prose-background:theme(colors.slate.900)] dark:prose-a:shadow-[inset_0_calc(-1*var(--tw-prose-underline-size,2px))_0_0_var(--tw-prose-underline,theme(colors.sky.800))] dark:hover:prose-a:[--tw-prose-underline-size:6px] prose-pre:rounded-xl prose-pre:bg-slate-900 prose-pre:shadow-lg dark:prose-pre:bg-slate-800/60 dark:prose-pre:shadow-none dark:prose-pre:ring-1 dark:prose-pre:ring-slate-300/10 dark:prose-hr:border-slate-800"><p>Create and manage Pxl assets programmatically using the official Pxl API. We currently off <a href="/docs/api-shorts">short links</a> and <a href="/docs/api-insight">analytics</a> support.</p><div class="my-4 flex flex-col rounded-xl px-2 py-0 pb-5 bg-sky-50 dark:bg-slate-800/60 dark:ring-1 dark:ring-slate-300/10"><div class="prose"><div class="flex items-center"><svg xmlns="http://www.w3.org/2000/svg" class="h-6 w-6 flex-none" fill="none" viewBox="0 0 24 24" stroke="#7dd3fc"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 5l7 7-7 7"></path></svg><div class="ml-3"><div class="text-sky-800 [--tw-prose-background:theme(colors.sky.50)] prose-a:text-sky-900 prose-code:text-sky-900 dark:text-slate-300 dark:prose-code:text-slate-300"><p>This feature is available on <em>all plans</em>.</p></div></div></div></div><div class="not-prose pl-9"><a href="https://www.pxl.to/?ref=help-cta" target="_blank" class="rounded-full bg-blue-500 p-2 px-5 text-center text-sm text-white hover:bg-blue-400 hover:text-white focus:outline-none active:bg-blue-600 w-full md:w-auto">Get started for free</a></div></div><hr/><h2 id="overview">Overview</h2><p>The Pxl API is based on <a href="http://en.wikipedia.org/wiki/Representational_State_Transfer">REST</a>. It has predictable resource-oriented URLs, accepts <a href="https://en.wikipedia.org/wiki/POST_(HTTP)#Use_for_submitting_web_forms">form-encoded</a> request bodies, returns responses as <a href="http://www.json.org/">JSON</a>, and uses standard HTTP response codes and authentication.</p><h2 id="authentication">Authentication</h2><p>Our API supports Token Authentication as defined in <a href="https://datatracker.ietf.org/doc/html/rfc6750">RFC6750</a>. Within every API request you make, you will need to include your access token.</p><h3 id="create-an-api-token">Create an API token</h3><ol><li>Log in to your <a href="https://app.pxl.to">Pxl dashboard</a></li><li>Click on <a href="https://app.pxl.to/settings">Settings</a> in the lower left corner</li><li>Choose <a href="https://app.pxl.to/settings#api">API</a> to see your API tokens</li><li>Click the <strong>Generate Token</strong> button in the top right corner to create a new token</li></ol><div class="my-8 flex rounded-3xl p-6 bg-amber-50 dark:bg-slate-800/60 dark:ring-1 dark:ring-slate-300/10"><svg aria-hidden="true" viewBox="0 0 32 32" fill="none" class="h-8 w-8 flex-none [--icon-foreground:theme(colors.amber.900)] [--icon-background:theme(colors.amber.100)]"><defs><radialGradient cx="0" cy="0" r="1" gradientUnits="userSpaceOnUse" id=":Rl9n6:-gradient" gradientTransform="rotate(65.924 1.519 20.92) scale(25.7391)"><stop stop-color="#FDE68A" offset=".08"></stop><stop stop-color="#F59E0B" offset=".837"></stop></radialGradient><radialGradient cx="0" cy="0" r="1" gradientUnits="userSpaceOnUse" id=":Rl9n6:-gradient-dark" gradientTransform="matrix(0 24.5 -24.5 0 16 5.5)"><stop stop-color="#FDE68A" offset=".08"></stop><stop stop-color="#F59E0B" offset=".837"></stop></radialGradient></defs><g class="dark:hidden"><circle cx="20" cy="20" r="12" fill="url(#:Rl9n6:-gradient)"></circle><path d="M3 16c0 7.18 5.82 13 13 13s13-5.82 13-13S23.18 3 16 3 3 8.82 3 16Z" fill-opacity="0.5" class="fill-[var(--icon-background)] stroke-[color:var(--icon-foreground)]" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"></path><path d="m15.408 16.509-1.04-5.543a1.66 1.66 0 1 1 3.263 0l-1.039 5.543a.602.602 0 0 1-1.184 0Z" class="fill-[var(--icon-foreground)] stroke-[color:var(--icon-foreground)]" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"></path><path d="M16 23a1 1 0 1 0 0-2 1 1 0 0 0 0 2Z" fill-opacity="0.5" stroke="currentColor" class="fill-[var(--icon-background)] stroke-[color:var(--icon-foreground)]" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"></path></g><g class="hidden dark:inline"><path fill-rule="evenodd" clip-rule="evenodd" d="M2 16C2 8.268 8.268 2 16 2s14 6.268 14 14-6.268 14-14 14S2 23.732 2 16Zm11.386-4.85a2.66 2.66 0 1 1 5.228 0l-1.039 5.543a1.602 1.602 0 0 1-3.15 0l-1.04-5.543ZM16 20a2 2 0 1 0 0 4 2 2 0 0 0 0-4Z" fill="url(#:Rl9n6:-gradient-dark)"></path></g></svg><div class="ml-4 flex-auto"><p class="m-0 font-display text-xl text-amber-900 dark:text-amber-500">Save your token!</p><div class="prose mt-2.5 text-amber-800 [--tw-prose-underline:theme(colors.amber.400)] [--tw-prose-background:theme(colors.amber.50)] prose-a:text-amber-900 prose-code:text-amber-900 dark:text-slate-300 dark:[--tw-prose-underline:theme(colors.sky.700)] dark:prose-code:text-slate-300"><p>Be sure to copy and save your token. It can only be viewed once.</p></div></div></div><p>After generating a token you will pass it in the Authorization request header using the <code>Bearer</code> authentication scheme:</p><pre class="prism-code language-js"><code><span class="token literal-property property">Authorization</span><span class="token operator">:</span><span class="token plain"> </span><span class="token maybe-class-name">Bearer</span><span class="token plain"> </span><span class="token operator"><</span><span class="token maybe-class-name">Your</span><span class="token plain"> </span><span class="token maybe-class-name">Access</span><span class="token plain"> </span><span class="token maybe-class-name">Token</span><span class="token operator">></span> </code></pre><p>When a token has expired or has been revoked, it can no longer be used to authenticate Pxl API requests. Once expired or revoked, a token cannot be restored, you will need to create a new token.</p><h2 id="mime-types">MIME Types</h2><p>Responses from our API are in JSON format with UTF-8 encoding. Request bodies sent to the API should also be in JSON format. A Content-Type header is required whenever you're sending a request body:</p><pre class="prism-code language-undefined"><code><span class="token plain">Content-Type: application/json</span> </code></pre><h2 id="rate-limiting">Rate limiting</h2><p>API requests are limited to <strong>500 requests per calendar day</strong> and <strong>per authentication token</strong>. All authenticated requests will be associated with the user and organization that generated the token.</p><div class="my-8 flex rounded-3xl p-6 bg-sky-50 dark:bg-slate-800/60 dark:ring-1 dark:ring-slate-300/10"><svg aria-hidden="true" viewBox="0 0 32 32" fill="none" class="h-8 w-8 flex-none [--icon-foreground:theme(colors.slate.900)] [--icon-background:theme(colors.white)]"><defs><radialGradient cx="0" cy="0" r="1" gradientUnits="userSpaceOnUse" id=":Rppn6:-gradient" gradientTransform="matrix(0 21 -21 0 20 11)"><stop stop-color="#0EA5E9"></stop><stop stop-color="#22D3EE" offset=".527"></stop><stop stop-color="#818CF8" offset="1"></stop></radialGradient><radialGradient cx="0" cy="0" r="1" gradientUnits="userSpaceOnUse" id=":Rppn6:-gradient-dark" gradientTransform="matrix(0 24.5001 -19.2498 0 16 5.5)"><stop stop-color="#0EA5E9"></stop><stop stop-color="#22D3EE" offset=".527"></stop><stop stop-color="#818CF8" offset="1"></stop></radialGradient></defs><g class="dark:hidden"><circle cx="20" cy="20" r="12" fill="url(#:Rppn6:-gradient)"></circle><path fill-rule="evenodd" clip-rule="evenodd" d="M20 24.995c0-1.855 1.094-3.501 2.427-4.792C24.61 18.087 26 15.07 26 12.231 26 7.133 21.523 3 16 3S6 7.133 6 12.23c0 2.84 1.389 5.857 3.573 7.973C10.906 21.494 12 23.14 12 24.995V27a2 2 0 0 0 2 2h4a2 2 0 0 0 2-2v-2.005Z" class="fill-[var(--icon-background)]" fill-opacity="0.5"></path><path d="M25 12.23c0 2.536-1.254 5.303-3.269 7.255l1.391 1.436c2.354-2.28 3.878-5.547 3.878-8.69h-2ZM16 4c5.047 0 9 3.759 9 8.23h2C27 6.508 21.998 2 16 2v2Zm-9 8.23C7 7.76 10.953 4 16 4V2C10.002 2 5 6.507 5 12.23h2Zm3.269 7.255C8.254 17.533 7 14.766 7 12.23H5c0 3.143 1.523 6.41 3.877 8.69l1.392-1.436ZM13 27v-2.005h-2V27h2Zm1 1a1 1 0 0 1-1-1h-2a3 3 0 0 0 3 3v-2Zm4 0h-4v2h4v-2Zm1-1a1 1 0 0 1-1 1v2a3 3 0 0 0 3-3h-2Zm0-2.005V27h2v-2.005h-2ZM8.877 20.921C10.132 22.136 11 23.538 11 24.995h2c0-2.253-1.32-4.143-2.731-5.51L8.877 20.92Zm12.854-1.436C20.32 20.852 19 22.742 19 24.995h2c0-1.457.869-2.859 2.122-4.074l-1.391-1.436Z" class="fill-[var(--icon-foreground)]"></path><path d="M20 26a1 1 0 1 0 0-2v2Zm-8-2a1 1 0 1 0 0 2v-2Zm2 0h-2v2h2v-2Zm1 1V13.5h-2V25h2Zm-5-11.5v1h2v-1h-2Zm3.5 4.5h5v-2h-5v2Zm8.5-3.5v-1h-2v1h2ZM20 24h-2v2h2v-2Zm-2 0h-4v2h4v-2Zm-1-10.5V25h2V13.5h-2Zm2.5-2.5a2.5 2.5 0 0 0-2.5 2.5h2a.5.5 0 0 1 .5-.5v-2Zm2.5 2.5a2.5 2.5 0 0 0-2.5-2.5v2a.5.5 0 0 1 .5.5h2ZM18.5 18a3.5 3.5 0 0 0 3.5-3.5h-2a1.5 1.5 0 0 1-1.5 1.5v2ZM10 14.5a3.5 3.5 0 0 0 3.5 3.5v-2a1.5 1.5 0 0 1-1.5-1.5h-2Zm2.5-3.5a2.5 2.5 0 0 0-2.5 2.5h2a.5.5 0 0 1 .5-.5v-2Zm2.5 2.5a2.5 2.5 0 0 0-2.5-2.5v2a.5.5 0 0 1 .5.5h2Z" class="fill-[var(--icon-foreground)]"></path></g><g class="hidden dark:inline"><path fill-rule="evenodd" clip-rule="evenodd" d="M16 2C10.002 2 5 6.507 5 12.23c0 3.144 1.523 6.411 3.877 8.691.75.727 1.363 1.52 1.734 2.353.185.415.574.726 1.028.726H12a1 1 0 0 0 1-1v-4.5a.5.5 0 0 0-.5-.5A3.5 3.5 0 0 1 9 14.5V14a3 3 0 1 1 6 0v9a1 1 0 1 0 2 0v-9a3 3 0 1 1 6 0v.5a3.5 3.5 0 0 1-3.5 3.5.5.5 0 0 0-.5.5V23a1 1 0 0 0 1 1h.36c.455 0 .844-.311 1.03-.726.37-.833.982-1.626 1.732-2.353 2.354-2.28 3.878-5.547 3.878-8.69C27 6.507 21.998 2 16 2Zm5 25a1 1 0 0 0-1-1h-8a1 1 0 0 0-1 1 3 3 0 0 0 3 3h4a3 3 0 0 0 3-3Zm-8-13v1.5a.5.5 0 0 1-.5.5 1.5 1.5 0 0 1-1.5-1.5V14a1 1 0 1 1 2 0Zm6.5 2a.5.5 0 0 1-.5-.5V14a1 1 0 1 1 2 0v.5a1.5 1.5 0 0 1-1.5 1.5Z" fill="url(#:Rppn6:-gradient-dark)"></path></g></svg><div class="ml-4 flex-auto"><p class="m-0 font-display text-xl text-sky-900 dark:text-sky-400">Increased limits</p><div class="prose mt-2.5 text-sky-800 [--tw-prose-background:theme(colors.sky.50)] prose-a:text-sky-900 prose-code:text-sky-900 dark:text-slate-300 dark:prose-code:text-slate-300"><p>We recently increased the request limit from 100 to 500. If you have an API token issued earlier than September 2024, please create a new one.</p></div></div></div><p>The returned HTTP headers of any API request show your current rate limit status:</p><pre class="prism-code language-bash"><code><span class="token function">curl</span><span class="token plain"> -I </span><span class="token string">"https://api.pxl.to/api/v1/short"</span><span class="token plain"> </span><span class="token punctuation">\</span><span class="token plain"></span> <span class="token plain">-H </span><span class="token string">"Authorization: Bearer <YOUR_ACCESS_TOKEN>"</span><span class="token plain"></span> <span class="token plain"></span><span class="token operator">></span><span class="token plain"> HTTP/2 </span><span class="token number">200</span><span class="token plain"></span> <span class="token plain"></span><span class="token operator">></span><span class="token plain"> Date: Mon, 01 Jul </span><span class="token number">2022</span><span class="token plain"> </span><span class="token number">17</span><span class="token plain">:27:06 GMT</span> <span class="token plain"></span><span class="token operator">></span><span class="token plain"> x-ratelimit-limit: </span><span class="token number">100</span><span class="token plain"></span> <span class="token plain"></span><span class="token operator">></span><span class="token plain"> x-ratelimit-remaining: </span><span class="token number">99</span><span class="token plain"></span> <span class="token plain"></span><span class="token operator">></span><span class="token plain"> x-ratelimit-reset: </span><span class="token number">1658966400</span><span class="token plain"></span> <span class="token plain"></span><span class="token operator">></span><span class="token plain"> x-ratelimit-latency: </span><span class="token number">5</span> </code></pre></div></article><dl class="mt-12 flex border-t border-slate-200 pt-6 dark:border-slate-800"><div><dt class="font-display text-sm font-medium text-slate-900 dark:text-white">Previous</dt><dd class="mt-1"><a class="text-base font-semibold text-slate-500 hover:text-slate-600 dark:text-slate-400 dark:hover:text-slate-300" href="/docs/workspaces"><span aria-hidden="true">←</span> <!-- -->Workspaces</a></dd></div><div class="ml-auto text-right"><dt class="font-display text-sm font-medium text-slate-900 dark:text-white">Next</dt><dd class="mt-1"><a class="text-base font-semibold text-slate-500 hover:text-slate-600 dark:text-slate-400 dark:hover:text-slate-300" href="/docs/api-shorts">Short Links<!-- --> <span aria-hidden="true">→</span></a></dd></div></dl></div><div class="hidden xl:sticky xl:top-[4.5rem] xl:-mr-6 xl:block xl:h-[calc(100vh-4.5rem)] xl:flex-none xl:overflow-y-auto xl:py-16 xl:pr-6"><nav aria-labelledby="on-this-page-title" class="w-56"><h2 id="on-this-page-title" class="font-display text-sm font-medium text-slate-900 dark:text-white">On this page</h2><ol role="list" class="mt-4 space-y-3 text-sm"><li><h3><a class="text-sky-500" href="/docs/api-requests#overview">Overview</a></h3></li><li><h3><a class="font-normal text-slate-500 hover:text-slate-700 dark:text-slate-400 dark:hover:text-slate-300" href="/docs/api-requests#authentication">Authentication</a></h3><ol role="list" class="mt-2 space-y-3 pl-5 text-slate-500 dark:text-slate-400"><li><a class="hover:text-slate-600 dark:hover:text-slate-300" href="/docs/api-requests#create-an-api-token">Create an API token</a></li></ol></li><li><h3><a class="font-normal text-slate-500 hover:text-slate-700 dark:text-slate-400 dark:hover:text-slate-300" href="/docs/api-requests#mime-types">MIME Types</a></h3></li><li><h3><a class="font-normal text-slate-500 hover:text-slate-700 dark:text-slate-400 dark:hover:text-slate-300" href="/docs/api-requests#rate-limiting">Rate limiting</a></h3></li></ol></nav></div></div></div><script id="__NEXT_DATA__" type="application/json">{"props":{"pageProps":{"markdoc":{"content":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Create and manage Pxl assets programmatically using the official Pxl API. We currently off ",{"$$mdtype":"Tag","name":"a","attributes":{"href":"/docs/api-shorts"},"children":["short links"]}," and ",{"$$mdtype":"Tag","name":"a","attributes":{"href":"/docs/api-insight"},"children":["analytics"]}," support."]},{"$$mdtype":"Tag","name":"Availability","attributes":{},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["This feature is available on ",{"$$mdtype":"Tag","name":"em","attributes":{},"children":["all plans"]},"."]}]},{"$$mdtype":"Tag","name":"hr","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"h2","attributes":{"id":"overview"},"children":["Overview"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The Pxl API is based on ",{"$$mdtype":"Tag","name":"a","attributes":{"href":"http://en.wikipedia.org/wiki/Representational_State_Transfer"},"children":["REST"]},". It has predictable resource-oriented URLs, accepts ",{"$$mdtype":"Tag","name":"a","attributes":{"href":"https://en.wikipedia.org/wiki/POST_(HTTP)#Use_for_submitting_web_forms"},"children":["form-encoded"]}," request bodies, returns responses as ",{"$$mdtype":"Tag","name":"a","attributes":{"href":"http://www.json.org/"},"children":["JSON"]},", and uses standard HTTP response codes and authentication."]},{"$$mdtype":"Tag","name":"h2","attributes":{"id":"authentication"},"children":["Authentication"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Our API supports Token Authentication as defined in ",{"$$mdtype":"Tag","name":"a","attributes":{"href":"https://datatracker.ietf.org/doc/html/rfc6750"},"children":["RFC6750"]},". Within every API request you make, you will need to include your access token."]},{"$$mdtype":"Tag","name":"h3","attributes":{"id":"create-an-api-token"},"children":["Create an API token"]},{"$$mdtype":"Tag","name":"ol","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Log in to your ",{"$$mdtype":"Tag","name":"a","attributes":{"href":"https://app.pxl.to"},"children":["Pxl dashboard"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Click on ",{"$$mdtype":"Tag","name":"a","attributes":{"href":"https://app.pxl.to/settings"},"children":["Settings"]}," in the lower left corner"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Choose ",{"$$mdtype":"Tag","name":"a","attributes":{"href":"https://app.pxl.to/settings#api"},"children":["API"]}," to see your API tokens"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Click the ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Generate Token"]}," button in the top right corner to create a new token"]}]},{"$$mdtype":"Tag","name":"Callout","attributes":{"title":"Save your token!","type":"warning"},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Be sure to copy and save your token. It can only be viewed once."]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["After generating a token you will pass it in the Authorization request header using the ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["Bearer"]}," authentication scheme:"]},{"$$mdtype":"Tag","name":"Fence","attributes":{"language":"js"},"children":["Authorization: Bearer \u003cYour Access Token\u003e\n"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["When a token has expired or has been revoked, it can no longer be used to authenticate Pxl API requests. Once expired or revoked, a token cannot be restored, you will need to create a new token."]},{"$$mdtype":"Tag","name":"h2","attributes":{"id":"mime-types"},"children":["MIME Types"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Responses from our API are in JSON format with UTF-8 encoding. Request bodies sent to the API should also be in JSON format. A Content-Type header is required whenever you're sending a request body:"]},{"$$mdtype":"Tag","name":"Fence","attributes":{},"children":["Content-Type: application/json\n"]},{"$$mdtype":"Tag","name":"h2","attributes":{"id":"rate-limiting"},"children":["Rate limiting"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["API requests are limited to ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["500 requests per calendar day"]}," and ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["per authentication token"]},". All authenticated requests will be associated with the user and organization that generated the token."]},{"$$mdtype":"Tag","name":"Callout","attributes":{"title":"Increased limits","type":"note"},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["We recently increased the request limit from 100 to 500. If you have an API token issued earlier than September 2024, please create a new one."]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The returned HTTP headers of any API request show your current rate limit status:"]},{"$$mdtype":"Tag","name":"Fence","attributes":{"language":"bash"},"children":["curl -I \"https://api.pxl.to/api/v1/short\" \\\n-H \"Authorization: Bearer \u003cYOUR_ACCESS_TOKEN\u003e\"\n\u003e HTTP/2 200\n\u003e Date: Mon, 01 Jul 2022 17:27:06 GMT\n\u003e x-ratelimit-limit: 100\n\u003e x-ratelimit-remaining: 99\n\u003e x-ratelimit-reset: 1658966400\n\u003e x-ratelimit-latency: 5\n"]}],"frontmatter":{"title":"Getting started with the Pxl API","description":"Create and manage Pxl assets programmatically using the official Pxl API. We currently support the creation of short links and reading of analytics."},"file":{"path":"/docs/api-requests.md"}}},"__N_SSG":true},"page":"/docs/api-requests","query":{},"buildId":"PkQ8gH5vl9Ff98ShyLQes","isFallback":false,"gsp":true,"scriptLoader":[]}</script></body></html>