---
title: Extract Sitemap from URL API
slug: extract-sitemap-from-url-api
url: https://apyhub.com/apyhub/service/extract-sitemap-from-url-api
provider: ApyHub
categories: [Data Extraction, Developer Tools, SEO]
tags: [sitemap, url-extraction, seo, website-crawling, xml-parsing]
auth: api_key
version: 1.0.0
service_type: sync
endpoints: 2
atoms: 1-50
mcp: true
---

# Extract Sitemap from URL API

Extract URLs from a website's sitemaps, with optional sitemap metadata and async job polling. Built for SEO audits, crawl seeds, and inventory.

## Endpoints

| Method | URL | Description | Atoms |
| --- | --- | --- | --- |
| POST | `https://api.eu.apyhub.com/apyhub/extract-sitemap-from-url-api/extract` | What it does Extracts all URLs discovered from a website’s sitemaps. It accepts either a website UR… | 50 |
| GET | `https://api.eu.apyhub.com/apyhub/extract-sitemap-from-url-api/jobs/:jobId` | What it does Polls the status of a sitemap extraction job using the jobId in the path. The success… | 1 |

## Endpoint reference

### Extract all URLs from a website's sitemaps

`POST https://api.eu.apyhub.com/apyhub/extract-sitemap-from-url-api/extract` · 50 atoms · accepts `application/json` · returns `application/json`

| Parameter | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `url` | body | string (uri) | yes | Website URL or direct sitemap URL. If the path ends in .xml, .xml.gz, or contains "sitemap" it is used directly; otherwise robots.txt is consulted and /sitemap.xml is tried as a fallback. Example: `h… |
| `mode` | query | string | no | One of: async. |
| `maxUrls` | query | integer | no |  |
| `includeMetadata` | query | string | no | One of: true, 1. |

#### Quickstart

Fetch URLs from a sitemap or website by sending the target URL in a JSON body.

```bash
curl -X POST "https://api.eu.apyhub.com/apyhub/extract-sitemap-from-url-api/extract" \
  -H "apy-token: $APY_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"url":"https://apyhub.com"}'
```

#### What you'll get back

Returns a JSON object with `success` and `data` fields. On a completed extraction, `data` contains the extracted URLs plus optional metadata and summary information; in async mode, `data` contains a `jobId`, `status`, and `message`.

```json
{
  "success": true,
  "data": {
    "urls": ["https://example.com/page-one"],
    "partial": false
  }
}
```

### Poll sitemap extraction job status

`GET https://api.eu.apyhub.com/apyhub/extract-sitemap-from-url-api/jobs/:jobId` · 1 atoms · accepts `application/json` · returns `application/json`

| Parameter | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `jobId` | path | string | yes |  |

#### Quickstart

Fetch the status for a sitemap extraction job by replacing `jobId` in the path.

```bash
curl -X GET "https://api.eu.apyhub.com/apyhub/extract-sitemap-from-url-api/jobs/:jobId" \
  -H "apy-token: $APY_TOKEN"
```

#### What you'll get back

Returns a JSON object with `success` and `data` fields. `success` is a boolean, and `data` is an object whose shape depends on the job status: it may include `jobId`, `status`, and either `message` for `pending`/`running`, or `urls` and related result fields for `done`, or `error` for `failed`.

```json
{
  "success": true,
  "data": {
    "jobId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
    "status": "pending",
    "message": "Job is still processing"
  }
}
```

## About

## What it does
Sitemap Extractor finds and returns the URLs exposed by a website’s sitemap files. Send a website URL or a direct sitemap URL, and it will resolve the sitemap source, process sitemap indexes and nested sitemaps, and give you back the collected URLs.

Use it when you need a crawl seed list, want to audit what a site exposes to search engines, or need to compare sitemap coverage against live pages. The request accepts a `url` in the body, with optional `mode=async`, `maxUrls`, and `includeMetadata`. If you pass `includeMetadata`, the response can include each URL with `lastmod`, `priority`, and `changefreq`; otherwise you get plain URL strings.

The response also includes extraction metadata such as the source URL, how the sitemap was discovered, processed sitemap lists, and a summary with counts like `uniqueUrls`, `totalUrlsFound`, `duplicatesRemoved`, and whether a limit was reached. If extraction is running asynchronously, the initial response gives you a `jobId`, and you can poll the job endpoint until it returns `done` or `failed`.

Sitemap Extractor is a good fit for SEO tools, site monitoring, content inventory, and any workflow that needs a structured list of URLs from one site.

## Usage

Base URL: `https://api.eu.apyhub.com` (default region — see
`GET https://apyhub.com/api/public/regions` for the rest).

Authenticate with an ApyHub API key in the `apy-token` header.
Full docs and a live playground: https://apyhub.com/apyhub/service/extract-sitemap-from-url-api
