> For the complete documentation index, see [llms.txt](https://coat.gitbook.io/paal-ai-apis/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://coat.gitbook.io/paal-ai-apis/paal-ai-api-docs/authentication-method.md).

# Authentication Method

## Authentication Documentation

### Introduction

This document provides guidelines for authenticating requests to the PAAL AI API. Authentication is required for creating, modifying, and deleting project data, but it is not required for retrieving project data.

### Authentication Header

To authenticate requests, include an HTTP header with the following structure:

* **Header Name**: `Bearer`
* **Header Value**: Your authentication token

#### Example Header

```http
Bearer: your-authentication-token
```

### Example Usage

#### Including Authentication Header in Requests

When making requests to the API endpoints that require authentication, ensure you include the `Bearer` token in the headers.

#### Using cURL

```sh
curl -X POST 'https://paal-ecosystem-backend.onrender.com/project/new' \
-H 'Content-Type: application/json' \
-H 'Bearer: your-authentication-token' \
-d '{
  "name": "Project Alpha",
  "about": "This project focuses on AI development.",
  "growth": "20%"
}'
```

#### Using JavaScript (Fetch API)

```javascript
fetch('https://paal-ecosystem-backend.onrender.com/project/new', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    'Bearer': 'your-authentication-token'
  },
  body: JSON.stringify({
    name: 'Project Alpha',
    about: 'This project focuses on AI development.',
    growth: '20%'
  })
})
.then(response => response.json())
.then(data => console.log(data))
.catch(error => console.error('Error:', error));
```

#### Using Postman

1. Open Postman and create a new request.
2. Select the request method (e.g., POST).
3. Enter the request URL (e.g., [`https://api.example.com`](https://paal-ai.onrender.com)`/project/new`).
4. Go to the **Headers** tab.
5. Add another header:
   * **Key**: `Bearer`
   * **Value**: `your-authentication-token`
6. Go to the **Body** tab, select **raw** and set the type to **JSON**.
7. Enter the request payload in JSON format.
8. Send the request.

#### Using Axios (JavaScript)

```javascript
const axios = require('axios');

axios.post('https://paal-ecosystem-backend.onrender.com/project/new', {
  name: 'Project Alpha',
  about: 'This project focuses on AI development.',
  growth: '20%'
}, {
  headers: {
    'Content-Type': 'application/json',
    'Bearer': 'your-authentication-token'
  }
})
.then(response => console.log(response.data))
.catch(error => console.error('Error:', error));
```

### Summary

By including the `Bearer` token in the request headers, you can authenticate your requests to the PAAL AI API. Ensure your token is valid and correctly included in the headers to access the protected endpoints for creating, modifying, and deleting data.
