Authentication

You'll need to authenticate your requests to access any of the ToHuman API endpoints. All API requests require a bearer token sent in the Authorization header.

Bearer token

Authenticate with the ToHuman API by including your API token in the Authorization header of every request. Here's how to add the token using cURL:

Example request with bearer token
curl https://tohuman.ai/api/v1/humanizations/sync \
  -H "Authorization: Bearer token_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{"content": "Text to humanize", "intensity": "medium"}'

Always keep your token safe and reset it if you suspect it has been compromised. You can create and manage your tokens from the API tokens page.

Never expose your API token in client-side code, public repositories, or browser requests. Always make API calls from your server.

Using an API token

Here's how to authenticate in different languages:

Python
import requests

headers = {
    "Authorization": f"Bearer {TOHUMAN_API_KEY}",
    "Content-Type": "application/json"
}

response = requests.post(
    "https://tohuman.ai/api/v1/humanizations/sync",
    headers=headers,
    json={"content": "Text to humanize"}
)
Node.js
const response = await fetch(
  "https://tohuman.ai/api/v1/humanizations/sync",
  {
    method: "POST",
    headers: {
      "Authorization": `Bearer ${TOHUMAN_API_KEY}`,
      "Content-Type": "application/json"
    },
    body: JSON.stringify({ content: "Text to humanize" })
  }
)
Ruby
require "net/http"
require "json"

uri = URI("https://tohuman.ai/api/v1/humanizations/sync")
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true

request = Net::HTTP::Post.new(uri)
request["Authorization"] = "Bearer #{TOHUMAN_API_KEY}"
request.body = { content: "Text to humanize" }.to_json

response = http.request(request)