POST
/
db
/
nl-query
JavaScript
const response = await fetch('https://api.worqhat.com/db/nl-query', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    'Authorization': 'Bearer YOUR_API_KEY'
  },
  body: JSON.stringify({
    question: "How many active users do we have?",
    table: "users"
  })
});
const data = await response.json();
console.log(data);
{
  "success": true,
  "data": [
    {}
  ],
  "sql": "SELECT COUNT(*) as count FROM users WHERE status = 'active'",
  "message": "Query processed successfully"
}

Authorizations

Authorization
string
header
required

API key authentication. Format - "Bearer YOUR_API_KEY"

Body

application/json

Response

200
application/json

Query processed successfully

The response is of type object.