> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://api.asimov.social/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://api.asimov.social/_mcp/server.

# Execute Operation

POST https://asimov.social/graphql
Content-Type: application/json

Executes a GraphQL operation (query or mutation) via a POST request
with a JSON body.

Reference: https://api.asimov.social/graphql/post

## Servers

- `http://localhost:8000` (local)
- `https://asimov.social` (prod, default)

## Request

### Body (application/json)

This endpoint expects a GraphQLRequest.

- `query` (string, required) — The GraphQL query or mutation string to execute.
- `operationName` (string, optional) — Specifies which operation to execute if the query string contains multiple operations.
- `variables` (map from string to any, optional) — A JSON object containing variables referenced in the query.

## Response

### 200

- `data` (map from string to any, optional) — The payload returned by the GraphQL execution.
- `errors` (list of GraphQLError, optional) — A list of errors that occurred during execution.
- `extensions` (map from string to any, optional) — Reserved for implementors to extend the protocol (e.g., tracing data).

## Types

### GraphQLError

- `message` (string, required) — A description of the error.
- `locations` (list of GraphQLLocation, optional)
- `path` (list of any, optional) — The path to the response field where the error occurred (can contain strings and integers).

### GraphQLLocation

- `line` (integer, required)
- `column` (integer, required)

## Examples

**Request**

```json
{
  "query": "query"
}
```

**Response**

```json
{
  "data": {
    "data": {
      "key": "value"
    }
  },
  "errors": [
    {
      "message": "message",
      "locations": [
        {
          "line": 1,
          "column": 1
        },
        {
          "line": 1,
          "column": 1
        }
      ],
      "path": [
        {
          "key": "value"
        },
        {
          "key": "value"
        }
      ]
    },
    {
      "message": "message",
      "locations": [
        {
          "line": 1,
          "column": 1
        },
        {
          "line": 1,
          "column": 1
        }
      ],
      "path": [
        {
          "key": "value"
        },
        {
          "key": "value"
        }
      ]
    }
  ],
  "extensions": {
    "extensions": {
      "key": "value"
    }
  }
}
```

**SDK Code**

```python
import requests

url = "https://asimov.social/graphql"

payload = { "query": "query" }
headers = {"Content-Type": "application/json"}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript
const url = 'https://asimov.social/graphql';
const options = {
  method: 'POST',
  headers: {'Content-Type': 'application/json'},
  body: '{"query":"query"}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://asimov.social/graphql"

	payload := strings.NewReader("{\n  \"query\": \"query\"\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby
require 'uri'
require 'net/http'

url = URI("https://asimov.social/graphql")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n  \"query\": \"query\"\n}"

response = http.request(request)
puts response.read_body
```

```java
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://asimov.social/graphql")
  .header("Content-Type", "application/json")
  .body("{\n  \"query\": \"query\"\n}")
  .asString();
```

```php
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://asimov.social/graphql', [
  'body' => '{
  "query": "query"
}',
  'headers' => [
    'Content-Type' => 'application/json',
  ],
]);

echo $response->getBody();
```

```csharp
using RestSharp;

var client = new RestClient("https://asimov.social/graphql");
var request = new RestRequest(Method.POST);
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"query\": \"query\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = ["Content-Type": "application/json"]
let parameters = ["query": "query"] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://asimov.social/graphql")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```