Launch a job
curl --request POST \
--url https://api.mentionlab.io/api/v2/projects/{projectId}/jobs \
--header 'Content-Type: application/json' \
--header 'x-project-id: <x-project-id>' \
--data '
{
"models": [
"scp-ml-chatgpt",
"claude-haiku-latest"
],
"executionCount": 3,
"force": true
}
'import requests
url = "https://api.mentionlab.io/api/v2/projects/{projectId}/jobs"
payload = {
"models": ["scp-ml-chatgpt", "claude-haiku-latest"],
"executionCount": 3,
"force": True
}
headers = {
"x-project-id": "<x-project-id>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'x-project-id': '<x-project-id>', 'Content-Type': 'application/json'},
body: JSON.stringify({
models: ['scp-ml-chatgpt', 'claude-haiku-latest'],
executionCount: 3,
force: true
})
};
fetch('https://api.mentionlab.io/api/v2/projects/{projectId}/jobs', 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://api.mentionlab.io/api/v2/projects/{projectId}/jobs",
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([
'models' => [
'scp-ml-chatgpt',
'claude-haiku-latest'
],
'executionCount' => 3,
'force' => true
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-project-id: <x-project-id>"
],
]);
$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://api.mentionlab.io/api/v2/projects/{projectId}/jobs"
payload := strings.NewReader("{\n \"models\": [\n \"scp-ml-chatgpt\",\n \"claude-haiku-latest\"\n ],\n \"executionCount\": 3,\n \"force\": true\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-project-id", "<x-project-id>")
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://api.mentionlab.io/api/v2/projects/{projectId}/jobs")
.header("x-project-id", "<x-project-id>")
.header("Content-Type", "application/json")
.body("{\n \"models\": [\n \"scp-ml-chatgpt\",\n \"claude-haiku-latest\"\n ],\n \"executionCount\": 3,\n \"force\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.mentionlab.io/api/v2/projects/{projectId}/jobs")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-project-id"] = '<x-project-id>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"models\": [\n \"scp-ml-chatgpt\",\n \"claude-haiku-latest\"\n ],\n \"executionCount\": 3,\n \"force\": true\n}"
response = http.request(request)
puts response.read_body{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"status": "pending",
"createdBy": {
"id": "9f1c2d3e-4a5b-4c6d-8e7f-0a1b2c3d4e5f",
"firstName": "Ada",
"lastName": "Lovelace",
"email": "[email protected]"
},
"scheduleId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"spentCredits": 123,
"totalExecutionCount": 123,
"pendingExecutionCount": 123,
"retryingExecutionCount": 123,
"succeededExecutionCount": 123,
"failedExecutionCount": 123,
"themeAnalysis": "done",
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z"
}{
"statusCode": 400,
"message": "Validation failed",
"error": "Bad Request"
}{
"statusCode": 400,
"message": "Validation failed",
"error": "Bad Request"
}{
"statusCode": 400,
"message": "Validation failed",
"error": "Bad Request"
}{
"code": "RECENT_JOB_EXISTS",
"message": "<string>",
"jobId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"lastTriggeredAt": "2023-11-07T05:31:56Z",
"windowMinutes": 10
}{
"code": "INSUFFICIENT_PROJECT_BALANCE",
"message": "<string>",
"requested": 123,
"shortfall": 123
}Jobs
Launch a job
Runs the selected queries, or all of them, on the chosen models, and charges the credits. A second launch within 10 minutes answers 409 RECENT_JOB_EXISTS unless force is true.
POST
/
api
/
v2
/
projects
/
{projectId}
/
jobs
Launch a job
curl --request POST \
--url https://api.mentionlab.io/api/v2/projects/{projectId}/jobs \
--header 'Content-Type: application/json' \
--header 'x-project-id: <x-project-id>' \
--data '
{
"models": [
"scp-ml-chatgpt",
"claude-haiku-latest"
],
"executionCount": 3,
"force": true
}
'import requests
url = "https://api.mentionlab.io/api/v2/projects/{projectId}/jobs"
payload = {
"models": ["scp-ml-chatgpt", "claude-haiku-latest"],
"executionCount": 3,
"force": True
}
headers = {
"x-project-id": "<x-project-id>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'x-project-id': '<x-project-id>', 'Content-Type': 'application/json'},
body: JSON.stringify({
models: ['scp-ml-chatgpt', 'claude-haiku-latest'],
executionCount: 3,
force: true
})
};
fetch('https://api.mentionlab.io/api/v2/projects/{projectId}/jobs', 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://api.mentionlab.io/api/v2/projects/{projectId}/jobs",
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([
'models' => [
'scp-ml-chatgpt',
'claude-haiku-latest'
],
'executionCount' => 3,
'force' => true
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-project-id: <x-project-id>"
],
]);
$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://api.mentionlab.io/api/v2/projects/{projectId}/jobs"
payload := strings.NewReader("{\n \"models\": [\n \"scp-ml-chatgpt\",\n \"claude-haiku-latest\"\n ],\n \"executionCount\": 3,\n \"force\": true\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-project-id", "<x-project-id>")
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://api.mentionlab.io/api/v2/projects/{projectId}/jobs")
.header("x-project-id", "<x-project-id>")
.header("Content-Type", "application/json")
.body("{\n \"models\": [\n \"scp-ml-chatgpt\",\n \"claude-haiku-latest\"\n ],\n \"executionCount\": 3,\n \"force\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.mentionlab.io/api/v2/projects/{projectId}/jobs")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-project-id"] = '<x-project-id>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"models\": [\n \"scp-ml-chatgpt\",\n \"claude-haiku-latest\"\n ],\n \"executionCount\": 3,\n \"force\": true\n}"
response = http.request(request)
puts response.read_body{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"status": "pending",
"createdBy": {
"id": "9f1c2d3e-4a5b-4c6d-8e7f-0a1b2c3d4e5f",
"firstName": "Ada",
"lastName": "Lovelace",
"email": "[email protected]"
},
"scheduleId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"spentCredits": 123,
"totalExecutionCount": 123,
"pendingExecutionCount": 123,
"retryingExecutionCount": 123,
"succeededExecutionCount": 123,
"failedExecutionCount": 123,
"themeAnalysis": "done",
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z"
}{
"statusCode": 400,
"message": "Validation failed",
"error": "Bad Request"
}{
"statusCode": 400,
"message": "Validation failed",
"error": "Bad Request"
}{
"statusCode": 400,
"message": "Validation failed",
"error": "Bad Request"
}{
"code": "RECENT_JOB_EXISTS",
"message": "<string>",
"jobId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"lastTriggeredAt": "2023-11-07T05:31:56Z",
"windowMinutes": 10
}{
"code": "INSUFFICIENT_PROJECT_BALANCE",
"message": "<string>",
"requested": 123,
"shortfall": 123
}Body
application/json
Response
The job. The body is empty when the selection, or the project, holds no query: nothing runs and nothing is charged.