The FitBark API enables developers to seamlessly integrate FitBark data sets into third party mobile and web apps. It works to further the bond between man and his best friend by seamlessly connecting FitBark with products and services that make the lives of our dogs richer. Let’s build together. The doggie mobile health revolution starts today.

Registration

To register as a FitBark Developer, please fill out the application below and we’ll be in touch.

AUTHENTICATION

FitBark API uses the OAuth 2.0 protocol to authenticate incoming requests. A client_id and client_secret are assigned to each application created by a Developer. The Developer can then request authorization from the user to access user’s data and obtain an Access Token, which will be used for further requests. This token will have an extended expiration time, and the Developer can store the token and use it for multiple calls. To make calls on behalf of the user, the Developer needs to get explicit permission from the user via a 3-legged authentication mechanism.

Step 1

User is redirected to the authentication page (GEThttps://app.fitbark.com/oauth/authorize) passing:

  • response_type=code: must have the value “client_credentials” to obtain the authorization code
  • client_id: unique identifier obtained from the developer portal
  • redirect_uri: URI where to redirect the user after he/she grants permissions. This URI must match one of the URI prefixes defined when setting up API access

Step 2

If the user is not logged in, then he/she will be asked to enter their user and password. After the user logs in, he’ll see the list of permissions being asked, and needs to accept the request.

Step 3

If the user accepts, then he/she is redirected back to the Developer’s site, using the redirect_uri, and passing the authorization code in the query parameter. For example:http://your_web.com/access?code=ABC123/. This authorization code has an expiration of 10 minutes.

Step 4

Last step, is for the Developer to exchange the authorization code with an access token. To this extent, the Developer must make an HTTP call (server to server) to obtain the access token (POSThttps://app.fitbark.com/oauth/token) passing:

  • client_id: unique identifier obtained from the dev portal
  • client_secret: secret key obtained from the dev portal
  • grant_type=authorization_code: must have the value “authorization_code” to exchange the token
  • redirect_uri: URI where to redirect the user after he/she grants permissions. This URI must match one of the URI prefixes defined when setting up API access
  • code: the authorization code sent by FitBark on the previous step

Step 5

The server will return a JSON object with the access token. This token will have an expiration of 1 year. It will also return a refresh token used to request a new access token for the user when the current access token issued expires.

Step 6

With the access token, the Developer can make API calls on behalf of the user, by passing the code in the Authorization: Bearer header.

GET /api/user HTTP/1.1
Host: app.fitbark.com
Authorization: Bearer DCEOB729f3i5CuLCyZCkX_5slG_fpc1IhNqf0FnfK_YDmmc7bZ

Setting OAuth 2.0 redirect URI's via API

All callbacks to the developers API for user authentification must have a registered redirect URI as specified by the OAuth 2 specification. The developer can set the redirect URI via the FitBark API.

The process to set the URI’s is below:

Step 1

Get your client access token using oauth and request the fitbark_open_api_2745H78RVS scope

Curl

curl -X POST -H "Content-Type: application/json" -H "Cache-Control: no-cache" -d '{
"grant_type": "client_credentials",
"client_id": "",
"client_secret": "",
"scope" :"fitbark_open_api_2745H78RVS"
}' "https://app.fitbark.com/oauth/token"

Response

{
  "access_token": "db73736bc5713e986415fd22345678e2a1f0d8f84eefee3d78515b643db329c341679",
  "token_type": "bearer",
  "expires_in": 31557600,
  "scope": "fitbark_open_api_2745H78RVS"
}

 

Step 2

Call API to read current redirect URI’s

Curl

curl -X GET -H "Authorization: Bearer <your access token from step 1>" "https://app.fitbark.com/api/v2/redirect_urls"

Response

{"redirect_uri": "urn:ietf:wg:oauth:2.0:oob" }

Note that there can be multiple redirect URI’s, each one is separated by ‘\r”

Step 3

Create a string that is the new redirect URI’s and post it via the fitBark API
Curl

curl -X POST -H "Authorization: Bearer <your access token from step 1>" -H "Content-Type: application/json" -d '{
   "redirect_uri":"urn:ietf:wg:oauth:2.0:oob\rhttp://wellcome.com/auth\rhttp://another.com/auth://"
}' "https://app.fitbark.com/api/v2/redirect_urls"

