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

# Getting Started with the Mind Reasoner API

![Mind Reasoner API](/_fern-img/466e07efd0202b28f29ec8dda3be88918c85104c2652efceb8ff717127f861ca.webp)

> **See What's Really Happening**
>
> The Mind Reasoner API allows you to programmatically create
>
> digital minds
>
> , populate them with conversational data, and run powerful simulations to get an accurate preview of how the person will think, feel, say, and act in any scenario. This guide will walk you through the entire process in three core steps.

## Prerequisites

Before you begin, make sure you have your API key. You can get this from your Mind Reasoner account dashboard. You will pass the API key as a

Bearer token

in the `Authorization` header of every request.

This guide provides interactive code examples in today's most popular languages. Use the tabs to select your language—the choice will sync across all examples on the page.

**`cURL`**

```bash title="cURL"
# cURL is pre-installed on most macOS, Linux, and modern Windows systems.
# No installation is needed.
```

**`Node.js`**

```javascript title="Node.js"
# Install the axios library to make HTTP requests
npm install axios
```

**`Python`**

```python title="Python"
# Install the requests library to make HTTP requests
pip install requests
```

**`PHP`**

```php title="PHP"
# No special installation needed if you have the cURL extension enabled
# For a more robust solution, consider a library like Guzzle:
# composer require guzzlehttp/guzzle
```

**`Ruby`**

```ruby title="Ruby"
# No special installation needed for the built-in Net::HTTP library
# For a simpler experience, consider a gem like HTTParty:
# gem install httparty
```

**`Go`**

```go title="Go"
# No special installation needed. Go's standard library is used.
```

The following examples use placeholder variables. Hover over them in the code to see what they mean and where to find their values.

## The 3-Step Workflow

#### Step 1: Create Your First Mind

First, create a "mind." This is the core entity that will hold the data and personality model. Send a `POST` request to the `/minds` endpoint with the name of the mind you want to create.

**`cURL`**

```bash title="cURL"
curl -X POST https://app.mindreasoner.com/api/public/v1/minds \
  -H "Authorization: Bearer {{API_KEY}}" \
  -H "Content-Type: application/json" \
  -d '{"name": "{{MIND_NAME}}"}'
```

**`Node.js`**

```javascript title="Node.js"
import axios from 'axios';

const apiKey = '{{API_KEY}}';
const url = 'https://app.mindreasoner.com/api/public/v1/minds';

const createMind = async () => {
  try {
    const response = await axios.post(url, {
      name: 'Example Mind'
    }, {
      headers: {
        'Authorization': `Bearer ${apiKey}`,
        'Content-Type': 'application/json'
      }
    });
    console.log('Mind created successfully:');
    console.log(JSON.stringify(response.data, null, 2));
  } catch (error) {
    console.error('Error creating mind:', error.response.data);
  }
};

createMind();
```

**`Python`**

```python title="Python"
import requests
import json

api_key = '{{API_KEY}}'
url = 'https://app.mindreasoner.com/api/public/v1/minds'

headers = {
    'Authorization': f'Bearer {api_key}',
    'Content-Type': 'application/json'
}
payload = {
    'name': 'Example Mind'
}

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

if response.status_code == 200:
    print("Mind created successfully:")
    print(json.dumps(response.json(), indent=2))
else:
    print(f"Error creating mind: {response.status_code}")
    print(response.text)
```

**`PHP`**

```php title="PHP"
<?php
$apiKey = '{{API_KEY}}';
$url = 'https://app.mindreasoner.com/api/public/v1/minds';

$data = ['name' => 'Example Mind'];
$payload = json_encode($data);

$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $payload);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
    'Authorization: Bearer ' . $apiKey,
    'Content-Type: application/json'
]);

$response = curl_exec($ch);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);

if ($httpCode == 200) {
    echo "Mind created successfully:\n";
    $jsonResponse = json_decode($response, true);
    echo json_encode($jsonResponse, JSON_PRETTY_PRINT);
} else {
    echo "Error creating mind: " . $response;
}
?>
```

**`Ruby`**

```ruby title="Ruby"
require 'uri'
require 'net/http'
require 'json'

api_key = '{{API_KEY}}'
url = URI("https://app.mindreasoner.com/api/public/v1/minds")

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

request = Net::HTTP::Post.new(url)
request["Authorization"] = "Bearer #{api_key}"
request["Content-Type"] = "application/json"
request.body = JSON.dump({ "name" => "Example Mind" })

response = http.request(request)

puts "Mind created successfully:"
puts JSON.pretty_generate(JSON.parse(response.read_body))
```

