hubspot-key: Set/retrieve the Hubspot secret API key

Description Usage Arguments Details Value See Also Examples

Description

Get/set the Hubspot secret API key using the keyring package. For a more secure authorization method, without a daily limit on calls, see hubspot_token_create()

Usage

1
2
3

Arguments

key

API key. If not provided via this argument, the key will have to be provided interactively.

Details

To know how to create your Hubspot API key, refer to the corresponding section of Hubspot API docs. Hubspot recommends you to re-generate your API key every six months. Only accounts with Super Admin Access can create an API key (at the moment of writing).

Save the API key on your machine using the hubspot_key_set() function, that relies on the keyring package that stores the key in the system default credential store (see keyring docs). If you don’t do that, you’ll have to provide the API key as argument to hubspot functions calling Hubspot APIs.

# Either input the key as parameter
hubspot_key_set("yourapikey")

# Or just call the function,
# the key will be asked interactively
hubspot_key_set()

If no API key is set nor provided as an argument, the “demo” key is used and a message is printed to the screen. As noted earlier, this won’t give you access to your own Hubspot data.

You can check the daily usage related to the API key via hubspot_api_usage(). Calls in the package are rate limited (100 requests every 10 seconds) but there’s also a daily limit on calls.

hubspot_api_usage()

For a more secure authorization method, without a daily limit on calls, see hubspot_token_create().

Authorization for Hubspot APIs

The Hubspot API accepts authorization via

OAuth 2.0 is the recommended method. However, this package supports both.

Note that if you do nothing the package will use the “demo” API token but this won’t give you access to your own Hubspot data. So you’ll need to spend a little time on setup:

If you have both saved an API key via hubspot_key_set() and a token via hubspot_token_create(), priority will be given to using the OAuth 2.0 token. If you don’t want that, explicitely pass NULL as value for the token_path argument of all functions.

Value

The key (a string)

See Also

Other auth: default_ld_hubspot_app()

Examples

1
2
3
4
5
hubspot_key_get()
## Not run: 
hubspot_key_set("yourapikey")

## End(Not run)

lockedata/hubspot documentation built on March 1, 2020, 8:54 p.m.