Bash / CLI Joomla! 6 Joomla! 5 Joomla! 4 CLI Intermediate

Consume the Native Joomla REST API (/api/index.php/v1) with Token Auth

Lists and creates articles through Joomla Web Services API v1 using X-Joomla-Token authentication and JSON:API payloads.

Updated on 24 November 2026 53 copies 180 views
scripts/joomla_api_demo.sh
# Defina o token em variável de ambiente
export JOOMLA_API_TOKEN="seu_token_aqui"

# 1) Listar artigos publicados (GET)
curl -sS -X GET "https://seusite.com.br/api/index.php/v1/content/articles?page[limit]=5" \
  -H "Accept: application/vnd.api+json" \
  -H "X-Joomla-Token: ${JOOMLA_API_TOKEN}"

# 2) Criar novo artigo (POST)
curl -sS -X POST "https://seusite.com.br/api/index.php/v1/content/articles" \
  -H "Content-Type: application/json" \
  -H "X-Joomla-Token: ${JOOMLA_API_TOKEN}" \
  -d '{"title":"Artigo via API","alias":"artigo-via-api","catid":2,"language":"pt-BR","articletext":"<p>Conteúdo</p>","state":1}'
Keep JOOMLA_API_TOKEN in environment variables rather than hardcoding it in scripts.

Technical explanation and best practices

Joomla 4, 5 and 6 ships a built-in REST API at /api/index.php/v1/. Enable the Joomla API Token plugin, copy the token from the user profile and authenticate via X-Joomla-Token.

Direct Engineering

Have a Joomla project or technical challenge in mind?

From architectural diagnosis to production deployment, directly with the engineer.