**`Go`**

```go title="Go"
package main

import (
	"bytes"
	"encoding/json"
	"fmt"
	"io"
	"net/http"
)

func main() {
	apiKey := "{{API_KEY}}"
	url := "https://app.mindreasoner.com/api/public/v1/minds"

	payload := map[string]string{"name": "Example Mind"}
	jsonPayload, _ := json.Marshal(payload)

	req, _ := http.NewRequest("POST", url, bytes.NewBuffer(jsonPayload))
	req.Header.Set("Authorization", "Bearer "+apiKey)
	req.Header.Set("Content-Type", "application/json")

	client := &http.Client{}
	resp, err := client.Do(req)
	if err != nil {
		panic(err)
	}
	defer resp.Body.Close()

	body, _ := io.ReadAll(resp.Body)
	fmt.Println("Mind created successfully:")
	
    var prettyJSON bytes.Buffer
    json.Indent(&prettyJSON, body, "", "  ")
    fmt.Println(string(prettyJSON.Bytes()))
}
```

The API will respond with the new mind's data. **Save the `id` from the `mind` object and the `id` from the `digitalTwin` object.** You will need them for the next steps.

```json {3,8}
{
  "mind": {
    "id": "123e4567-e89b-12d3-a456-426614174000", // <-- Save this mindId
    "name": "Example Mind",
    // ...
  },
  "digitalTwin": {
    "id": "abcde123-e89b-12d3-a456-426614174001", // <-- Save this digitalTwinId
    "name": "Default",
    // ...
  },
  // ...
}
```

#### Step 2: Upload a Data Snapshot

Now, let's give the mind some knowledge by uploading a

data file

(like a conversation transcript in `.vtt`, `.docx`, or `.pdf` format). This creates a

snapshot

of the mind's state.

