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

# Create job agent

POST https://v1.getraya.app/api/job-agent
Content-Type: application/json

Creates a new job agent. Required: name, type (hr_pre_screening | hr_mock_interview | hr_interview). Optional: template fields (agent_role, introduction, about_job, about_company, closing_message, questions), output_fields, output_instructions, generate_from_jd_text (JD text to generate template content), out_did. Returns full job agent details including in_did and out_did.

Reference: https://docs.getraya.app/api-reference/job-agents/create-job-agent

## Authentication

- `X-API-Key` header (required) — API key for authentication. Example: raya_ABCD1234567890abcdef

## Request

### Body (application/json)

This endpoint expects a CreateJobAgentRequest.

- `name` (string, required) — Job agent name (required)
- `type` (enum, required) — Job agent template type
  - Allowed values: `hr_pre_screening`, `hr_mock_interview`, `hr_interview`
- `agent_role` (string, optional) — Agent role: how the voice agent should behave (e.g. prescreening interviewer). Not the job/position title.
- `introduction` (string, optional) — Introduction text
- `about_job` (string, optional) — About the job
- `about_company` (string, optional) — About the company
- `extra_instructions` (string, optional) — Extra instructions
- `closing_message` (string, optional) — Closing message
- `questions` (list of string, optional) — Interview questions
- `output_fields` (list of CreateJobAgentRequestOutputFieldsItems, optional) — Array of key-description pairs. Each item has key and description only (no extra properties).
- `output_instructions` (string, optional) — Instructions for how to populate output_fields after a call.
- `generate_from_jd_text` (string, optional) — Optional job description (JD) text. When provided, the API generates template content (agent_role, introduction, about_job, etc.) and merges with any fields you supplied.
- `webhook_url` (string, optional, nullable)
- `required_silence_after_speech` (double, optional, nullable)
- `allowed_silence_before_nudge` (integer, optional, nullable)
- `allowed_speech_before_nudge` (integer, optional, nullable)
- `out_did` (double, optional, nullable) — Outbound DID. If omitted, first DID from customer is used.
- `allow_call_transfer` (boolean, optional) — India only. When true, live call transfer to a human is allowed.
- `transfer_destination_phone` (string, optional, nullable) — India mobile (10 digits, no +91). Null or omit if not using transfer.

## Response

### 201

Job agent created successfully

