> ## Documentation Index
> Fetch the complete documentation index at: https://docs.supahub.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Upvote Post

> Cast vote on a post.

<ParamField body="POST" type="method" />

<ParamField body="/votes/upvote_post" type="path" />

### Path Parameters

Below are the query parameters available for customizing the response:

<ParamField body="postId" type="string" required>
  Identifier of the post to be upvoted.
</ParamField>

<ParamField body="email" type="string" required>
  Email address of the user performing the upvote.
</ParamField>

<ParamField body="name" type="string | undefined">
  Name of the user performing the upvote (optional).
</ParamField>

<RequestExample>
  ```javascript curl theme={null}
  // Replace API_KEY with your api key
  curl --location --request POST 'https://api.supahub.com/api/v1/votes/upvote_post' \
  --header 'Content-Type: application/x-www-form-urlencoded' \
  --header 'Authorization: Bearer API_KEY' \
  --data-urlencode 'postId=clryjbggw000g12evcnbcv0cqa' \
  --data-urlencode 'email=useremail@example.com' \
  --data-urlencode 'name=user name'
  ```

  ```javascript fetch theme={null}
  const myHeaders = new Headers();
  myHeaders.append("Content-Type", "application/x-www-form-urlencoded");
  myHeaders.append("Authorization", "Bearer API_KEY"); // Replace API_KEY with your api key

  const urlencoded = new URLSearchParams();
  urlencoded.append("postId", "clryjbggw000g12evcnbcv0cqa");
  urlencoded.append("email", "useremail@example.com");
  urlencoded.append("name", "user name");

  const requestOptions = {
    method: "POST",
    headers: myHeaders,
    body: urlencoded,
    redirect: "follow",
  };

  fetch("https://api.supahub.com/api/v1/votes/upvote_post", requestOptions)
    .then((response) => response.text())
    .then((result) => console.log(result))
    .catch((error) => console.error(error));
  ```

  ```javascript axios theme={null}
  const axios = require('axios');
  const qs = require('qs');
  let data = qs.stringify({
    'postId': 'clryjbggw000g12evcnbcv0cqa',
    'email': 'useremail@example.com',
    'name': 'user name'
  });

  let config = {
    method: 'post',
    maxBodyLength: Infinity,
  	url: 'https://api.supahub.com/api/v1/votes/upvote_post',
    headers: {
      'Content-Type': 'application/x-www-form-urlencoded',
      'Authorization': 'Bearer API_KEY' // Replace API_KEY with your api key
    }
    data : data
  };

  async function makeRequest() {
    try {
      const response = await axios.request(config);
      console.log(JSON.stringify(response.data));
    }
    catch (error) {
      console.log(error);
    }
  }

  makeRequest();
  ```

  ```python python theme={null}
  import requests

  url = "https://api.supahub.com/api/v1/votes/upvote_post"

  payload = 'postId=clryjbggw000g12evcnbcv0cqa&email=useremail%40example.com&name=user%20name'

  headers = {
    'Content-Type': 'application/x-www-form-urlencoded',
    'Authorization': 'Bearer API_KEY' # Replace API_KEY with your key.
  }

  response = requests.request("POST", url, headers=headers, data=payload)

  print(response.text)
  ```
</RequestExample>