> **Part A: Get a Secure Upload URL**
>
> First, ask the API for a special, one-time URL to upload your file.
>
> ```bash title="cURL"
> curl -X GET "https://app.mindreasoner.com/api/public/v1/minds/{{MIND_ID}}/signed-url" \
>   -H "Authorization: Bearer {{API_KEY}}"
> ```
>
> ```javascript title="Node.js"
> import axios from 'axios';
>
> const apiKey = '{{API_KEY}}';
> const mindId = '{{MIND_ID}}'; // <-- From Step 1
> const url = `https://app.mindreasoner.com/api/public/v1/minds/${mindId}/signed-url`;
>
> const getUploadUrl = async () => {
>   try {
>     const response = await axios.get(url, {
>       headers: { 'Authorization': `Bearer ${apiKey}` }
>     });
>     console.log('Secure URL received:');
>     console.log(JSON.stringify(response.data, null, 2));
>   } catch (error) {
>     console.error('Error getting URL:', error.response.data);
>   }
> };
>
> getUploadUrl();
> ```
>
> ```python title="Python"
> import requests
> import json
>
> api_key = '{{API_KEY}}'
> mind_id = '{{MIND_ID}}' # <-- From Step 1
> url = f'https://app.mindreasoner.com/api/public/v1/minds/{mind_id}/signed-url'
>
> headers = {'Authorization': f'Bearer {api_key}'}
> response = requests.get(url, headers=headers)
>
> if response.status_code == 200:
>     print("Secure URL received:")
>     print(json.dumps(response.json(), indent=2))
> else:
>     print(f"Error getting URL: {response.status_code}")
>     print(response.text)
> ```
>
> ```php title="PHP"
> <?php
> $apiKey = '{{API_KEY}}';
> $mindId = '{{MIND_ID}}'; // <-- From Step 1
> $url = "https://app.mindreasoner.com/api/public/v1/minds/{$mindId}/signed-url";
>
> $ch = curl_init($url);
> curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
> curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer ' . $apiKey]);
>
> $response = curl_exec($ch);
> curl_close($ch);
>
> echo "Secure URL received:\n";
> $jsonResponse = json_decode($response, true);
> echo json_encode($jsonResponse, JSON_PRETTY_PRINT);
> ?>
> ```
>
> ```ruby title="Ruby"
> require 'uri'
> require 'net/http'
> require 'json'
>
> api_key = '{{API_KEY}}'
> mind_id = '{{MIND_ID}}' # <-- From Step 1
> url = URI("https://app.mindreasoner.com/api/public/v1/minds/#{mind_id}/signed-url")
>
> http = Net::HTTP.new(url.host, url.port)
> http.use_ssl = true
> request = Net::HTTP::Get.new(url)
> request["Authorization"] = "Bearer #{api_key}"
>
> response = http.request(request)
> puts "Secure URL received:"
> puts JSON.pretty_generate(JSON.parse(response.read_body))
> ```
>
> ```go title="Go"
> package main
>
> import (
> 	"bytes"
> 	"encoding/json"
> 	"fmt"
> 	"io"
> 	"net/http"
> )
>
> func main() {
> 	apiKey := "{{API_KEY}}"
> 	mindId := "{{MIND_ID}}" // <-- From Step 1
> 	url := fmt.Sprintf("https://app.mindreasoner.com/api/public/v1/minds/%s/signed-url", mindId)
>
> 	req, _ := http.NewRequest("GET", url, nil)
> 	req.Header.Set("Authorization", "Bearer "+apiKey)
>
> 	client := &http.Client{}
> 	resp, err := client.Do(req)
> 	if err != nil { panic(err) }
> 	defer resp.Body.Close()
>
> 	body, _ := io.ReadAll(resp.Body)
> 	fmt.Println("Secure URL received:")
>   var prettyJSON bytes.Buffer
>   json.Indent(&prettyJSON, body, "", "  ")
>   fmt.Println(string(prettyJSON.Bytes()))
> }
> ```
>
> The response will contain a `signedUrl` and an `artifactId`. **Save the `artifactId`**.
>
> ```json {4}
> {
>   "signedUrl": "https://storage.googleapis.com/...", // <-- The temporary upload destination
>   "fileName": "...",
>   "artifactId": "fedcba98-e89b-12d3-a456-426614174002" // <-- Save this artifactId
> }
> ```

> **Part B: Upload Your File**
>
> Next, use the `signedUrl` to upload your local file. This is a `PUT` request where the body is your file's content.
>
> ```bash title="cURL"
> curl -X PUT "{{SIGNED_URL}}" \
>   -H "Content-Type: text/vtt" \
>   --data-binary "@/path/to/your/transcript.vtt"
> ```
>
> ```javascript title="Node.js"
> import axios from 'axios';
> import fs from 'fs';
>
> const signedUrl = '{{SIGNED_URL}}'; // <-- From Part A
> const filePath = '/path/to/your/transcript.vtt';
> const contentType = 'text/vtt'; // Adjust for your file type (e.g., application/pdf)
>
> const uploadFile = async () => {
>   try {
>     const fileContent = fs.readFileSync(filePath);
>     await axios.put(signedUrl, fileContent, {
>       headers: { 'Content-Type': contentType }
>     });
>     console.log('File uploaded successfully.');
>   } catch (error) {
>     console.error('Error uploading file:', error.message);
>   }
> };
>
> uploadFile();
> ```
>
> ```python title="Python"
> import requests
>
> signed_url = '{{SIGNED_URL}}' # <-- From Part A
> file_path = '/path/to/your/transcript.vtt'
> content_type = 'text/vtt' # Adjust for your file type (e.g., application/pdf)
>
> with open(file_path, 'rb') as f:
>     headers = {'Content-Type': content_type}
>     response = requests.put(signed_url, data=f, headers=headers)
>
>     if response.status_code == 200:
>         print("File uploaded successfully.")
>     else:
>         print(f"Error uploading file: {response.status_code}")
>         print(response.text)
> ```
>
> ```php title="PHP"
> <?php
> $signedUrl = '{{SIGNED_URL}}'; // <-- From Part A
> $filePath = '/path/to/your/transcript.vtt';
> $contentType = 'text/vtt'; // Adjust for your file type
>
> $fileContent = file_get_contents($filePath);
>
> $ch = curl_init($signedUrl);
> curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
> curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "PUT");
> curl_setopt($ch, CURLOPT_POSTFIELDS, $fileContent);
> curl_setopt($ch, CURLOPT_HTTPHEADER, ['Content-Type: ' . $contentType]);
>
> curl_exec($ch);
> $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
> curl_close($ch);
>
> if ($httpCode == 200) {
>     echo "File uploaded successfully.";
> } else {
>     echo "Error uploading file. Status: " . $httpCode;
> }
> ?>
> ```
>
> ```ruby title="Ruby"
> require 'uri'
> require 'net/http'
>
> signed_url = '{{SIGNED_URL}}' # <-- From Part A
> file_path = '/path/to/your/transcript.vtt'
> content_type = 'text/vtt' # Adjust for your file type
>
> url = URI(signed_url)
> http = Net::HTTP.new(url.host, url.port)
> http.use_ssl = true
>
> request = Net::HTTP::Put.new(url)
> request["Content-Type"] = content_type
> request.body = File.read(file_path)
>
> response = http.request(request)
> if response.code == "200"
>   puts "File uploaded successfully."
> else
>   puts "Error uploading file: #{response.code}"
> end
> ```
>
> ```go title="Go"
> package main
>
> import (
> 	"fmt"
> 	"net/http"
> 	"os"
> )
>
> func main() {
> 	signedURL := "{{SIGNED_URL}}" // <-- From Part A
> 	filePath := "/path/to/your/transcript.vtt"
> 	contentType := "text/vtt" // Adjust for your file type
>
> 	file, err := os.Open(filePath)
> 	if err != nil { panic(err) }
> 	defer file.Close()
>
> 	req, _ := http.NewRequest("PUT", signedURL, file)
> 	req.Header.Set("Content-Type", contentType)
>
> 	client := &http.Client{}
> 	resp, err := client.Do(req)
> 	if err != nil { panic(err) }
> 	defer resp.Body.Close()
>
> 	if resp.StatusCode == http.StatusOK {
> 		fmt.Println("File uploaded successfully.")
> 	} else {
> 		fmt.Printf("Error uploading file: %s\n", resp.Status)
> 	}
> }
> ```

> **Part C: Create the Snapshot**
>
> Finally, tell Mind Reasoner to process the uploaded file. Send a `POST` request using the IDs you saved.
>
> ```bash title="cURL"
> curl -X POST "https://app.mindreasoner.com/api/public/v1/minds/{{MIND_ID}}/snapshots" \
>   -H "Authorization: Bearer {{API_KEY}}" \
>   -F "digitalTwinId={{DIGITAL_TWIN_ID}}" \
>   -F "artifactId={{ARTIFACT_ID}}"
> ```
>
> ```javascript title="Node.js"
> import axios from 'axios';
> import FormData from 'form-data';
>
> const apiKey = '{{API_KEY}}';
> const mindId = '{{MIND_ID}}';
> const digitalTwinId = '{{DIGITAL_TWIN_ID}}';
> const artifactId = '{{ARTIFACT_ID}}';
>
> const url = `https://app.mindreasoner.com/api/public/v1/minds/${mindId}/snapshots`;
>
> const createSnapshot = async () => {
>   const form = new FormData();
>   form.append('digitalTwinId', digitalTwinId);
>   form.append('artifactId', artifactId);
>
>   try {
>     const response = await axios.post(url, form, {
>       headers: {
>         ...form.getHeaders(),
>         'Authorization': `Bearer ${apiKey}`
>       }
>     });
>     console.log('Snapshot creation started:');
>     console.log(JSON.stringify(response.data, null, 2));
>   } catch (error) {
>     console.error('Error creating snapshot:', error.response.data);
>   }
> };
>
> createSnapshot();
> ```
>
> ```python title="Python"
> import requests
> import json
>
> api_key = '{{API_KEY}}'
> mind_id = '{{MIND_ID}}'
>
> url = f'https://app.mindreasoner.com/api/public/v1/minds/{mind_id}/snapshots'
> headers = {'Authorization': f'Bearer {api_key}'}
>
> data = {
>     'digitalTwinId': '{{DIGITAL_TWIN_ID}}',
>     'artifactId': '{{ARTIFACT_ID}}'
> }
>
> response = requests.post(url, headers=headers, files=data)
>
> if response.status_code == 200:
>     print("Snapshot creation started:")
>     print(json.dumps(response.json(), indent=2))
> else:
>     print(f"Error: {response.status_code}")
>     print(response.text)
> ```
>
> ```php title="PHP"
> <?php
> $apiKey = '{{API_KEY}}';
> $mindId = '{{MIND_ID}}';
>
> $url = "https://app.mindreasoner.com/api/public/v1/minds/{$mindId}/snapshots";
>
> $postData = [
>     'digitalTwinId' => '{{DIGITAL_TWIN_ID}}',
>     'artifactId' => '{{ARTIFACT_ID}}'
> ];
>
> $ch = curl_init($url);
> curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
> curl_setopt($ch, CURLOPT_POST, true);
> curl_setopt($ch, CURLOPT_POSTFIELDS, $postData);
> curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer ' . $apiKey]);
>
> $response = curl_exec($ch);
> curl_close($ch);
>
> echo "Snapshot creation started:\n";
> $jsonResponse = json_decode($response, true);
> echo json_encode($jsonResponse, JSON_PRETTY_PRINT);
> ?>
> ```
>
> ```ruby title="Ruby"
> require 'uri'
> require 'net/http'
> require 'json'
>
> api_key = '{{API_KEY}}'
> mind_id = '{{MIND_ID}}'
>
> url = URI("https://app.mindreasoner.com/api/public/v1/minds/#{mind_id}/snapshots")
>
> http = Net::HTTP.new(url.host, url.port)
> http.use_ssl = true
>
> request = Net::HTTP::Post.new(url)
> request["Authorization"] = "Bearer #{api_key}"
> form_data = [
>   ['digitalTwinId', '{{DIGITAL_TWIN_ID}}'],
>   ['artifactId', '{{ARTIFACT_ID}}']
> ]
> request.set_form form_data, 'multipart/form-data'
>
> response = http.request(request)
> puts "Snapshot creation started:"
> puts JSON.pretty_generate(JSON.parse(response.read_body))
> ```
>
> ```go title="Go"
> package main
>
> import (
> 	"bytes"
> 	"encoding/json"
> 	"fmt"
> 	"io"
> 	"mime/multipart"
> 	"net/http"
> )
>
> func main() {
> 	apiKey := "{{API_KEY}}"
> 	mindId := "{{MIND_ID}}"
> 	url := fmt.Sprintf("https://app.mindreasoner.com/api/public/v1/minds/%s/snapshots", mindId)
>
> 	body := &bytes.Buffer{}
> 	writer := multipart.NewWriter(body)
> 	writer.WriteField("digitalTwinId", "{{DIGITAL_TWIN_ID}}")
> 	writer.WriteField("artifactId", "{{ARTIFACT_ID}}")
> 	writer.Close()
>
> 	req, _ := http.NewRequest("POST", url, body)
> 	req.Header.Set("Authorization", "Bearer "+apiKey)
> 	req.Header.Set("Content-Type", writer.FormDataContentType())
>
> 	client := &http.Client{}
> 	resp, err := client.Do(req)
> 	if err != nil { panic(err) }
> 	defer resp.Body.Close()
>
> 	respBody, _ := io.ReadAll(resp.Body)
> 	fmt.Println("Snapshot creation started:")
>   var prettyJSON bytes.Buffer
>   json.Indent(&prettyJSON, respBody, "", "  ")
>   fmt.Println(string(prettyJSON.Bytes()))
> }
> ```
>
> The response will give you a `mindAssessmentId`. **Save this ID**, as it's your snapshot's unique identifier.
>
> ```json {3}
> {
>   "message": "Mind assessment started",
>   "mindAssessmentId": "98765432-e89b-12d3-a456-426614174003", // <-- Save this snapshotId
>   "artifactId": "fedcba98-e89b-12d3-a456-426614174002"
> }
> ```

#### Step 3: Run Your First Simulation

Snapshot processing is

asynchronous

. Before you can run a simulation, you must check its status.

> **Check Snapshot Status**
>
> Poll the `/status` endpoint using your `mindId` and the `snapshotId` (`mindAssessmentId`) until the `status` is `completed`.
>
> ```bash title="cURL"
> curl -X GET "https://app.mindreasoner.com/api/public/v1/minds/{{MIND_ID}}/snapshots/{{SNAPSHOT_ID}}/status" \
>   -H "Authorization: Bearer {{API_KEY}}"
> ```
>
> ```javascript title="Node.js"
> import axios from 'axios';
>
> const apiKey = '{{API_KEY}}';
> const mindId = '{{MIND_ID}}';
> const snapshotId = '{{SNAPSHOT_ID}}';
> const url = `https://app.mindreasoner.com/api/public/v1/minds/${mindId}/snapshots/${snapshotId}/status`;
>
> const checkStatus = async () => {
>   try {
>     const response = await axios.get(url, {
>       headers: { 'Authorization': `Bearer ${apiKey}` }
>     });
>     console.log('Snapshot status:');
>     console.log(JSON.stringify(response.data, null, 2));
>   } catch (error) {
>     console.error('Error checking status:', error.response.data);
>   }
> };
>
> checkStatus();
> ```
>
> ```python title="Python"
> import requests
> import json
>
> api_key = '{{API_KEY}}'
> mind_id = '{{MIND_ID}}'
> snapshot_id = '{{SNAPSHOT_ID}}'
> url = f'https://app.mindreasoner.com/api/public/v1/minds/{mind_id}/snapshots/{snapshot_id}/status'
>
> headers = {'Authorization': f'Bearer {api_key}'}
> response = requests.get(url, headers=headers)
>
> print("Snapshot status:")
> print(json.dumps(response.json(), indent=2))
> ```
>
> ```php title="PHP"
> <?php
> $apiKey = '{{API_KEY}}';
> $mindId = '{{MIND_ID}}';
> $snapshotId = '{{SNAPSHOT_ID}}';
> $url = "https://app.mindreasoner.com/api/public/v1/minds/{$mindId}/snapshots/{$snapshotId}/status";
>
> $ch = curl_init($url);
> curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
> curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer ' . $apiKey]);
>
> $response = curl_exec($ch);
> curl_close($ch);
>
> echo "Snapshot status:\n";
> $jsonResponse = json_decode($response, true);
> echo json_encode($jsonResponse, JSON_PRETTY_PRINT);
> ?>
> ```
>
> ```ruby title="Ruby"
> require 'uri'
> require 'net/http'
> require 'json'
>
> api_key = '{{API_KEY}}'
> mind_id = '{{MIND_ID}}'
> snapshot_id = '{{SNAPSHOT_ID}}'
> url = URI("https://app.mindreasoner.com/api/public/v1/minds/#{mind_id}/snapshots/#{snapshot_id}/status")
>
> http = Net::HTTP.new(url.host, url.port)
> http.use_ssl = true
> request = Net::HTTP::Get.new(url)
> request["Authorization"] = "Bearer #{api_key}"
>
> response = http.request(request)
> puts "Snapshot status:"
> puts JSON.pretty_generate(JSON.parse(response.read_body))
> ```
>
> ```go title="Go"
> package main
>
> import (
> 	"bytes"
> 	"encoding/json"
> 	"fmt"
> 	"io"
> 	"net/http"
> )
>
> func main() {
> 	apiKey := "{{API_KEY}}"
> 	mindId := "{{MIND_ID}}"
> 	snapshotId := "{{SNAPSHOT_ID}}"
> 	url := fmt.Sprintf("https://app.mindreasoner.com/api/public/v1/minds/%s/snapshots/%s/status", mindId, snapshotId)
>
> 	req, _ := http.NewRequest("GET", url, nil)
> 	req.Header.Set("Authorization", "Bearer "+apiKey)
>
> 	client := &http.Client{}
> 	resp, err := client.Do(req)
> 	if err != nil { panic(err) }
> 	defer resp.Body.Close()
>
> 	body, _ := io.ReadAll(resp.Body)
> 	fmt.Println("Snapshot status:")
>   var prettyJSON bytes.Buffer
>   json.Indent(&prettyJSON, body, "", "  ")
>   fmt.Println(string(prettyJSON.Bytes()))
> }
> ```
>
> **Wait for this response:**
>
> ```json {3}
> {
>   "id": "98765432-e89b-12d3-a456-426614174003",
>   "status": "completed",
>   // ...
> }
> ```

Once the snapshot is complete, you can run a simulation. Send a `POST` request to the `/simulate` endpoint with your `**mindId**` and a

scenario

.

**`cURL`**

```bash title="cURL"
curl -X POST https://app.mindreasoner.com/api/public/v1/simulate \
  -H "Authorization: Bearer {{API_KEY}}" \
  -H "Content-Type: application/json" \
  -d '{
        "mindId": "{{MIND_ID}}",
        "selectedSimulationModel": "{{SIMULATION_MODEL}}",
        "scenario": {
          "message": "What would be your response to this customer complaint?"
        }
      }'
