# API Reference

Moderating with the Curve API, first authenticate your application by obtaining an API key from your Curve Dashboard.

## Moderate a Member

Base URL: <kbd><mark style="color:green;">**POST**<mark style="color:green;"></kbd> <kbd><https://curvebot.xyz/api/moderate></kbd>

> *Remotely Moderate a member in your server*

### Headers

<table><thead><tr><th width="161">Key</th><th>Value</th></tr></thead><tbody><tr><td>Authorization</td><td><code>CURVE-KEY</code></td></tr></tbody></table>

### Payload Items

<table><thead><tr><th width="160">Key</th><th width="257">Value</th><th>Description</th></tr></thead><tbody><tr><td>"member_id":</td><td>"559449646410235935",</td><td>Member ID to moderate.</td></tr><tr><td>"channel_id":</td><td>"0",</td><td>The channel Curve sends embed to</td></tr><tr><td>"reason":</td><td>"No reason provided."</td><td>Reason on mod-log</td></tr><tr><td>"action"</td><td>"mute"</td><td>Curve Action</td></tr><tr><td>"time":</td><td>"300",</td><td>Time in Seconds (s)</td></tr></tbody></table>

### JSON RESPONSES

{% tabs %}
{% tab title="200 (Success)" %}

```json
{
    "message": "User has been quarantined",
    "received_data": {
        "action": "quarantine",
        "api_key": "00fd6dbc-692d-11ef-8000-451f7923908d",
        "channel_id": "0",
        "member_id": "559449646410235935",
        "reason": "none",
        "time": "0"
    },
    "response": "success"
```

{% endtab %}

{% tab title="Failed to fetch member" %}

```python
{
    "message": "Failed to fetch guild member from api key.",
    "received_data": {
        "action": "quarantine",
        "api_key": "00fd6dbc-692d-11ef-8000-451f7923908d",
        "channel_id": "0",
        "member_id": "",
        "reason": "none",
        "time": "0"
    },
    "response": "error"
```

{% endtab %}

{% tab title="Forbidden" %}

```json
{
  "error": "Forbidden"
}
```

{% endtab %}
{% endtabs %}

***

### Code Examples

{% tabs %}
{% tab title="Python" %}

```python
import requests

headers = {
        "Authorization": "CURVE-KEY" # Your api key found in dashboard.
}

payload = {
        "member_id":"559449646410235935", # Discord ID of the member you wish to moderate.
        "channel_id":"0", # Specify 0 for no success message.
        "reason":"REASON", # Reason for moderating this member.
        "action":"ACTION", # Moderation action.
        "time":"300" # Time for muting in seconds (s). Specify 0 for infinity
}

r = requests.post('https://curvebot.xyz/api/moderate', json=body)

print(r)
```

{% endtab %}

{% tab title="JavaScript (JS)" %}

```javascript
fetch('https://curvebot.xyz/api/moderate', {
    method: 'POST',
    headers: {
        'Accept': 'application/json',
        'Content-Type': 'application/json'
        'Authorization':'CURVE-KEY' // Your api key.
    },
    body: JSON.stringify({
        
        "member_id":"559449646410235935", // Discord ID of the member you wish to moderate.
        "channel_id":"0", // Specify 0 for no success message.
        "reason":"REASON", // Reason for moderating this member.
        "action":"ACTION", // Moderation action =>.
        "time":"300" // Time for muting in seconds (s). Specify 0 for infinity.
        
    })
})
   .then(response => response.json())
   .then(response => console.log(response))
```

{% endtab %}

{% tab title="Curl" %}

```bash
curl -X POST https://curvebot.xyz/api/moderate \
-H "Authorization: CURVE_SERVER_API_KEY" \
-H "Content-Type: application/json" \
-d '{
  "member_id": "DISCORD_ID",
  "channel_id": "CHANNEL_ID",
  "reason": "REASON",
  "action": "ACTION",
  "time": "TIME_IN_SECONDS"
}'
```

{% endtab %}

{% tab title="BotGhost" %}

<figure><img src="/files/qINtpxJZebaRXkyshkoo" alt="" width="557"><figcaption><p>REQUEST HEADERS</p></figcaption></figure>

<figure><img src="/files/qWeqyU1DgCTjPjDDcU7x" alt="" width="556"><figcaption><p>REQUEST PAYLOAD</p></figcaption></figure>

{% hint style="warning" %}
Do **not** test BotGhost requests for Curve if you are using their variables as it will not work properly. Connect it to an event or command in-order for it to work.
{% endhint %}
{% endtab %}
{% endtabs %}


---

# 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://guide.curvebot.xyz/curve-services/api-reference.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.
