Returns the content of the web pages
curl --request POST \
--url https://ydc-index.io/v1/contents \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <api-key>' \
--data '
{
"urls": [
"https://www.you.com"
],
"format": "html"
}
'import requests
url = "https://ydc-index.io/v1/contents"
payload = {
"urls": ["https://www.you.com"],
"format": "html"
}
headers = {
"X-API-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-API-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({urls: ['https://www.you.com'], format: 'html'})
};
fetch('https://ydc-index.io/v1/contents', 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://ydc-index.io/v1/contents",
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([
'urls' => [
'https://www.you.com'
],
'format' => 'html'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-API-Key: <api-key>"
],
]);
$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://ydc-index.io/v1/contents"
payload := strings.NewReader("{\n \"urls\": [\n \"https://www.you.com\"\n ],\n \"format\": \"html\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-API-Key", "<api-key>")
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://ydc-index.io/v1/contents")
.header("X-API-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"urls\": [\n \"https://www.you.com\"\n ],\n \"format\": \"html\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://ydc-index.io/v1/contents")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-API-Key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"urls\": [\n \"https://www.you.com\"\n ],\n \"format\": \"html\"\n}"
response = http.request(request)
puts response.read_body[
{
"url": "https://www.you.com",
"title": "The best website in the world",
"html": "<string>",
"markdown": "<string>"
}
]API Reference
Contents
POST
/
v1
/
contents
Returns the content of the web pages
curl --request POST \
--url https://ydc-index.io/v1/contents \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <api-key>' \
--data '
{
"urls": [
"https://www.you.com"
],
"format": "html"
}
'import requests
url = "https://ydc-index.io/v1/contents"
payload = {
"urls": ["https://www.you.com"],
"format": "html"
}
headers = {
"X-API-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-API-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({urls: ['https://www.you.com'], format: 'html'})
};
fetch('https://ydc-index.io/v1/contents', 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://ydc-index.io/v1/contents",
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([
'urls' => [
'https://www.you.com'
],
'format' => 'html'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-API-Key: <api-key>"
],
]);
$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://ydc-index.io/v1/contents"
payload := strings.NewReader("{\n \"urls\": [\n \"https://www.you.com\"\n ],\n \"format\": \"html\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-API-Key", "<api-key>")
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://ydc-index.io/v1/contents")
.header("X-API-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"urls\": [\n \"https://www.you.com\"\n ],\n \"format\": \"html\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://ydc-index.io/v1/contents")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-API-Key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"urls\": [\n \"https://www.you.com\"\n ],\n \"format\": \"html\"\n}"
response = http.request(request)
puts response.read_body[
{
"url": "https://www.you.com",
"title": "The best website in the world",
"html": "<string>",
"markdown": "<string>"
}
]Description
This endpoint returns the HTML or Markdown of a target webpage.Authorizations
The unique API Key required to authorize API access. Learn how to get yours in the “Get your API key” section of the documentation.
Body
application/json
Response
An array of JSON objects containing the page content of each web page