```

**`Node.js`**

```javascript title="Node.js"
import axios from 'axios';

const apiKey = '{{API_KEY}}';
const url = 'https://app.mindreasoner.com/api/public/v1/simulate';

const payload = {
  mindId: '{{MIND_ID}}',
  selectedSimulationModel: '{{SIMULATION_MODEL}}',
  scenario: {
    message: 'What would be your response to this customer complaint?'
  }
};

const runSimulation = async () => {
  try {
    const response = await axios.post(url, payload, {
      headers: {
        'Authorization': `Bearer ${apiKey}`,
        'Content-Type': 'application/json'
      }
    });
    console.log('Simulation result:');
    console.log(JSON.stringify(response.data, null, 2));
  } catch (error) {
    console.error('Error running simulation:', error.response.data);
  }
};

runSimulation();
```

**`Python`**

```python title="Python"
import requests
import json

api_key = '{{API_KEY}}'
url = 'https://app.mindreasoner.com/api/public/v1/simulate'

headers = {
    'Authorization': f'Bearer {api_key}',
    'Content-Type': 'application/json'
}
payload = {
    'mindId': '{{MIND_ID}}',
    'selectedSimulationModel': '{{SIMULATION_MODEL}}',
    'scenario': {
        'message': 'What would be your response to this customer complaint?'
    }
}

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

