---
title: "Using the API"
date: "2025-08-05T18:53:53+00:00"
summary: "Learn to make API requests and access your content with our JavaScript example using fetch and JSON:API."
image:
type: "page"
url: "/acquia-source/using-api"
id: "326d1f9d-b775-47d8-89c0-b5dbc091ed47"
---

Once authentication is set up, you can start making API requests to access your content.

Example code
------------

The following is a simple example of fetching content using the JSON:API:

    // JavaScript example using fetch async function getArticles() { // First, get the access token const tokenResponse = await fetch('https://your-site.com/oauth/token', { method: 'POST', headers: { 'Content-Type': 'application/x-www-form-urlencoded', }, body: new URLSearchParams({ 'grant_type': 'client_credentials', 'client_id': 'YOUR_CLIENT_ID', 'client_secret': 'YOUR_CLIENT_SECRET', }) }); const { access_token } = await tokenResponse.json(); // Then use the token to fetch articles const articlesResponse = await fetch('https://your-site.com/jsonapi/node/article?include=field_image&sort=-created', { headers: { 'Authorization': `Bearer ${access_token}`, 'Accept': 'application/vnd.api+json', } }); return articlesResponse.json(); }