Skip to main content
POST
/
models
/
{model_id}
/
model_runs
Create a model run
curl --request POST \
  --url https://app.gomangrove.com/api/v1/models/{model_id}/model_runs \
  --header 'Authorization: <api-key>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "model_run": {
    "start_time": "2025-01-01T00:00:00Z",
    "end_time": "2025-03-31T23:59:59Z",
    "data_point_ids": [
      "dp_abc123",
      "dp_def456"
    ]
  }
}
'
import requests

url = "https://app.gomangrove.com/api/v1/models/{model_id}/model_runs"

payload = { "model_run": {
"start_time": "2025-01-01T00:00:00Z",
"end_time": "2025-03-31T23:59:59Z",
"data_point_ids": ["dp_abc123", "dp_def456"]
} }
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}

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

print(response.text)
const options = {
method: 'POST',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
model_run: {
start_time: '2025-01-01T00:00:00Z',
end_time: '2025-03-31T23:59:59Z',
data_point_ids: ['dp_abc123', 'dp_def456']
}
})
};

fetch('https://app.gomangrove.com/api/v1/models/{model_id}/model_runs', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));
<?php

$curl = curl_init();

curl_setopt_array($curl, [
CURLOPT_URL => "https://app.gomangrove.com/api/v1/models/{model_id}/model_runs",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'model_run' => [
'start_time' => '2025-01-01T00:00:00Z',
'end_time' => '2025-03-31T23:59:59Z',
'data_point_ids' => [
'dp_abc123',
'dp_def456'
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"Content-Type: application/json"
],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
package main

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

func main() {

url := "https://app.gomangrove.com/api/v1/models/{model_id}/model_runs"

payload := strings.NewReader("{\n \"model_run\": {\n \"start_time\": \"2025-01-01T00:00:00Z\",\n \"end_time\": \"2025-03-31T23:59:59Z\",\n \"data_point_ids\": [\n \"dp_abc123\",\n \"dp_def456\"\n ]\n }\n}")

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

req.Header.Add("Authorization", "<api-key>")
req.Header.Add("Content-Type", "application/json")

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

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

fmt.Println(string(body))

}
HttpResponse<String> response = Unirest.post("https://app.gomangrove.com/api/v1/models/{model_id}/model_runs")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"model_run\": {\n \"start_time\": \"2025-01-01T00:00:00Z\",\n \"end_time\": \"2025-03-31T23:59:59Z\",\n \"data_point_ids\": [\n \"dp_abc123\",\n \"dp_def456\"\n ]\n }\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://app.gomangrove.com/api/v1/models/{model_id}/model_runs")

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

request = Net::HTTP::Post.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"model_run\": {\n \"start_time\": \"2025-01-01T00:00:00Z\",\n \"end_time\": \"2025-03-31T23:59:59Z\",\n \"data_point_ids\": [\n \"dp_abc123\",\n \"dp_def456\"\n ]\n }\n}"

response = http.request(request)
puts response.read_body
{
  "id": 1,
  "start_time": "2025-01-01T00:00:00.000Z",
  "end_time": "2025-03-31T23:59:59.000Z",
  "state": "complete",
  "error_message": null,
  "created_at": "2025-01-15T10:00:00.000Z",
  "updated_at": "2025-01-15T10:00:00.000Z",
  "calculations": [
    {
      "id": 1,
      "name": "Net Carbon Removal",
      "value": 100.5,
      "unit": "t",
      "ghg": "co2e",
      "lca_role": "net",
      "category": "removal"
    }
  ],
  "output_data_points": [
    {
      "id": "dp_abc123",
      "slug": "net-carbon-removal",
      "data_point_type": "Net Carbon Removal",
      "value": 100.5,
      "unit": "t",
      "status": "complete"
    }
  ]
}
{
"status": "error",
"statusCode": 422,
"errors": [
{
"message": "Missing required data points"
}
]
}

Authorizations

Authorization
string
header
required

Path Parameters

model_id
string
required

Model friendly ID (e.g., mdl_abc123def456)

Body

application/json
model_run
object
required

Response

201

id
integer
start_time
string<date-time>
end_time
string<date-time>
state
string
error_message
string | null
created_at
string<date-time>
updated_at
string<date-time>
calculations
object[]
output_data_points
object[]