# Introduction

### API Basics <a href="#api-basics" id="api-basics"></a>

{% hint style="info" %}
**Before you begin!**

You should [create a Keepup Store account](https://app.keepup.store/register) that you can test the API against. We will provide you with an API key that you can use to make API calls.
{% endhint %}

The Keepup Store API provides access to almost all the functionalities available in our application, enabling you to extend these features into your own projects. It is designed to follow RESTful principles and is structured around the key resources that you will commonly interact with.

### HTTP Methods <a href="#api-basics" id="api-basics"></a>

<table data-header-hidden><thead><tr><th width="223"></th><th></th></tr></thead><tbody><tr><td>POST</td><td>Create a new business record. This request is used to add new data to the system.</td></tr><tr><td>GET</td><td>Retrieve data about a business record. This request is used to view details without making any changes.</td></tr><tr><td>PUT</td><td>Update an existing business record. This request is used to modify all or part of the existing details of a record.</td></tr><tr><td>DELETE</td><td>Remove a business record from the system. This request permanently deletes a record.</td></tr></tbody></table>

## Authentication <a href="#authentication" id="authentication"></a>

Authenticate your API calls by including your API key in the Authorization header of every request you make. You can manage your API key from your [business settings](https://app.keepup.store/my-businesses) page.

The API key however, is to be kept secret. If for any reason you believe your API key has been compromised or you wish to reset your API key, you can do so from the [business settings](https://app.keepup.store/my-businesses) page.

{% hint style="warning" %}
**Secure your API key**

Do not commit your API key to git, or use it in client-side code.
{% endhint %}

Authorization headers should be in the following format:

`Authorization: Bearer API_KEY`

{% hint style="info" %}
**Sample Authorization Header**

Authorization: Bearer sample.eyJhY2Nlc3NfZGF0YSI6eyJ0b2tlbiI6IjM2ODUzMTgzYzBmNzY0NmZiZmFkN2ViYTdjZTkyZjZmYWJkMjcyMTZkY2U5Njk4OTQ0YTZhODBlNmQ5ZWsdfsadfeafaesfdsctpoosOSDoosdiOiJhcGkifSwiaWF0IjoxNzA1ODUwMDcxfQ.xlFapi-key-kus
{% endhint %}

## Requests and Response <a href="#authentication" id="authentication"></a>

Both request body data and response data are formatted as JSON. Content type for responses will always be `application/json`. Generally, all responses will be in the following format:

### Success Response Format <a href="#requests-and-response" id="requests-and-response"></a>

<table><thead><tr><th width="222"></th><th></th></tr></thead><tbody><tr><td><p><strong>status</strong></p><p><em>number</em></p></td><td>The HTTP status code indicating a successful operation. <code>200</code> is standard for successful requests, <code>201</code> is used for requests that result in creation, and <code>204</code> is used when the request has been successfully processed but there is no content to return (often used in delete operations).</td></tr><tr><td><p><strong>message</strong></p><p><em>string</em></p></td><td>A message indicating that the request has been successfully completed. Note that for a <code>204</code> response, typically no message is included because no content is returned.</td></tr><tr><td><p><strong>data</strong></p><p><em>object</em></p></td><td>An object containing any data returned by the API as a result of the request. For <code>204</code>, this object is typically empty as no data is returned.</td></tr></tbody></table>

### Error Response Format <a href="#requests-and-response" id="requests-and-response"></a>

<table><thead><tr><th width="221"></th><th></th></tr></thead><tbody><tr><td><p><strong>status</strong></p><p><em>number</em></p></td><td>The HTTP status code indicating an error. Each code has specific meanings: <code>400</code> for bad requests, <code>500</code> for internal server errors, <code>401</code> for unauthorized, <code>404</code> for not found, and <code>402</code> for payment required. </td></tr><tr><td><p><strong>message</strong></p><p><em>string</em></p></td><td>A general message stating that the request failed.</td></tr><tr><td><p><strong>data</strong></p><p><em>object</em></p></td><td>An object containing details about the specific errors encountered during the request. This may include validation errors or other detailed information.</td></tr></tbody></table>