General Notes

Time Notation

Times are presented in the following format:

  • Date and time: YEAR-MM-DD T HH:MM:SS.DEC Z (e.g. 2014-12-24T20:07:24.000Z)

A time zone offset (tzoffset) is created for each dog and represented as a signed (+/-) difference in seconds from the UTC time above

  • Times are generally expressed as dog local times when returned for activities or when sending the API requests as “from” and “to” times

User Profiles

  • “Owners” can edit a dog profile and view all the historical activity
  • “Friends” can view a dog’s profile and view the last 30 days of activity
  • The term “Friend” is used interchangeably with “Follower”

Json Requirements

  • Requests with a Json body must set the “content-type” header to “application/json”

Get User Info

Get various information about the specified user including name, username (email address), profile picture and Facebook ID.

  •  Access: Read
  • URL: https://app.fitbark.com/api/v2/user
  • HTTP Method: GET

Response example

{
    "user": {
        "slug": "a0a19044-3fca-40ad-a2d2-8670cffebfa0",
        "username": "[email protected]",
        "name": "Pippo Pippone",
        "first_name": "Pippo",
        "last_name": "Pippone",
	"picture_hash":12fd1a0f04b7b9285c4e91b73617f809
    }
}

Get User Picture

Get the Base64 encoded picture for a specified user.
Images can only be accessed if the authenticated user is an existing owner, friend or veterinarian of a dog related to the user being queried.

  • Access: Read
  • URL: https://app.fitbark.com/api/v2/picture/user/{user_slug}
  • HTTP Method: GET

Parameters

  • user_slug

Response example

{
   "image": {
             "data": "9j/4AAQSkZJRgABAQAAAQABAAD//gA7Q1JFQVRPUjogZ2QtanBlZyB2MS4w ICh1c2luZyBJSkcgSlBFRyB2NjIpLCBxdWFsaXR5ID0gOTUK/9sAQwACAQEB AQECAQEBAgICAgIEAwICAgIFBAQDBAYFBgYGBQYGBgcJCAYHCQcGBggLCAkK CgoKCgYICwwLCgwJCgoK/9sAQwECAgICAgIFAwMFCgcGBwoKCgoKCgoKCgoK CgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoK/8AAEQgE cAKAAwEiAAIRAQMRAf/EAB8AAAEFAQEBAQEBAAAAAAAAAAABAgMEBQYHCAkK C//EALUQAAIBAwMCBAMFBQQEAAABfQECAwAEEQUSITFBBhNRYQcicRQygZGh CCNCscEVUtHwJDNicoIJChYXGBkaJSYnKCkqNDU2Nzg5OkNE. . .RUZHSElKU1RV"
            }
}

Get User Related Dogs

Get the dogs related to the user.

  • Access: Read
  • URL: https://app.fitbark.com/api/v2/dog_relations
  • HTTP Method: GET

Response fields

  • date is the time of creation of the relationship with the dog (expressed in GMT)
  • activity_date is the last sync time for the dog (expressed in the dog’s local time)
  • last_min_time is the time of the last valid minute available in the server
  • last_min_activity is the value of the last minute available in the server

Response example