- `uuid` (string, optional) — Unique identifier of the agent
- `name` (string, optional) — Name of the agent
- `agent_role` (string, optional) — Agent role: how the voice agent should behave (e.g. prescreening interviewer). Distinct from job role (the position being hired for).
- `introduction` (string, optional) — Introduction
- `about_job` (string, optional) — About job
- `about_company` (string, optional) — About company
- `extra_instructions` (string, optional) — Extra instructions
- `output_instructions` (string, optional) — Instructions for how to populate output_fields after a call.
- `closing_message` (string, optional) — Closing message
- `questions` (list of string, optional) — Questions
- `output_fields` (list of JobAgentDetailsResponseOutputFieldsItems, optional) — Array of key-description pairs. Each item has key and description only (no extra properties).
- `agent_args` (map from string to any, optional) — Agent arguments as a JSON object (e.g. \{"contact\_name": "John", "order\_id": "123"}). Not an array.
- `required_silence_after_speech` (double, optional, nullable) — Required silence after speech in seconds
- `allowed_silence_before_nudge` (double, optional, nullable) — Allowed silence before nudge in seconds
- `allowed_speech_before_nudge` (double, optional, nullable) — Allowed speech before nudge in seconds
- `out_did` (double, optional, nullable) — Outbound DID number
- `in_did` (double, optional, nullable) — Inbound DID number (read-only; for reference)
- `webhook_url` (string, optional, nullable) — Webhook URL for callbacks (sent on call completed or call failure). See [Webhooks](/voice-agents/core-concepts#webhooks) for payload format.
- `allow_call_transfer` (boolean, optional) — India only. When true, live call transfer to a human is allowed.
- `transfer_destination_phone` (string, optional, nullable) — India mobile (10 digits, no +91). Null if unused.

## Errors

### 400 Bad Request Error

Validation error or bad request

- `error` (string, optional)
- `message` (string, optional)

### 401 Unauthorized Error

Unauthorized

- `error` (string, optional)
- `message` (string, optional)

### 500 Internal Server Error

Internal server error

- `error` (string, optional)
- `message` (string, optional)

### 502 Bad Gateway Error

Job description could not be processed (e.g. generate_from_jd_text provided but external service unavailable)

- `error` (string, optional)
- `message` (string, optional)

## Types

### CreateJobAgentRequestOutputFieldsItems

- `key` (string, required)
- `description` (string, optional, default: )

### JobAgentDetailsResponseOutputFieldsItems

- `key` (string, required) — Field name (e.g. current_ctc)
- `description` (string, optional, default: ) — Description of what to extract

## Examples

**Request**

```json
{
  "name": "Senior Python Developer Prescreening",
  "type": "hr_pre_screening"
}
```

**Response**

```json
{
  "uuid": "123e4567-e89b-12d3-a456-426614174000",
  "name": "Senior Python Developer",
  "agent_role": "HR Prescreening Agent for Senior Python Developer Position",
  "introduction": "Hello! Thank you for your interest in our Senior Python Developer position. I'm calling to conduct a brief prescreening interview to learn more about your background and experience.",
  "about_job": "We are looking for a Senior Python Developer with 5+ years of experience in Python development, experience with Django or Flask frameworks, and strong knowledge of database systems. The role involves building scalable backend systems and working with microservices architecture.",
  "about_company": "We are a fast-growing technology company specializing in cloud-based solutions. We value innovation, collaboration, and continuous learning. Our team works on cutting-edge projects that impact millions of users worldwide.",
  "extra_instructions": "Be professional and friendly. Ask follow-up questions when needed. Take notes on the candidate's responses. If the candidate seems uninterested or unavailable, politely end the call.",
  "output_instructions": "Extract all candidate information accurately. Ensure dates are in YYYY-MM-DD format. Mark availability as \"immediate\", \"2 weeks\", \"1 month\", or \"negotiable\".",
  "closing_message": "Thank you for taking the time to speak with me today. Our hiring team will review your information and get back to you within the next few business days. Have a great day!",
  "questions": [
    "How many years of experience do you have with Python?",
    "What Python frameworks have you worked with?",
    "Do you have experience with Django or Flask?",
    "What is your current notice period?",
    "What is your expected salary range?",
    "Are you available for a technical interview next week?"
  ],
  "output_fields": [
    {
      "key": "current_ctc",
      "description": "Numeric only"
    },
    {
      "key": "notice_period",
      "description": "in days"
    }
  ],
  "agent_args": {},
  "required_silence_after_speech": 0.4,
  "allowed_silence_before_nudge": 20,
  "allowed_speech_before_nudge": 30,
  "out_did": 918040582331,
  "in_did": 918040582331,
  "webhook_url": "https://example.com/webhook",
  "allow_call_transfer": true,
  "transfer_destination_phone": "9876543210"
}
```

**SDK Code**

```python
import requests

url = "https://v1.getraya.app/api/job-agent"

payload = {
    "name": "Senior Python Developer Prescreening",
    "type": "hr_pre_screening"
}
headers = {
    "X-API-Key": "<apiKey>",
    "Content-Type": "application/json"
}

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

print(response.json())
```

```javascript
const url = 'https://v1.getraya.app/api/job-agent';
const options = {
  method: 'POST',
  headers: {'X-API-Key': '<apiKey>', 'Content-Type': 'application/json'},
  body: '{"name":"Senior Python Developer Prescreening","type":"hr_pre_screening"}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go
package main

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

func main() {

	url := "https://v1.getraya.app/api/job-agent"

	payload := strings.NewReader("{\n  \"name\": \"Senior Python Developer Prescreening\",\n  \"type\": \"hr_pre_screening\"\n}")

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

	req.Header.Add("X-API-Key", "<apiKey>")
	req.Header.Add("Content-Type", "application/json")

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

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

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby
require 'uri'
require 'net/http'

url = URI("https://v1.getraya.app/api/job-agent")

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

request = Net::HTTP::Post.new(url)
request["X-API-Key"] = '<apiKey>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"name\": \"Senior Python Developer Prescreening\",\n  \"type\": \"hr_pre_screening\"\n}"

response = http.request(request)
puts response.read_body
```

```java
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://v1.getraya.app/api/job-agent")
  .header("X-API-Key", "<apiKey>")
  .header("Content-Type", "application/json")
  .body("{\n  \"name\": \"Senior Python Developer Prescreening\",\n  \"type\": \"hr_pre_screening\"\n}")
  .asString();
```

```php
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://v1.getraya.app/api/job-agent', [
  'body' => '{
  "name": "Senior Python Developer Prescreening",
  "type": "hr_pre_screening"
}',
  'headers' => [
    'Content-Type' => 'application/json',
    'X-API-Key' => '<apiKey>',
  ],
]);

echo $response->getBody();
```

```csharp
using RestSharp;

var client = new RestClient("https://v1.getraya.app/api/job-agent");
var request = new RestRequest(Method.POST);
request.AddHeader("X-API-Key", "<apiKey>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"name\": \"Senior Python Developer Prescreening\",\n  \"type\": \"hr_pre_screening\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = [
  "X-API-Key": "<apiKey>",
  "Content-Type": "application/json"
]
let parameters = [
  "name": "Senior Python Developer Prescreening",
  "type": "hr_pre_screening"
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://v1.getraya.app/api/job-agent")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```