# Getting started with an API project

To access any OS APIs, you need an API key and / or API secret token. These credentials are scoped to a dedicated API project that is linked to your OS Data Hub account. You can can find your API Projects and Project API Keys in your API Dashboard where you can fully manage all aspects of your OS APIs.

## Adding an API to a new project

Before you can access our OS APIs, you need to add at least one API to a new or existing project in the OS Data Hub and generate an API key.

To add an API to a project and generate an API key:

1. Log in or create a new [OS Data Hub](https://osdatahub.os.uk/) account.
2. Click *API Dashboard* in the main menu.

   <figure><img src="https://4043944746-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoEzqrBzRGoJw7nQyLj1W%2Fuploads%2Fgit-blob-5776ec1eee19968f026c76b44e479c377dbfa435%2Fimage.png?alt=media" alt="Screenshot of the OS Data Hub Welcome screen highlighting the API Dashboard tab"><figcaption></figcaption></figure>
3. Click *APIs* in the secondary navigation menu.

   <figure><img src="https://4043944746-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoEzqrBzRGoJw7nQyLj1W%2Fuploads%2Fgit-blob-d440ed45efb955c527154c4f3ec8dae2270bf845%2Fimage.png?alt=media" alt="Example API Dashboard highlighting APIs link in secondary navigation"><figcaption><p>Example API Dashboard highlighting APIs link in secondary navigation</p></figcaption></figure>
4. Click the *Add to API project* button of the API you want to add.

   <figure><img src="https://4043944746-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoEzqrBzRGoJw7nQyLj1W%2Fuploads%2Fgit-blob-29320736e93e64e49686b12a2330bee90f7e738c%2Fimage.png?alt=media" alt="Screenshot of an example API Dashboard showing the Add to API project button of the OS NGD API - Features"><figcaption></figcaption></figure>
5. In the *Add to API project* dropdown click *Add to NEW PROJECT*.

   <figure><img src="https://4043944746-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoEzqrBzRGoJw7nQyLj1W%2Fuploads%2Fgit-blob-37d9125a4752585d9733e3ab5e9b9fe9a5c791c0%2Fimage.png?alt=media" alt="Screenshot of an example API Dashboard showing the Add to NEW PROJECT link of OS NGD API - Features"><figcaption></figcaption></figure>
6. Enter a project name in the dialog and then click *Create project*.

   <figure><img src="https://4043944746-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoEzqrBzRGoJw7nQyLj1W%2Fuploads%2Fgit-blob-aae6098a4178bfe1ea22423b91f240c1c63ad5ce%2Fimage.png?alt=media" alt="Screenshot of an example API Dashboard  - Give your project a name dialog"><figcaption></figcaption></figure>
7. The *\<Project Name>* page opens and displays the:
   * **Project API Key**: For example, \_GCk3L4TFnuKwcwG1PMJBtOyuipu6MOlV
   * **Project API Secret**: For example, \_zi7Vbor5f8i2ZTMs
   * Other API-specific information, for example the API endpoint address.

You can return to this page at any point in the future by opening *My projects* in the secondary navigation menu, if you need to copy your Project API Key or API endpoint address, or [#regenerating-an-api-key](#regenerating-an-api-key "mention"), for example.

<figure><img src="https://4043944746-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoEzqrBzRGoJw7nQyLj1W%2Fuploads%2Fgit-blob-a9d3638408fc9ee164941886d5557720489697d8%2Fimage.png?alt=media" alt="Example API Dashboard showing project page"><figcaption></figcaption></figure>

{% embed url="<https://www.youtube.com/watch?v=J6HOsA8Djrw>" %}
YouTube video showing how to add OS NGD API – Tiles to a new project on the OS Data Hub and generate an API key.
{% endembed %}

## Adding an API to an existing project

1. In *API Dashboard > My Projects.*
2. Click the *\<project name>* link in the list of projects to open the dedicated project page, if necessary.
3. Click *+ Add API*.

   <figure><img src="https://4043944746-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoEzqrBzRGoJw7nQyLj1W%2Fuploads%2Fgit-blob-b82b114fddd374f416d9f9bb7d04dcb55112a67c%2Fimage.png?alt=media" alt="Example API Dashboard showing Actions and + Add API buttons"><figcaption></figcaption></figure>
4. Click *Add to API project* for the required API and then *Done* to close the dialog.

   <figure><img src="https://4043944746-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoEzqrBzRGoJw7nQyLj1W%2Fuploads%2Fgit-blob-f3939618956defa1a17ae6d974b429cc6a8bbe56%2Fimage.png?alt=media" alt="Example API Dashboard showing Add API to this project dialog"><figcaption></figcaption></figure>
5. The API will be added to the project and will be able to utilise the same Project API key.

   <figure><img src="https://4043944746-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoEzqrBzRGoJw7nQyLj1W%2Fuploads%2Fgit-blob-9eb4d5ba88be93d94cf3c1fc6a4a11053b2eb758%2Fimage.png?alt=media" alt="Example API Dashboard showing project page"><figcaption></figcaption></figure>

## Removing an API from a project

1. In *API Dashboard > My Projects.*
2. Click the *\<Project Name>* link in the list of projects to open the dedicated project page, if necessary.
3. Click *Remove from project* for the specific API.

   <figure><img src="https://4043944746-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoEzqrBzRGoJw7nQyLj1W%2Fuploads%2Fgit-blob-ff1828043dde5117e7a1394c7713228bf14e9cd9%2Fimage.png?alt=media" alt="Example API Dashboard showing Remove from project button for OS NGD API - Tiles"><figcaption></figcaption></figure>
4. Click *Remove API from project* to confirm the removal.

   <figure><img src="https://4043944746-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoEzqrBzRGoJw7nQyLj1W%2Fuploads%2Fgit-blob-fc6b671632cbf6f0e9e9a40960b6c99b8d8dcb8d%2Fimage.png?alt=media" alt="Example API Dashboard showing Remove OS NGD API - Tiles from this project confirmation dialog"><figcaption></figcaption></figure>

## Regenerating an API key

1. In *API Dashboard > My Projects.*
2. Click the *\<Project Name>* link in the list of projects to open the dedicated project page, if necessary.
3. Click *Actions > Regenerate API key*.

   <figure><img src="https://4043944746-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoEzqrBzRGoJw7nQyLj1W%2Fuploads%2Fgit-blob-8dc207dff006afa4b2341530813d9b4e9b48eddd%2Fimage.png?alt=media" alt="Example API Dashboard showing Actions > Regenerate API Key button"><figcaption></figcaption></figure>
4. Enter the one-time code to confirm your action and then click *Regenerate API Key*.

   <figure><img src="https://4043944746-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoEzqrBzRGoJw7nQyLj1W%2Fuploads%2Fgit-blob-78eae853dc7eedea719c9be79856036cb79132d1%2Fimage.png?alt=media" alt="Example API Dashboard showing Regenerate API Key? confirmation dialog"><figcaption></figcaption></figure>

## Deleting a project

1. In *API Dashboard > My Projects.*
2. Click the *\<Project Name>* link in the list of projects to open the dedicated project page, if necessary.
3. Click *Actions > Delete this project*.

   <figure><img src="https://4043944746-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoEzqrBzRGoJw7nQyLj1W%2Fuploads%2Fgit-blob-a2cbc984e855b5a015c094fe01b5a791c32de30f%2Fimage.png?alt=media" alt="Example API Dashboard showing Actions > Delete this project button"><figcaption><p>Example API Dashboard showing Actions > Delete this project button</p></figcaption></figure>
4. Enter the one-time code to confirm your action and then click *Permanently remove project*.

   <figure><img src="https://4043944746-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoEzqrBzRGoJw7nQyLj1W%2Fuploads%2Fgit-blob-4fe7b4e9a28fc51844a4625f119dfe96213dc209%2Fimage.png?alt=media" alt="Example API Dashboard showing the Permanently delete this project and its API key? confirmation dialog"><figcaption><p>Example API Dashboard showing the Permanently delete this project and its API key? confirmation dialog</p></figcaption></figure>

## Finding your API endpoint address <a href="#whereisapiendpoint" id="whereisapiendpoint"></a>

1. Log into your [OS Data Hub](https://osdatahub.os.uk/) account.
2. Select *API Dashboard* from the main menu. You must be logged into the OS Data Hub to view the contents of this tab.
3. Select *My projects* from the secondary navigation menu.
4. Select the project you're interested in.
5. Your API endpoint address will be displayed in the project information under the OS API that has been added to the project.
