NAV Navbar
shell
  • Introduction
  • Authentication
  • Account
  • Redirect
  • Errors
  • Introduction

    The PixelMe API allow access to you account information, creation, modification and deletion of redirects.

    Authentication

    To authorize, use this code:

    # With shell, you can just pass the correct header with each request
    curl -H "Authorization: Bearer <your_token>"
    

    Make sure to replace <your_token> with your API key.

    PixelMe uses API tokens to allow access to the API. You can get your API Token here.

    PixelMe API expects for the API key to be included in all API requests to the server in a header that looks like the following:

    Authorization: Bearer <your_token>

    Account

    Get your account info

    curl -H "Authorization: Bearer <your_token>" \
    "https://api.pixelme.me/accounts"
    

    The above command returns JSON structured like this:

    {
      "id": "5a009698f4dc87ec28804a6e",
      "name": "My awesome company",
      "pixels": [
        {
          "id" : "nxs_3344",
          "name" : "NS",
          "key" : "3344",
          "provider_key" : "nxs",
          "created_at" : "2017-11-18T14:50:29Z"
        },
        {
          "id" : "fb_109138409374",
          "name" : "FB 1",
          "key" : "109138409374",
          "provider_key" : "fb",
          "created_at" : "2017-11-13T19:53:12Z"
        },
        {
          "id" : "fb_2038378409377",
          "name" : "FB 2",
          "key" : "2038378409377",
          "provider_key" : "fb",
          "created_at" : "2017-11-11T08:12:12Z"
        }
      ],
      "domains": [
        "rocks.awesome.me",
        "pix.rocks.me"
      ] // optional
    }
    

    This endpoint retrieves your account details.

    HTTP Request

    GET https://api.pixelme.me/accounts

    Redirect

    Create a new redirect

    curl -H "Authorization: Bearer <your_token>" \
    -d '{"url": "http://blog.intercom.com/how-to", "pixels_ids": ["nxs_3344", "fb_109138409374"], "domain": "rocks.awesome.me", "key": "black-friday"}' \
    "https://api.pixelme.me/redirects"
    

    The above command returns JSON structured like this:

    {
      "id": "5a396ae58943663aa6a53038",
      "url": "http://blog.intercom.com/how-to",
      "pixels": [
        {
          "id" : "nxs_3344",
          "name" : "NS",
          "key" : "3344",
          "provider_key" : "nxs",
          "created_at" : "2017-11-18T14:50:29Z"
        },
        {
          "id" : "fb_109138409374",
          "name" : "FB 1",
          "key" : "109138409374",
          "provider_key" : "fb",
          "created_at" : "2017-11-13T19:53:12Z"
        }
      ],
      "domain": "rocks.awesome.me",
      "key": "black-friday",
      "shorten": "http://rocks.awesome.me/black-friday"
    }
    

    This endpoint creates a new redirect.

    HTTP Request

    POST https://api.pixelme.me/redirects

    JSON Parameters

    Parameter Description
    url URL to shorten (mandatory)
    pixels_ids array of pixels ids retrive from account details (mandatory)
    domain custom domain to use (optional)
    key key (slug) to use (optional)

    Patch a redirect

    curl -H "Authorization: Bearer <your_token>" \
    -XPATCH \
    -d '{"key": "new-black-friday"}' \
    "https://api.pixelme.me/redirects/<id>"
    

    The above command returns JSON structured like this:

    {
      "id": "5a396ae58943663aa6a53038",
      "url": "http://blog.intercom.com/how-to",
      "pixels": [
        {
          "id" : "nxs_3344",
          "name" : "NS",
          "key" : "3344",
          "provider_key" : "nxs",
          "created_at" : "2017-11-18T14:50:29Z"
        },
        {
          "id" : "fb_109138409374",
          "name" : "FB 1",
          "key" : "109138409374",
          "provider_key" : "fb",
          "created_at" : "2017-11-13T19:53:12Z"
        }
      ],
      "domain": "rocks.awesome.me",
      "key": "new-black-friday",
      "shorten": "http://rocks.awesome.me/new-black-friday"
    }
    

    This endpoint updates a redirect.

    HTTP Request

    PATCH https://api.pixelme.me/redirects/<id>

    URL Parameters

    Parameter Description
    id redirect ID (mandatory)

    JSON Parameters

    Parameter Description
    key key (slug) to use (mandatory)

    Delete a redirect

    curl -H "Authorization: Bearer <your_token>" \
    -XDELETE \
    "https://api.pixelme.me/redirects/<id>"
    

    The above command returns a 204 response code with no content.

    This endpoint deletes a redirect.

    HTTP Request

    DELETE https://api.pixelme.me/redirects/<id>

    URL Parameters

    Parameter Description
    id redirect ID (mandatory)

    Errors

    The PixelMe API uses the following error codes:

    Error Code Meaning
    400 Bad Request -- Your request is invalid.
    401 Unauthorized -- Your API key is wrong.
    404 Not Found -- The specified entity could not be found.
    405 Method Not Allowed -- You tried to access an entity with an invalid method.
    429 Too Many Requests -- You're sending too many queries! Slow down!
    500 Internal Server Error -- We had a problem with our server. Try again later.
    503 Service Unavailable -- We're temporarily offline for maintenance. Please try again later.