print("Simulation result:")
print(json.dumps(response.json(), indent=2))
```

**`PHP`**

```php title="PHP"
<?php
$apiKey = '{{API_KEY}}';
$url = 'https://app.mindreasoner.com/api/public/v1/simulate';

$data = [
    'mindId' => '{{MIND_ID}}',
    'selectedSimulationModel' => '{{SIMULATION_MODEL}}',
    'scenario' => [
        'message' => 'What would be your response to this customer complaint?'
    ]
];
$payload = json_encode($data);

$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $payload);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
    'Authorization: Bearer ' . $apiKey,
    'Content-Type: application/json'
]);

$response = curl_exec($ch);
curl_close($ch);

echo "Simulation result:\n";
$jsonResponse = json_decode($response, true);
echo json_encode($jsonResponse, JSON_PRETTY_PRINT);
?>
```

**`Ruby`**

```ruby title="Ruby"
require 'uri'
require 'net/http'
require 'json'

api_key = '{{API_KEY}}'
url = URI("https://app.mindreasoner.com/api/public/v1/simulate")

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

request = Net::HTTP::Post.new(url)
request["Authorization"] = "Bearer #{api_key}"
request["Content-Type"] = "application/json"
request.body = JSON.dump({
  "mindId" => "{{MIND_ID}}",
  "selectedSimulationModel" => "{{SIMULATION_MODEL}}",
  "scenario" => {
    "message" => "What would be your response to this customer complaint?"
  }
})

