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

# Create a knowledge source

POST https://example.ada.support/api/v2/knowledge/sources/
Content-Type: application/json

Create a knowledge source

Reference: https://docs.ada.cx/reference/knowledge/sources/create

## Authentication

- `Authorization` header (bearer token, required) — Bearer authentication of the form `Bearer <token>`, where token is your auth token.

## Request

### Body (application/json)

This endpoint expects a KnowledgeSourceCreateRequest.

- `id` (string, required) — A unique identifier for the knowledge source
- `name` (string, required) — The name of the knowledge source
- `metadata` (KnowledgeSourceCreateRequestMetadata, optional, nullable) — A dictionary of arbitrary key,value pairs. This data is not used by Ada, but can be used by the client to store additional information about the knowledge source.

## Response

### 200

Knowledge source created

- `id` (string, required) — A unique identifier for the knowledge source
- `name` (string, required) — The name of the knowledge source
- `external_id` (string, optional, nullable) — An external identifier for the knowledge source
- `metadata` (KnowledgeSourceResponseMetadata, optional, nullable) — A dictionary of arbitrary key,value pairs. This data is not used by Ada, but can be used by the client to store additional information about the knowledge source.
- `created` (string, optional) — The date the knowledge source was created
- `updated` (string, optional) — The date the knowledge source was last updated
- `last_sync` (string, optional) — The date the knowledge source was last synchronized
- `status` (enum, optional) — Deletion lifecycle status of the knowledge source: `deleting` while an asynchronous deletion is in progress, `delete_failed` if the deletion failed. `null` when no deletion is in progress.
  - Allowed values: `deleting`, `delete_failed`

## Errors

### 400 Bad Request Error

Bad Request

- `errors` (list of ErrorsErrorsItems, required) — A list of errors

### 401 Unauthorized Error

Unauthorized

- `errors` (list of ErrorsErrorsItems, required) — A list of errors

### 409 Conflict Error

Duplicate Resource

- `errors` (list of ErrorsErrorsItems, required) — A list of errors

### 429 Too Many Requests Error

Too Many Requests

- `errors` (list of ErrorsErrorsItems, required) — A list of errors

### 500 Internal Server Error

Internal Server Error

- `errors` (list of ErrorsErrorsItems, required) — A list of errors

## Types

### KnowledgeSourceCreateRequestMetadata

A dictionary of arbitrary key,value pairs. This data is not used by Ada, but can be used by the client to store additional information about the knowledge source.

### KnowledgeSourceResponseMetadata

A dictionary of arbitrary key,value pairs. This data is not used by Ada, but can be used by the client to store additional information about the knowledge source.

### ErrorsErrorsItems

- `type` (string, required) — The error type
- `message` (string, required) — The error message
- `details` (string, optional, nullable) — Extra information about the error

## Examples

**Request**

```json
{
  "id": "5df263b7db5a7e6ea03fae9b",
  "name": "Ada Knowledge Base"
}
```

**Response**

```json
{
  "id": "5df263b7db5a7e6ea03fae9b",
  "name": "Ada Knowledge Base",
  "external_id": "external_id_1",
  "metadata": {
    "example_key1": "example_string_value",
    "example_key2": true,
    "example_key3": 123
  },
  "created": "2020-09-20T00:00:00+00:00",
  "updated": "2020-09-20T00:00:00+00:00",
  "last_sync": "2020-09-20T00:00:00+00:00",
  "status": "deleting"
}
```

**SDK Code**

```python
import requests

url = "https://example.ada.support/api/v2/knowledge/sources/"

payload = {
    "id": "5df263b7db5a7e6ea03fae9b",
    "name": "Ada Knowledge Base"
}
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

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

print(response.json())
```

```javascript
const url = 'https://example.ada.support/api/v2/knowledge/sources/';
const options = {
  method: 'POST',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: '{"id":"5df263b7db5a7e6ea03fae9b","name":"Ada Knowledge Base"}'
};

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://example.ada.support/api/v2/knowledge/sources/"

	payload := strings.NewReader("{\n  \"id\": \"5df263b7db5a7e6ea03fae9b\",\n  \"name\": \"Ada Knowledge Base\"\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(res)
	fmt.Println(string(body))

}
```

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

url = URI("https://example.ada.support/api/v2/knowledge/sources/")

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  \"id\": \"5df263b7db5a7e6ea03fae9b\",\n  \"name\": \"Ada Knowledge Base\"\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://example.ada.support/api/v2/knowledge/sources/")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"id\": \"5df263b7db5a7e6ea03fae9b\",\n  \"name\": \"Ada Knowledge Base\"\n}")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://example.ada.support/api/v2/knowledge/sources/', [
  'body' => '{
  "id": "5df263b7db5a7e6ea03fae9b",
  "name": "Ada Knowledge Base"
}',
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
  ],
]);

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

```csharp
using RestSharp;

var client = new RestClient("https://example.ada.support/api/v2/knowledge/sources/");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"id\": \"5df263b7db5a7e6ea03fae9b\",\n  \"name\": \"Ada Knowledge Base\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = [
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
]
let parameters = [
  "id": "5df263b7db5a7e6ea03fae9b",
  "name": "Ada Knowledge Base"
] as [String : Any]

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

let request = NSMutableURLRequest(url: NSURL(string: "https://example.ada.support/api/v2/knowledge/sources/")! 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()
```