{
    "dog_relations": [
        {
            "id": 13,
            "status": "OWNER",
            "date": "2014-08-19T20:23:52.000Z",
            "dog": {
                "slug": "ad7c7166-4cf5-4284-aa56-2cf4df305b31",
                "name": "Barley",
                "bluetooth_id": "c2bc4ee2809939c3",
                "activity_value": 1433,
                "activity_date": "2014-08-30T08:19:50.000Z",
                "birth": "2012-10-30",
                "breed1": {
                    "id": 16,
                    "name": "BEAGLE"
                },
                "breed2": {
                    "id": 15,
                    "name": "BASSET HOUND"
                },
                "gender": "M",
                "weight": 41,
                "weight_unit": "lbs",
                "country": "US",
                "zip": "64152",
                "tzoffset": -18000,
                "tzname":"America/Chicago",
                "min_play": 99,
                "min_active": 200,
                "min_rest": 500,
                "medical_conditions": [
                    {
                        "id": 7,
                        "name": "Overweight"
                      }
                ],
                "hourly_average": 101,
                "picture_hash": "515d59679a9024ba31e7e9b6103618a5",
                "neutered": false,
                "last_min_time": "2014-08-30T08:19:00.000Z",
                "last_min_activity": 33,
                "daily_goal": 8000,
                "battery_level": 100
            }
        },
        {
            "id": 28,
            "status": "FRIEND",
            "date": "2014-08-28T15:27:56.000Z",
            "dog": {
                "slug": "09659a8a-24c9-4246-92a8-7ecd0650368c",
                "name": "Bongo",
                "bluetooth_id": "c39b49e2809939c3",
                "activity_value": 0,
                "activity_date": "2014-08-19T15:23:52.000Z",
                "birth": "2012-12-12",
                "breed1": {
                    "id": 16,
                    "name": "BEAGLE"
                },
                "breed2": { },
                "gender": "F",
                "weight": 40,
                "weight_unit": "lbs",
                "country": "US",
                "zip": "3423",
                "notes": "test",
                "tzoffset": -10800,
                "tzname":"America/Chicago",
                "min_play": 103,
                "min_active": 300,
                "min_rest": 700,
                "medical_conditions": [ ],
                "hourly_average": 0,
                "picture_hash": "",
                "neutered": false,
                "last_min_time": null,
                "last_min_activity": null,
                "daily_goal": 6000,
                "battery_level": 86
            }
        }
    ]
}

Get Dog Info

Get various information about a certain dog including name, breed, gender, weight, birthday and picture.

  • Access: Read
  • URL: https://app.fitbark.com/api/v2/dog/{dog_slug}
  • HTTP Method: GET

Parameters

  • dog_slug

Response example

{
    "dog": {
        "slug": "09659a8a-24c9-4246-92a8-7ecd0650368c",
        "name": "vasco",
        "bluetooth_id": "0319e2809c310c44",
        "activity_value": 7921,
        "birth": "2013-04-12",
        "breed1": {
             "id": 16,
             "name": "BEAGLE"
        },
        "breed2": { },
        "gender": "M",
        "weight": 10,
        "weight_unit": "lbs",
        "country": "US",
        "zip": "64108",
        "tzoffset": -25200,
        "tzname": "America/Vancouver",
        "min_play": 0,
        "min_active": 0,
        "min_rest": 0,
        "medical_conditions": [
               {
                    "id": 7,
                    "name": "Overweight",
               }
        ],
        "hourly_average": 3096,
        "picture_hash": "765d59679a9024ba31e7e9b6103618b3",
        "neutered": false,
        "last_min_time": "2014-08-31T17:16:00.000Z",
        "last_min_activity": 79,
        "daily_goal": 8000,
        "battery_level": 98,
        "last_sync": "2014-08-31T17:17:54.000Z"
    }
}

Get Dog Picture

Get the Base64 encoded picture for a specified dog.
Images can only be accessed if the authenticated user is an existing owner, friend or veterinarian of the dog being queried.

  • Access: Read
  • URL: https://app.fitbark.com/api/v2/picture/dog/{dog_slug}
  • HTTP Method: GET

Parameters

  • dog_slug

Response example

