# Authentication

Authentication allows us to know if the resource has been requested by a valid user.

A user authenticate a request by providing ‘Bearer token’ as an Authorization header to your requests.\ <br>

### Example

You can use any of the example below as a reference :

```
curl -H "Authorize: Bearer unique-token-id" 
https://manage.searchtap.net/v2/collections?appId=UNIQUEAPPID&count=10&skip=0
```

or you can some request libraries such as ‘axios’, like mentioned below

```
// replace 'unique-token-id' with your app token id
    const instance = axios.create({
      baseURL: 'https://manage.searchtap.net/v2',
      headers: {'Authorize': 'Bearer unique-token-id'} 
    });

    axios({
      method: 'get',
      url: '/collections?appId=UNIQUEAPPID&count=10&skip=0',
    })
    .then(function (response) {
     // do something with response
    })
    .catch(function (error) {
      // do something with error
    })
```

All the read and write operations need App tokens, these tokens can be found at the App listing page where you find a ‘key shape’ icon over every app.

### Authentication error

In event of an unauthorized request, the API server throws an unauthorized object with a message

```
{
  "status":401,
  "data":"Not Allowed to access this resource"
}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://greenapplesolutions.gitbook.io/greenapplesolutions-docs/authentication.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
