HTTP Basic authentication is the simplest way of interacting with the Harvest API. Requests require a username and password. HTTPS is required for accessing the API.

Making A Request

Here’s an example of interacting with Harvest via XML. To make requests in XML, specify application/xml for your Content-Type and Accept headers. A simple example with curl:

curl -H 'Content-Type: application/xml' -H 'Accept: application/xml' -u "user@example.com:password" https://example.harvestapp.com/account/who_am_i

Successful requests return HTTP response codes in the 2xx range (e.g. 200, 201, etc.). Other response codes indicate a failed request or missing resource, in which case an error message may be returned.

Headers

Request headers need to be set up with the following:

  • Accept: application/xml
  • Content-Type: application/xml
  • Authorization: Basic (insert your authentication string here)

Your authentication string is a base64 encoded version of your credentials. You can generate this in Ruby:

Base64.strict_encode64("myemail@example.com:password")

Or in JavaScript:

btoa("myemail@example.com:password")

Testing Requests

Chrome Users: Please use the Postman REST Client to test requests.

Firefox Users: Please use the RestClient plugin to test requests.

Code Examples

<?xml version="1.0" encoding="UTF-8"?>
<hash>
    <company>
        <base-uri>https://youraccount.harvestapp.com</base-uri>
        <full-domain>youraccount.harvestapp.com</full-domain>
        <name>Your Harvest Account</name>
        <active type="boolean">true</active>
        <week-start-day>Monday</week-start-day>
        <time-format>decimal</time-format>
        <clock>12h</clock>
        <decimal-symbol>.</decimal-symbol>
        <color-scheme>orange</color-scheme>
        <modules>
            <expenses type="boolean">true</expenses>
            <invoices type="boolean">true</invoices>
            <estimates type="boolean">true</estimates>
            <approval type="boolean">true</approval>
        </modules>
        <thousands-separator>,</thousands-separator>
        <plan-type>trial</plan-type>
    </company>
    <user>
        <timezone>Eastern Time (US &amp; Canada)</timezone>
        <timezone-identifier>America/New_York</timezone-identifier>
        <timezone-utc-offset type="integer">-18000</timezone-utc-offset>
        <id type="integer">508323</id>
        <email>support@getharvest.com</email>
        <admin type="boolean">true</admin>
        <first-name>Test</first-name>
        <last-name>User</last-name>
        <avatar-url>/assets/profile_images/big_ben.png?14410282</avatar-url>
        <project-manager>
            <is-project-manager type="boolean">true</is-project-manager>
            <can-see-rates type="boolean">true</can-see-rates>
            <can-create-projects type="boolean">true</can-create-projects>
            <can-create-invoices type="boolean">true</can-create-invoices>
        </project-manager>
        <timestamp-timers type="boolean">false</timestamp-timers>
    </user>
</hash>
{
    "company": {
        "base_uri": "https://youraccount.harvestapp.com",
        "full_domain": "youraccount.harvestapp.com",
        "name": "Your Harvest Account",
        "active": true,
        "week_start_day": "Monday",
        "time_format": "decimal",
        "clock": "12h",
        "decimal_symbol": ".",
        "color_scheme": "orange",
        "modules": {
            "expenses": true,
            "invoices": true,
            "estimates": true,
            "approval": true
        },
        "thousands_separator": ",",
        "plan_type": "trial"
    },
    "user": {
        "timezone": "Eastern Time (US & Canada)",
        "timezone_identifier": "America/New_York",
        "timezone_utc_offset": -18000,
        "id": 508343,
        "email": "support@getharvest.com",
        "admin": true,
        "first_name": "Test",
        "last_name": "User",
        "avatar_url": "/assets/profile_images/big_ben.png?14405182",
        "project_manager": {
            "is_project_manager": true,
            "can_see_rates": true,
            "can_create_projects": true,
            "can_create_invoices": true
        },
        "timestamp_timers": false
    }
}