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

# Extract knowledge from URL

POST https://api.youratlas.com/v1/api/knowledgebase/knowledge-extract
Content-Type: application/json

Extracts content from a web page and converts it to a `.md` knowledge file.

**Single-page mode** (default): scrapes one page synchronously (3-5 seconds) and returns
the result directly with a `201` response.

**Multi-page crawl mode** (`crawl: true`): discovers and scrapes up to `maxPages` pages
from the same domain asynchronously. Returns a `202` response with a `jobId` immediately.
Poll `GET /knowledgebase/knowledge-extract/jobs/{jobId}` for progress.

The scraper captures visible text; JavaScript-heavy SPAs may return limited content.
After extraction, attach the file to a campaign using `POST /knowledgebase/{campaignId}/{id}`.

Reference: https://docs.youratlas.com/api-reference/atlas-api/knowledge-base/upload-knowledge-url

## Authentication

- `api-key` header (required) — Your Atlas API key. Get it from the Atlas Portal under Settings > API Keys.

## Request

### Body (application/json)

This endpoint expects an object.

- `url` (string, required) — The web page URL to extract content from.
- `campaignId` (string, optional) — Optional campaign to attach the extracted file to.
- `crawl` (boolean, optional, default: false) — When `true`, performs a multi-page domain crawl instead of single-page extraction. The response changes to `202` with a `jobId` for polling.
- `maxPages` (integer, optional, default: 20) — Maximum number of pages to crawl when `crawl` is `true`. Ignored for single-page extraction.
- `keepUpToDate` (boolean, optional, default: false) — When `true`, enables periodic automatic re-extraction of the URL to keep the knowledge file fresh.

## Response

### 201

Knowledge extracted (single-page mode)

- `filePath` (string, optional)
- `filename` (string, optional)
- `knowledgeId` (string, optional) — Atlas file identifier for the extracted knowledge.

### 202

Crawl accepted (multi-page mode). Poll the job endpoint for status.

- `jobId` (string, optional) — Unique identifier for the crawl job.
- `status` (enum, optional) — Current job state. `pending` = queued, `indexing` = pages discovered and being processed, `complete` = done, `failed` = error occurred.
  - Allowed values: `pending`, `indexing`, `complete`, `failed`
- `url` (string, optional) — The URL being crawled.
- `filename` (string, optional) — Blob filename for the extracted knowledge file.
- `knowledgeId` (string, optional) — Atlas file identifier. Present only when status is `complete`.
- `reason` (string, optional) — Human-readable failure reason. Present only when status is `failed`.

## Errors

### 400 Bad Request Error

Bad request

- `error` (ErrorError, optional)

### 409 Conflict Error

A crawl for this URL is already in progress.

- `message` (string, optional)
- `jobId` (string, optional)
- `status` (enum, optional)
  - Allowed values: `pending`

### 500 Internal Server Error

Internal server error

- `error` (ErrorError, optional)

## Types

### ErrorError

- `message` (string, optional)
- `code` (string, optional)
- `requestId` (string, optional)

## Examples

### Example 1

**Request**

```json
{
  "url": "string"
}
```

**Response**

```json
{
  "filePath": "string",
  "filename": "string",
  "knowledgeId": "string"
}
```

**SDK Code**

```python
import requests

url = "https://api.youratlas.com/v1/api/knowledgebase/knowledge-extract"

payload = { "url": "string" }
headers = {
    "api-key": "<apiKey>",
    "Content-Type": "application/json"
}

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

print(response.json())
```

```javascript
const url = 'https://api.youratlas.com/v1/api/knowledgebase/knowledge-extract';
const options = {
  method: 'POST',
  headers: {'api-key': '<apiKey>', 'Content-Type': 'application/json'},
  body: '{"url":"string"}'
};

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://api.youratlas.com/v1/api/knowledgebase/knowledge-extract"

	payload := strings.NewReader("{\n  \"url\": \"string\"\n}")

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

	req.Header.Add("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://api.youratlas.com/v1/api/knowledgebase/knowledge-extract")

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

request = Net::HTTP::Post.new(url)
request["api-key"] = '<apiKey>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"url\": \"string\"\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://api.youratlas.com/v1/api/knowledgebase/knowledge-extract")
  .header("api-key", "<apiKey>")
  .header("Content-Type", "application/json")
  .body("{\n  \"url\": \"string\"\n}")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.youratlas.com/v1/api/knowledgebase/knowledge-extract', [
  'body' => '{
  "url": "string"
}',
  'headers' => [
    'Content-Type' => 'application/json',
    'api-key' => '<apiKey>',
  ],
]);

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

```csharp
using RestSharp;

var client = new RestClient("https://api.youratlas.com/v1/api/knowledgebase/knowledge-extract");
var request = new RestRequest(Method.POST);
request.AddHeader("api-key", "<apiKey>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"url\": \"string\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = [
  "api-key": "<apiKey>",
  "Content-Type": "application/json"
]
let parameters = ["url": "string"] as [String : Any]

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

let request = NSMutableURLRequest(url: NSURL(string: "https://api.youratlas.com/v1/api/knowledgebase/knowledge-extract")! 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()
```

### Example 2

**Request**

```json
{
  "url": "string"
}
```

**Response**

```json
{
  "filePath": "string",
  "filename": "string",
  "knowledgeId": "string"
}
```

**SDK Code**

```python
import requests

url = "https://api.youratlas.com/v1/api/knowledgebase/knowledge-extract"

payload = { "url": "string" }
headers = {
    "api-key": "<apiKey>",
    "Content-Type": "application/json"
}

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

print(response.json())
```

```javascript
const url = 'https://api.youratlas.com/v1/api/knowledgebase/knowledge-extract';
const options = {
  method: 'POST',
  headers: {'api-key': '<apiKey>', 'Content-Type': 'application/json'},
  body: '{"url":"string"}'
};

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://api.youratlas.com/v1/api/knowledgebase/knowledge-extract"

	payload := strings.NewReader("{\n  \"url\": \"string\"\n}")

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

	req.Header.Add("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://api.youratlas.com/v1/api/knowledgebase/knowledge-extract")

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

request = Net::HTTP::Post.new(url)
request["api-key"] = '<apiKey>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"url\": \"string\"\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://api.youratlas.com/v1/api/knowledgebase/knowledge-extract")
  .header("api-key", "<apiKey>")
  .header("Content-Type", "application/json")
  .body("{\n  \"url\": \"string\"\n}")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.youratlas.com/v1/api/knowledgebase/knowledge-extract', [
  'body' => '{
  "url": "string"
}',
  'headers' => [
    'Content-Type' => 'application/json',
    'api-key' => '<apiKey>',
  ],
]);

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

```csharp
using RestSharp;

var client = new RestClient("https://api.youratlas.com/v1/api/knowledgebase/knowledge-extract");
var request = new RestRequest(Method.POST);
request.AddHeader("api-key", "<apiKey>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"url\": \"string\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = [
  "api-key": "<apiKey>",
  "Content-Type": "application/json"
]
let parameters = ["url": "string"] as [String : Any]

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

let request = NSMutableURLRequest(url: NSURL(string: "https://api.youratlas.com/v1/api/knowledgebase/knowledge-extract")! 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()
```