response = http.request(request)
puts "Simulation result:"
puts JSON.pretty_generate(JSON.parse(response.read_body))
```

**`Go`**

```go title="Go"
package main

import (
	"bytes"
	"encoding/json"
	"fmt"
	"io"
	"net/http"
)

func main() {
	apiKey := "{{API_KEY}}"
	url := "https://app.mindreasoner.com/api/public/v1/simulate"

	payload := map[string]interface{}{
		"mindId": "{{MIND_ID}}",
		"selectedSimulationModel": "{{SIMULATION_MODEL}}",
		"scenario": map[string]string{
			"message": "What would be your response to this customer complaint?",
		},
	}
	jsonPayload, _ := json.Marshal(payload)

	req, _ := http.NewRequest("POST", url, bytes.NewBuffer(jsonPayload))
	req.Header.Set("Authorization", "Bearer "+apiKey)
	req.Header.Set("Content-Type", "application/json")

	client := &http.Client{}
	resp, err := client.Do(req)
	if err != nil { panic(err) }
	defer resp.Body.Close()

	body, _ := io.ReadAll(resp.Body)
	fmt.Println("Simulation result:")
  var prettyJSON bytes.Buffer
  json.Indent(&prettyJSON, body, "", "  ")
  fmt.Println(string(prettyJSON.Bytes()))
}
```

The API will return the simulated response from the mind.

```json
{
  "message": "Based on the provided data, my response to the customer complaint would be..."
}
```

> **You're Ready to Build**
>
> Congratulations! You have successfully created a mind, uploaded data, and run your first simulation. You can now integrate this workflow to bring an accurate preview of how a person will think, feel, say, and act into your own applications.

## Need Help?

📖

### Full API Reference

Explore all endpoints and parameters in the official [API Documentation](https://docs.reasoner.com/mind-reasoner-api/api-reference).

📧

### Email Support

Contact us at [support@mindreasoner.com](mailto:support@mindreasoner.com) for technical questions.