{
   "image": {
             "data": "9j/4AAQSkZJRgABAQAAAQABAAD//gA7Q1JFQVRPUjogZ2QtanBlZyB2MS4w ICh1c2luZyBJSkcgSlBFRyB2NjIpLCBxdWFsaXR5ID0gOTUK/9sAQwACAQEB AQECAQEBAgICAgIEAwICAgIFBAQDBAYFBgYGBQYGBgcJCAYHCQcGBggLCAkK CgoKCgYICwwLCgwJCgoK/9sAQwECAgICAgIFAwMFCgcGBwoKCgoKCgoKCgoK CgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoK/8AAEQgE cAKAAwEiAAIRAQMRAf/EAB8AAAEFAQEBAQEBAAAAAAAAAAABAgMEBQYHCAkK C//EALUQAAIBAwMCBAMFBQQEAAABfQECAwAEEQUSITFBBhNRYQcicRQygZGh CCNCscEVUtHwJDNicoIJChYXGBkaJSYnKCkqNDU2Nzg5OkNE. . .RUZHSElKU1RV"
            }
}

Get Dog Related Users

Get a list of users currently associated with a specified dog, together with the type of relationship (Owner or Friend) and privacy settings for each user (how far back in time the activity data is visible).

  • Access: Read
  • URL: https://app.fitbark.com/api/v2/user_relations/{dog_slug}
  • HTTP Method: GET

Response example

{
    "user_relations": [
        {
            "id": 11,
            "date": "2014-08-15T19:59:16.000Z",
            "dog_slug": "a0a19044-3fca-40ad-a2d2-8670cffebfa0",
            "status": "OWNER",
            "user": {
                "slug": "ad7c7166-4cf5-4284-aa56-2cf4df305b31",
                "username": "[email protected]",
                "name": "John Tomas",
                "first_name": "John",
                "last_name": "Tomas"
            }
        },
        {
            "id": 28,
            "date": "2014-08-28T15:27:56.000Z",
            "dog_slug": "ad7c7166-4cf5-4284-aa56-2cf4df305b31",
            "status": "FRIEND",
            "user": {
                "slug": "09659a8a-24c9-4246-92a8-7ecd0650368c",
                "username": "[email protected]",
                "name": "Emi Garcia",
                "first_name": "Emi",
                "last_name": "Garcia"
            }
        }
    ]
}

Get Activity Series

Get historical series data between two specified date times.
The maximum range is 42 days with daily resolution, and 7 days with hourly resolution.

  • Access: Read
  • URL: https://app.fitbark.com/api/v2/activity_series
  • HTTP Method: POST

Parameters

  • slug
  • from
  • to
  • resolution (DAILY or HOURLY)

Request example 1

{
	"activity_series":{
		"slug":"09659a8a-24c9-4246-92a8-7ecd0650368c",
		"from":"2013-03-02",
		"to":"2014-09-02",
		"resolution":"DAILY"
	}
}

Response example 1

{
    "activity_series": {
        "slug": "09659a8a-24c9-4246-92a8-7ecd0650368c",
        "records": [  
	     {
             "date": "2014-12-27",
             "activity_value": 921,
             "min_play": 15,
             "min_active": 125,
             "min_rest": 1300,
             "daily_target": 5000,
             "has_trophy": 0
             }, 
             {
             "date": "2014-12-28",
             "activity_value": 5421,
             "min_play": 114,
             "min_active": 484,
             "min_rest": 838,
             "daily_target": 5000,
             "has_trophy": 1
             }
             ...
             ]
      }
}

Request example 2

{
	"activity_series":{
		"slug":"09659a8a-24c9-4246-92a8-7ecd0650368c",
		"from":"2013-03-02",
		"to":"2014-09-02",
		"resolution":"HOURLY"
	}
}

Response example 2

{
    "activity_series": {
        "slug": "09659a8a-24c9-4246-92a8-7ecd0650368c",
        "records": [
            {
                "date": "2014-08-15 15:00:00",
                "activity_value": 1204,
                "min_play": 11,
                "min_active": 37,
                "min_rest": 12
            },
            {
                "date": "2014-08-15 16:00:00",
                "activity_value": 513,
                "min_play": 3,
                "min_active": 16,
                "min_rest": 41
            },
            {
                "date": "2014-08-18 17:00:00",
                "activity_value": 1759,
                "min_play": 5,
                "min_active": 29,
                "min_rest": 26
            }
            ...
            ]
      }
}

