When you first create a project, you will need to generate an API key if you are using the Places API. Should you need additional API keys, and/or revoke an API key, you can do so from the Project Settings page.
To generate a new API key:
- From within your project, on the Project Settings page, in the Places API Keys section, click Generate (Additional) API Key.
- In the Generate (Additional) API Key modal, give your new API key a nickname to help you identify it later.
- Click the Copy to Clipboard icon to save a copy of your key elsewhere .
- Click Dismiss once your access token has safely been copied.
DO NOT FORGET TO SAVE YOUR API KEY
Key generation will be the only time you can view your API Key. As you will need it for authenticating against Foursquare APIs, you must keep it saved somewhere else. If you lose your API Key, you can always revoke it's access and create a new one.
Authenticating against the API is done by passing your API Key through an
Authorization: header parameter.
To revoke a currently in-use API Key:
- From within your project, on the Project Settings page, in the Places API Keys section, click on Revoke Access next to the token you wish to remove.
- In the Revoke Access modal, select whether or not you'd like us to Automatically generate a new API Key when the current one is revoked.
- Click Revoke API Key.
By adding URL restrictions to an API key, only requests originating from the specified list of URLs/domains will be authorized. By default, created keys are unrestricted and will work for requests from any URL.
When adding URL restrictions, please ensure the following:
- The URL entered must include the protocol (either http:// or https://). NOTE:
http://example.comdoes not authorize
- The URL must be an exact match; e.g.
http://example.comis different from
To implement domain restrictions for an API key:
- From within your project, on the Project Settings page, in the Places API Keys section, click Modify for the API key you wish to restrict.
- In the Modify Restrictions modal, add the URL to restrict the API key to and click Add.
- Once added, you can view and/or delete existing restrictions within the Modify Restrictions modal.