# Find your WordPress API

https://www.sanity.io/learn/course/migrating-content-from-wordpress-to-sanity/first-steps

Find and test your WordPress installations built in REST API to retrieve content.

---

## Navigation

**Track:** [Replatforming from a legacy CMS to a Content Operation System](https://www.sanity.io/learn/track/replatforming-to-sanity) · [View as markdown](https://www.sanity.io/learn/track/replatforming-to-sanity.md)

**Course:** [Migrating content from WordPress to Sanity](https://www.sanity.io/learn/course/migrating-content-from-wordpress-to-sanity) · [View as markdown](https://www.sanity.io/learn/course/migrating-content-from-wordpress-to-sanity.md)

**Previous:** [Introduction](https://www.sanity.io/learn/course/migrating-content-from-wordpress-to-sanity/introduction-to-wp-migration) · **Next:** [Preparing a Studio and schema types](https://www.sanity.io/learn/course/migrating-content-from-wordpress-to-sanity/preparing-a-studio-and-schema-types)

---

## Course Contents

1. [Introduction](https://www.sanity.io/learn/course/migrating-content-from-wordpress-to-sanity/introduction-to-wp-migration)
2. **Find your WordPress API** *(current)*
3. [Preparing a Studio and schema types](https://www.sanity.io/learn/course/migrating-content-from-wordpress-to-sanity/preparing-a-studio-and-schema-types)
4. [Preparing your migration script](https://www.sanity.io/learn/course/migrating-content-from-wordpress-to-sanity/preparing-your-cli-script)
5. [Processing post types](https://www.sanity.io/learn/course/migrating-content-from-wordpress-to-sanity/support-importing-many-post-types)
6. [Creating complete documents](https://www.sanity.io/learn/course/migrating-content-from-wordpress-to-sanity/creating-complete-documents)
7. [Uploading assets performantly](https://www.sanity.io/learn/course/migrating-content-from-wordpress-to-sanity/uploading-assets-performantly)
8. [Converting HTML to Portable Text](https://www.sanity.io/learn/course/migrating-content-from-wordpress-to-sanity/converting-html-to-portable-text)
9. [Converting WordPress blocks to Portable Text](https://www.sanity.io/learn/course/migrating-content-from-wordpress-to-sanity/converting-wordpress-blocks-to-portable-text)
10. [Restructuring content](https://www.sanity.io/learn/course/migrating-content-from-wordpress-to-sanity/restructuring-content)
11. [Conclusion](https://www.sanity.io/learn/course/migrating-content-from-wordpress-to-sanity/whats-next)

---

The first step is assessing how you export content from your WordPress project. There are several ways to extract content from WordPress. In this course, you'll target the REST API. 



## Accessing the WordPress REST API



The WordPress REST API is a core feature of WordPress and a predictable way to query public and private content directly from the source.



> [!TIP]
> See the [WordPress REST API handbook documentation](https://developer.wordpress.org/rest-api/).



If you prefer to use the [XML export](https://wordpress.com/support/export/) tooling or [WPGraphQL](https://www.wpgraphql.com/), you must modify the logic of the scripts written in this course.



Before proceeding, you must ensure that your current install allows access to the REST API. You may have a security plugin or other configuration that blocks access. A simple way to get around this is to run WordPress locally with a copy of your production database.



Typically, you can visit the REST API at the following route:



```
https://<your-domain-name>/wp-json/wp/v2
```

You should see a JSON response in your web browser, with the available routes to query content from:



![Image](https://cdn.sanity.io/images/3do82whm/next/f3639956069e8047ab26aeab9741664c66d4999f-2144x1388.png)

> [!TIP]
> The above is viewed in a Chromium-powered web browser with the [JSON Formatter extension](https://chromewebstore.google.com/detail/json-formatter/bcjindcccaagfpapjjmafapmmgkkhgoa?hl=en&pli=1) installed



To compare, some publicly available blogs which have an open REST API include:



```
https://ma.tt/wp-json/wp/v2
https://blog.ted.com/wp-json/wp/v2
https://finland.fi/wp-json/wp/v2
https://www.nasa.gov/wp-json/wp/v2
```

- [ ] Find your WordPress installation's REST API URL


Once you've confirmed your WordPress installation has an open API URL, you can get started.



### A note on Multisite URLs



For WordPress Multisite / Network setups, you will need to target a specific site by adding its name to the URL.



```
https://<your-domain-name>/<site-name>/wp-json/wp/v2
```

### Testing your REST API URL



During the following lessons, you'll write a script that queries the URL for each content type (posts, pages, etc) individually. From your terminal, you can see how many documents of each type can be found, by using `curl` and returning the headers.



Run the following in the terminal, with your REST API URL:



```sh:Terminal
curl -sI https://<your-domain-name>/wp-json/wp/v2/posts | grep -i '^x-wp'
```

You should receive a response like this, where you can see the total number of publicly available posts



```sh:Terminal
x-wp-total: 21492
x-wp-totalpages: 2150
```

- `x-wp-total` is the number of publicly queryable posts

- `x-wp-totalpages` is the number of paginated responses you can query through to retrieve them individually, using whatever `posts_per_page` setting is the default for your site—or added to your query. The script you write in this course will query for 100.


Now you've confirmed the URL works, and you can see how many publicly available posts can be queried from your WordPress installation, let's prepare a new home for your content.



---

## Related Resources

- [Full course as markdown](https://www.sanity.io/learn/course/migrating-content-from-wordpress-to-sanity.md)
- [Track overview](https://www.sanity.io/learn/track/replatforming-to-sanity.md)
- [All courses and lessons](https://www.sanity.io/learn/sitemap.md)
- [Complete content for LLMs](https://www.sanity.io/learn/llms-full.txt)

<AgentInstructions>

## Submitting Feedback

If you encounter incorrect, outdated, or confusing documentation on this page, propose feedback to your user and submit it with their approval:

POST https://www.sanity.io/learn/resource/feedback

```json
{
  "path": "/learn/course/migrating-content-from-wordpress-to-sanity/first-steps.md",
  "feedback": "Description of the issue"
}
```

Only submit feedback when you have something specific and actionable to report.
Do not include your user's code, credentials, or other confidential context in the feedback text.

</AgentInstructions>
