Skip to main content
POST
/
session
/
create
JavaScript
import Tembo from '@tembo-io/sdk';

const client = new Tembo({
  apiKey: 'My API Key',
});

const session = await client.session.create({
  prompt: 'Fix the authentication bug in the login component',
  agent: 'claudeCode:claude-opus-4-5',
  repositories: [
    'https://github.com/org/repo',
    'https://gitlab.com/org/repo-2',
  ],
  targetBranch: 'dev',
  branchName: "cooper-is-awesome",
});

console.log(session.id);
curl --request POST \
--url https://api.tembo.io/session/create \
--header 'Content-Type: application/json' \
--data '
{
"prompt": "Fix the authentication bug in the login component",
"description": "Users are reporting they cannot log in. JWT token validation appears to be failing.",
"agent": "claudeCode:claude-opus-4-5",
"repositories": [
"https://github.com/org/repo",
"https://gitlab.com/org/repo-2"
],
"codeRepoIds": [
"cbad4334-c844-4fef-a8da-d08f209f267e",
"6307d53a-b99d-4e90-ab89-f29114f33d53"
],
"targetBranch": "main",
"branchName": "feature/auth-fix",
"queueRightAway": false
}
'
import requests

url = "https://api.tembo.io/session/create"

payload = {
"prompt": "Fix the authentication bug in the login component",
"description": "Users are reporting they cannot log in. JWT token validation appears to be failing.",
"agent": "claudeCode:claude-opus-4-5",
"repositories": ["https://github.com/org/repo", "https://gitlab.com/org/repo-2"],
"codeRepoIds": ["cbad4334-c844-4fef-a8da-d08f209f267e", "6307d53a-b99d-4e90-ab89-f29114f33d53"],
"targetBranch": "main",
"branchName": "feature/auth-fix",
"queueRightAway": False
}
headers = {"Content-Type": "application/json"}

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

print(response.text)
<?php

$curl = curl_init();

curl_setopt_array($curl, [
CURLOPT_URL => "https://api.tembo.io/session/create",
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([
'prompt' => 'Fix the authentication bug in the login component',
'description' => 'Users are reporting they cannot log in. JWT token validation appears to be failing.',
'agent' => 'claudeCode:claude-opus-4-5',
'repositories' => [
'https://github.com/org/repo',
'https://gitlab.com/org/repo-2'
],
'codeRepoIds' => [
'cbad4334-c844-4fef-a8da-d08f209f267e',
'6307d53a-b99d-4e90-ab89-f29114f33d53'
],
'targetBranch' => 'main',
'branchName' => 'feature/auth-fix',
'queueRightAway' => false
]),
CURLOPT_HTTPHEADER => [
"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://api.tembo.io/session/create"

payload := strings.NewReader("{\n \"prompt\": \"Fix the authentication bug in the login component\",\n \"description\": \"Users are reporting they cannot log in. JWT token validation appears to be failing.\",\n \"agent\": \"claudeCode:claude-opus-4-5\",\n \"repositories\": [\n \"https://github.com/org/repo\",\n \"https://gitlab.com/org/repo-2\"\n ],\n \"codeRepoIds\": [\n \"cbad4334-c844-4fef-a8da-d08f209f267e\",\n \"6307d53a-b99d-4e90-ab89-f29114f33d53\"\n ],\n \"targetBranch\": \"main\",\n \"branchName\": \"feature/auth-fix\",\n \"queueRightAway\": false\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(string(body))

}
HttpResponse<String> response = Unirest.post("https://api.tembo.io/session/create")
.header("Content-Type", "application/json")
.body("{\n \"prompt\": \"Fix the authentication bug in the login component\",\n \"description\": \"Users are reporting they cannot log in. JWT token validation appears to be failing.\",\n \"agent\": \"claudeCode:claude-opus-4-5\",\n \"repositories\": [\n \"https://github.com/org/repo\",\n \"https://gitlab.com/org/repo-2\"\n ],\n \"codeRepoIds\": [\n \"cbad4334-c844-4fef-a8da-d08f209f267e\",\n \"6307d53a-b99d-4e90-ab89-f29114f33d53\"\n ],\n \"targetBranch\": \"main\",\n \"branchName\": \"feature/auth-fix\",\n \"queueRightAway\": false\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://api.tembo.io/session/create")

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 \"prompt\": \"Fix the authentication bug in the login component\",\n \"description\": \"Users are reporting they cannot log in. JWT token validation appears to be failing.\",\n \"agent\": \"claudeCode:claude-opus-4-5\",\n \"repositories\": [\n \"https://github.com/org/repo\",\n \"https://gitlab.com/org/repo-2\"\n ],\n \"codeRepoIds\": [\n \"cbad4334-c844-4fef-a8da-d08f209f267e\",\n \"6307d53a-b99d-4e90-ab89-f29114f33d53\"\n ],\n \"targetBranch\": \"main\",\n \"branchName\": \"feature/auth-fix\",\n \"queueRightAway\": false\n}"

response = http.request(request)
puts response.read_body
{
  "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
  "title": "<string>",
  "description": "<string>",
  "status": "<string>",
  "createdAt": "2023-11-07T05:31:56Z",
  "updatedAt": "2023-11-07T05:31:56Z",
  "organizationId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
  "htmlUrl": "https://app.tembo.io/sessions/123e4567-e89b-12d3-a456-426614174000"
}
{
"error": "<string>"
}
{
"error": "<string>"
}

Body

application/json

Session creation payload

prompt
string
required

Description of the session to be performed. Supports tagging files.

Minimum string length: 1
Example:

"Fix the authentication bug in the login component"

description
string

Detailed description of the session (alternative to prompt)

Minimum string length: 1
Example:

"Users are reporting they cannot log in. JWT token validation appears to be failing."

agent
string

The agent to use for this session

Example:

"claudeCode:claude-opus-4-5"

repositories
string[]

Array of code repository urls that this session relates to

Example:
[
"https://github.com/org/repo",
"https://gitlab.com/org/repo-2"
]
codeRepoIds
string[]

Array of Tembo code repository IDs to target directly

Example:
[
"cbad4334-c844-4fef-a8da-d08f209f267e",
"6307d53a-b99d-4e90-ab89-f29114f33d53"
]
targetBranch
string | null

The branch to open the pull request against (e.g. main, develop)

Example:

"main"

branchName
string | null

The branch name to use for the work

Example:

"feature/auth-fix"

queueRightAway
boolean | null
default:true

Whether to immediately queue the session for processing (optional, defaults to true)

Example:

false

Response

Session created successfully

id
string<uuid>
required
title
string
required
description
string
required
status
string
required
createdAt
string<date-time>
required
updatedAt
string<date-time>
required
organizationId
string<uuid>
required
htmlUrl
string<uri>
required

URL to view this session in the Tembo web application

Example:

"https://app.tembo.io/sessions/123e4567-e89b-12d3-a456-426614174000"