# API Usage

## API Base URL

All API endpoints in this documentation are built upon a common base URL. This base URL serves as the foundation for accessing various resources within the API. The base URL is as follows:

```
https://vudy.tech/api/v1/{route_to_api}
```

Make sure to append specific endpoint paths to this base URL to interact with different functionalities of the API.

### Authentication Method and Headers

When making API requests, the method is determined by the endpoint you're consuming so make sure to read the basics of each endpoint; it'll mostly be <mark style="color:purple;">`POST`</mark> though. You must include specific headers for authentication purposes. Below is a list of headers you need to provide:

```json
{
    "method": "POST", // Read to Docs for cases when this might be 'GET''
    "headers": {
        "x-api-key": "<YOUR_API_KEY>",
        "Content-Type": "application/json"
    }
}
```

Make sure to replace <mark style="color:red;">`<YOUR_API_KEY>`</mark> with your actual API key. If you do not have an API key yet, please refer to the [Getting Started](https://vudy.gitbook.io/vudy-docs/api/getting-started) page for instructions on obtaining one.

#### Response Status Codes

The server may respond with the following HTTP status codes:

* <mark style="color:green;">**(200) OK**</mark>**:** The request was successful, and the server responded with the expected JSON object in the response body.
* <mark style="color:orange;">**(400) Bad Request:**</mark> The server could not understand the request due to invalid syntax. An error response will be provided with an appropriate `errorCode` and `errorMessage`.
* <mark style="color:red;">**(401) Unauthorized:**</mark> Authentication credentials were missing or incorrect.
* <mark style="color:red;">**(403) Forbidden:**</mark> The client does not have permission to access the requested resource.
* <mark style="color:orange;">**(404) Not Found:**</mark> The requested resource could not be found on the server.
* <mark style="color:red;">**(500) Internal Server Error:**</mark> The server encountered an unexpected condition that prevented it from fulfilling the request. If you find these cases please report them!