Get Similar Dogs Stats

Get this dogs, and similar dogs, statistics.

  • Access: Read
  • URL: https://app.fitbark.com/api/v2/similar_dogs_stats
  • HTTP Method: POST

Parameters

  • slug

Request example

{"slug": "09659a8a-24c9-4246-92a8-7ecd0650368c"}

Response example

{
     "similar_dogs_stats": {
        "this_best_daily_activity": 2300,
        "this_best_week_activity":56000,
        "this_current_goals_streak": 1,
        "this_best_goals_streak": 3,
        "this_average_daily_activity": 2100,
        "median_same_age_weight_daily_activity":2500,
        "this_average_daily_rest_minutes": 60,
        "median_same_age_weight_range_dogs_daily_rest_minutes":54,
        "median_all_dogs_daily_activity":3000,
        "median_same_breed_daily_activity":3500
     }
}

Get Activity Totals

Get historical activity data by totaling the historical series between two specified date times.

  • Access: Read
  • URL: https://app.fitbark.com/api/v2/activity_totals
  • HTTP Method: POST

Parameters

  • slug
  • from
  • to

Request example

{
   "dog":{
           "slug": "09659a8a-24c9-4246-92a8-7ecd0650368c",
           "from":2014-06-06,
           "to":2014-06-09
   }
}

Response example

{
	"activity_value": 26305
}

Get Time Breakdown

Get the time (in minutes) spent at each activity level for a certain dog between two specified date times.

  • Access: Read
  • URL: https://app.fitbark.com/api/v2/time_breakdown
  • HTTP Method: POST

Parameters

  • slug
  • from
  • to

Request example

{
   "dog":{
          "slug":"09659a8a-24c9-4246-92a8-7ecd0650368c",
          "from":2014-06-06,
          "to":2014-06-09
      }
}

Response example

{
    "activity_level": {
          "min_play": 321,
          "min_active": 941,
          "min_rest": 4498
     }
}

Get Daily Goal

Get a dog’s current daily goal and future daily goals set by an authorized user (if any).

  • Access: Read
  • URL: https://app.fitbark.com/api/v2/daily_goal/{dog_slug}
  • HTTP Method: GET

Parameters

  • dog_slug

Response example

{
     "daily_goals":[
             {
                  "goal": 3000,
                  "date" : "2014-08-15"
              },{
                  "goal": 4000,
                  "date" : "2014-08-20" /* previous daily goal of 3000 applies until 2014-08-19 */
              },{
                  "goal": 4500,
                  "date" : "2014-09-15" /* previous daily goal of 4000 applies until 2014-09-14 */
              },
              ...
              ]
 }

Edit Daily Goal

Set the daily goal for a specified dog, and get a response with future daily goals (if any). By default, a future daily goal is repeated for all future dates until another user-set goal is found.
The daily goal can only be set for future dates, starting from the current date.
The daily goal value needs to be a positive number.

  • Access: Write
  • URL: https://app.fitbark.com/api/v2/daily_goal/{dog_slug}
  • HTTP Method: PUT

Parameters

  • dog_slug
  • daily_goal
  • date (expressed in UTC)

Request example

{
     "daily_goal" : 7000,
     "date" : "2014-08-15"
}

Response example

{
   "daily_goals":[
             {
                    "daily_goal": 5000, 
                    "date" : "2014-08-10"
             },{
                    "daily_goal": 7000,
                    "date" : "2014-08-15" /* previous daily goal of 5000 applies until 2014-08-14 */
             },{
                    "daily_goal": 9000,
                    "date" : "2014-09-25" /* previous daily goal of 7000 applies until 2014-09-24 */
             },
             ...
             ]
}

API Terms of Service

Please review our API Terms of Service here.