# Category

## Joke by Category

<mark style="color:blue;">`GET`</mark> `https://api.night-api.com/jokes/:type`

#### Path Parameters

| Name                                   | Type   | Description                                            |
| -------------------------------------- | ------ | ------------------------------------------------------ |
| type<mark style="color:red;">\*</mark> | string | Type of jokes to get (global, beauf, dev, limit, dark) |

#### Headers

| Name                                            | Type   | Description  |
| ----------------------------------------------- | ------ | ------------ |
| authorization<mark style="color:red;">\*</mark> | String | Your API key |

{% tabs %}
{% tab title="200 When a joke is found" %}

```javascript
{
    "status": 200,
    "content": {
        "id": 44,
        "type": "global",
        "blague": "Que dit un canard quand il va aux toilettes ?",
        "reponse": "Je vais au petit coin."
    }
}
```

{% endtab %}

{% tab title="400 When the type of joke is wrong" %}

```javascript
{
    "status": 400,
    "error": "Bad type provided"
}
```

{% endtab %}
{% endtabs %}

**Lists of available categories:**

* global
* dev
* dark
* limit
* beauf
* blondes

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

axios.get('https://api.night-api.com/jokes/global', {
    headers: {
        authorization: "API token"
    }
})
.then(function (response) {
    console.log(response.data);
})
```

\
Or with the NPM module

```javascript
const { NightAPI } = require('night-api');
const api = new NightAPI('YOUR_API_KEY');

const blague = await api.jokes.byCategory('dev'); // Return: Promise
```


---

# 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://docs.night-api.com/joke/jokes/type.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.
