curl --request POST \
--url https://api.nugen.in/api/v3/alignment-projects/create \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"alignment_name": "My Alignment Project",
"base_model_id": "Qwen/Qwen2.5-0.5B-Instruct",
"document_ids": [
"document_01k4x9m2p7q3r5s8",
"document_01k4x9m2p7q3r5s9"
],
"workflow_id": "workflow-abc123",
"benchmark_id": "benchmark_01k4x9m2p7q3r6a1",
"description": "This project aligns the model to extract and risk-flag contract clauses."
}
'import requests
url = "https://api.nugen.in/api/v3/alignment-projects/create"
payload = {
"alignment_name": "My Alignment Project",
"base_model_id": "Qwen/Qwen2.5-0.5B-Instruct",
"document_ids": ["document_01k4x9m2p7q3r5s8", "document_01k4x9m2p7q3r5s9"],
"workflow_id": "workflow-abc123",
"benchmark_id": "benchmark_01k4x9m2p7q3r6a1",
"description": "This project aligns the model to extract and risk-flag contract clauses."
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
alignment_name: 'My Alignment Project',
base_model_id: 'Qwen/Qwen2.5-0.5B-Instruct',
document_ids: ['document_01k4x9m2p7q3r5s8', 'document_01k4x9m2p7q3r5s9'],
workflow_id: 'workflow-abc123',
benchmark_id: 'benchmark_01k4x9m2p7q3r6a1',
description: 'This project aligns the model to extract and risk-flag contract clauses.'
})
};
fetch('https://api.nugen.in/api/v3/alignment-projects/create', 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.nugen.in/api/v3/alignment-projects/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([
'alignment_name' => 'My Alignment Project',
'base_model_id' => 'Qwen/Qwen2.5-0.5B-Instruct',
'document_ids' => [
'document_01k4x9m2p7q3r5s8',
'document_01k4x9m2p7q3r5s9'
],
'workflow_id' => 'workflow-abc123',
'benchmark_id' => 'benchmark_01k4x9m2p7q3r6a1',
'description' => 'This project aligns the model to extract and risk-flag contract clauses.'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"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.nugen.in/api/v3/alignment-projects/create"
payload := strings.NewReader("{\n \"alignment_name\": \"My Alignment Project\",\n \"base_model_id\": \"Qwen/Qwen2.5-0.5B-Instruct\",\n \"document_ids\": [\n \"document_01k4x9m2p7q3r5s8\",\n \"document_01k4x9m2p7q3r5s9\"\n ],\n \"workflow_id\": \"workflow-abc123\",\n \"benchmark_id\": \"benchmark_01k4x9m2p7q3r6a1\",\n \"description\": \"This project aligns the model to extract and risk-flag contract clauses.\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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.nugen.in/api/v3/alignment-projects/create")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"alignment_name\": \"My Alignment Project\",\n \"base_model_id\": \"Qwen/Qwen2.5-0.5B-Instruct\",\n \"document_ids\": [\n \"document_01k4x9m2p7q3r5s8\",\n \"document_01k4x9m2p7q3r5s9\"\n ],\n \"workflow_id\": \"workflow-abc123\",\n \"benchmark_id\": \"benchmark_01k4x9m2p7q3r6a1\",\n \"description\": \"This project aligns the model to extract and risk-flag contract clauses.\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.nugen.in/api/v3/alignment-projects/create")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"alignment_name\": \"My Alignment Project\",\n \"base_model_id\": \"Qwen/Qwen2.5-0.5B-Instruct\",\n \"document_ids\": [\n \"document_01k4x9m2p7q3r5s8\",\n \"document_01k4x9m2p7q3r5s9\"\n ],\n \"workflow_id\": \"workflow-abc123\",\n \"benchmark_id\": \"benchmark_01k4x9m2p7q3r6a1\",\n \"description\": \"This project aligns the model to extract and risk-flag contract clauses.\"\n}"
response = http.request(request)
puts response.read_body{
"alignment_id": "alignment-project-123",
"status": "PROCESSING",
"message": "Alignment already exists with the same configuration"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}Create Alignment
Create a new domain alignment workflow.
This endpoint initiates a domain alignment workflow that aligns a base model to your domain corpus using provided documents.
Request Body:
alignment_name: Name of the domain alignment projectbase_model_id: Base model to use for alignment (e.g.,Qwen/Qwen2.5-0.5B-Instruct)document_ids: List of document IDs to use for training data. Documents are snapshotted when the project is created; later edits to documents never change an existing alignmentworkflow_id(optional): Custom workflow identifierbenchmark_id(optional, recommended): When passed, your aligned model is evaluated automatically against this benchmark. Skip it to evaluate later withPOST /evaluations/create, or not at alldescription(optional): Description of the alignment project
Advanced control:
This endpoint plans the alignment for you. To steer it with your own estimates, use POST /alignment-projects/{alignment_id}/auto-align: set a target score and compute budget, and optionally a config covering reinforcement learning or supervised fine-tuning settings such as loss, LoRA rank, learning rate, gradient clipping, batch size, steps and sampling.
Importing models:
Any Hugging Face model can be imported by passing "base_model_id": "hf://<model-name>". This is an enterprise edition feature; request access or enquire through a support ticket. For security reasons, models that require custom code execution are unsupported by default; raise a support ticket to discuss your case.
Returns:
alignment_id: Unique alignment identifier for tracking workflow progressstatus: Initial workflow status (alwaysPROCESSING)
Raises:
400: If the base model does not support alignment404: If document IDs are not found or don’t belong to user
Example Request:
POST /api/v3/alignment-projects/create
Headers: {"Authorization": "Bearer <api_key>"}
{
"alignment_name": "Contract Risk Domain Alignment",
"base_model_id": "Qwen/Qwen2.5-0.5B-Instruct",
"document_ids": ["document_01k4x9m2p7q3r5se", "document_01k4x9m2p7q3r5sf", "document_01k4x9m2p7q3r5sg"],
"benchmark_id": "benchmark_01k4x9m2p7q3r6a1",
"description": "Alignment for master services agreements and addenda"
}
Example Response:
{
"alignment_id":"alignment_01k4x9m2p7q3r8c1",
"status": "PROCESSING"
}
Notes:
- Use
/alignment-projects/{id}/statusto track workflow progress - If
benchmark_idis provided, the model will be evaluated automatically after alignment - Only models that support alignment can be used.
curl --request POST \
--url https://api.nugen.in/api/v3/alignment-projects/create \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"alignment_name": "My Alignment Project",
"base_model_id": "Qwen/Qwen2.5-0.5B-Instruct",
"document_ids": [
"document_01k4x9m2p7q3r5s8",
"document_01k4x9m2p7q3r5s9"
],
"workflow_id": "workflow-abc123",
"benchmark_id": "benchmark_01k4x9m2p7q3r6a1",
"description": "This project aligns the model to extract and risk-flag contract clauses."
}
'import requests
url = "https://api.nugen.in/api/v3/alignment-projects/create"
payload = {
"alignment_name": "My Alignment Project",
"base_model_id": "Qwen/Qwen2.5-0.5B-Instruct",
"document_ids": ["document_01k4x9m2p7q3r5s8", "document_01k4x9m2p7q3r5s9"],
"workflow_id": "workflow-abc123",
"benchmark_id": "benchmark_01k4x9m2p7q3r6a1",
"description": "This project aligns the model to extract and risk-flag contract clauses."
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
alignment_name: 'My Alignment Project',
base_model_id: 'Qwen/Qwen2.5-0.5B-Instruct',
document_ids: ['document_01k4x9m2p7q3r5s8', 'document_01k4x9m2p7q3r5s9'],
workflow_id: 'workflow-abc123',
benchmark_id: 'benchmark_01k4x9m2p7q3r6a1',
description: 'This project aligns the model to extract and risk-flag contract clauses.'
})
};
fetch('https://api.nugen.in/api/v3/alignment-projects/create', 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.nugen.in/api/v3/alignment-projects/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([
'alignment_name' => 'My Alignment Project',
'base_model_id' => 'Qwen/Qwen2.5-0.5B-Instruct',
'document_ids' => [
'document_01k4x9m2p7q3r5s8',
'document_01k4x9m2p7q3r5s9'
],
'workflow_id' => 'workflow-abc123',
'benchmark_id' => 'benchmark_01k4x9m2p7q3r6a1',
'description' => 'This project aligns the model to extract and risk-flag contract clauses.'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"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.nugen.in/api/v3/alignment-projects/create"
payload := strings.NewReader("{\n \"alignment_name\": \"My Alignment Project\",\n \"base_model_id\": \"Qwen/Qwen2.5-0.5B-Instruct\",\n \"document_ids\": [\n \"document_01k4x9m2p7q3r5s8\",\n \"document_01k4x9m2p7q3r5s9\"\n ],\n \"workflow_id\": \"workflow-abc123\",\n \"benchmark_id\": \"benchmark_01k4x9m2p7q3r6a1\",\n \"description\": \"This project aligns the model to extract and risk-flag contract clauses.\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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.nugen.in/api/v3/alignment-projects/create")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"alignment_name\": \"My Alignment Project\",\n \"base_model_id\": \"Qwen/Qwen2.5-0.5B-Instruct\",\n \"document_ids\": [\n \"document_01k4x9m2p7q3r5s8\",\n \"document_01k4x9m2p7q3r5s9\"\n ],\n \"workflow_id\": \"workflow-abc123\",\n \"benchmark_id\": \"benchmark_01k4x9m2p7q3r6a1\",\n \"description\": \"This project aligns the model to extract and risk-flag contract clauses.\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.nugen.in/api/v3/alignment-projects/create")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"alignment_name\": \"My Alignment Project\",\n \"base_model_id\": \"Qwen/Qwen2.5-0.5B-Instruct\",\n \"document_ids\": [\n \"document_01k4x9m2p7q3r5s8\",\n \"document_01k4x9m2p7q3r5s9\"\n ],\n \"workflow_id\": \"workflow-abc123\",\n \"benchmark_id\": \"benchmark_01k4x9m2p7q3r6a1\",\n \"description\": \"This project aligns the model to extract and risk-flag contract clauses.\"\n}"
response = http.request(request)
puts response.read_body{
"alignment_id": "alignment-project-123",
"status": "PROCESSING",
"message": "Alignment already exists with the same configuration"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Body
Name of the domain alignment project
"My Alignment Project"
Base model that alignment will be based on
"Qwen/Qwen2.5-0.5B-Instruct"
List of document IDs to train the alignment on
[
"document_01k4x9m2p7q3r5s8",
"document_01k4x9m2p7q3r5s9"
]
This id is to orchestrate the entire flow
"workflow-abc123"
Benchmark ID for evaluation (created via /benchmarks/create or /benchmarks/upload)
"benchmark_01k4x9m2p7q3r6a1"
Optional project description
"This project aligns the model to extract and risk-flag contract clauses."
Response
Returns a unique identifier for the initiated domain alignment workflow along with the initial workflow status. This endpoint starts an asynchronous alignment run over a base model to your domain corpus using provided documents and optional benchmark evaluation, allowing users to track progress and retrieve results once completed.
Response schema for alignment project creation endpoint
Was this page helpful?