Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
96 changes: 36 additions & 60 deletions .github/workflows/update-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ name: Update Documentation

on:
workflow_dispatch:
repository_dispatch:
types: [xdk-released]
schedule:
- cron: '0 17 * * *' # 9am PT
- cron: '0 20 * * *' # 12pm PT
Expand All @@ -14,83 +16,57 @@ jobs:
permissions:
contents: write
steps:
- name: Checkout Repository
uses: actions/checkout@v3
- name: Checkout Docs Repository
uses: actions/checkout@v4

- name: Checkout XDK Generator
uses: actions/checkout@v4
with:
repository: xdevplatform/xdk
ref: main
path: .xdk-gen

- name: Set Up Node.js
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: '20'

- name: Set Up Rust
uses: dtolnay/rust-toolchain@stable

- name: Cache XDK Rust Build
uses: Swatinem/rust-cache@v2
with:
workspaces: .xdk-gen

- name: Fetch Latest OpenAPI Specification
run: |
curl --fail --silent --show-error --location \
--retry 3 --retry-delay 5 --max-time 120 \
-o openapi.json \
https://api.x.com/2/openapi.json
# Fail early if the response is not valid JSON (e.g. an error page)
jq -e .openapi openapi.json > /dev/null

- name: Remove Existing api-reference Directory
run: rm -rf api-reference

- name: Generate MDX Files
run: npx @mintlify/scraping@latest openapi-file ./openapi.json -o api-reference

- name: Rename Subdirectories
- name: Sync XDK Reference, OpenAPI Code Samples Overlay, and Endpoint Stubs
run: |
if [ -d "api-reference/tweets" ]; then
mv api-reference/tweets api-reference/posts
fi
# Add more rename commands here if needed, e.g.:
# if [ -d "api-reference/other" ]; then
# mv api-reference/other api-reference/newname
# fi
- name: Rename Files Containing '%'
run: |
find api-reference -type f -name '*%*.mdx' -exec bash -c '
new_name="${0//%/}"
if [ ! -f "$new_name" ]; then
mv "$0" "$new_name"
else
echo "Cannot rename $0 to $new_name: file already exists"
fi
' {} \;
- name: Move Files to x-api
run: |
# Function to move files from api-reference to x-api
move_files() {
local src_dir=$1
local dest_dir=$2
for item in "$src_dir"/*; do
if [ -d "$item" ]; then
# Handle subdirectories
local base_name=$(basename "$item")
local new_dest="$dest_dir/$base_name"
mkdir -p "$new_dest" # Create subdirectory in x-api if it doesn’t exist
move_files "$item" "$new_dest" # Recursively move contents
elif [ -f "$item" ]; then
# Move individual files
local file_name=$(basename "$item")
local dest_file="$dest_dir/$file_name"
mv "$item" "$dest_file" # Move file to x-api subdirectory
fi
done
}

# Start moving files from api-reference to x-api
move_files "api-reference" "x-api"
cargo run --manifest-path .xdk-gen/Cargo.toml --bin xdk-build -- \
docs --spec ./openapi.json --output . --sync-endpoint-stubs
rm -rf .xdk-gen

- name: Remove api-reference Directory
run: rm -rf api-reference
- name: Validate Mintlify Build & XDK Docs
run: |
npx --yes mint@latest validate --no-build --files "xdks/**" "tools/**" "tools-and-libraries.mdx"
npx --yes mint@latest validate --no-build --disable unknown-component
npx --yes mint@latest broken-links --files "xdks/**" "tools/**" "tools-and-libraries.mdx"

- name: Commit and Push Changes
run: |
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
git add openapi.json x-api
if git commit -m "Update documentation with latest OpenAPI spec"; then
git push
git config --local user.email "github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
git add openapi.json overlays/xdk-code-samples.json docs.json xdks tools tools-and-libraries.mdx x-api
if git diff --cached --quiet; then
echo "No documentation changes to commit."
else
echo "No changes to commit"
git commit -m "chore: sync OpenAPI spec, XDK reference, and code samples overlay"
git push
fi
27 changes: 27 additions & 0 deletions .github/workflows/validate-docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Validate Docs

on:
pull_request:
branches: [main]
workflow_dispatch:

jobs:
validate:
name: Mintlify Validation
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Set Up Node.js
uses: actions/setup-node@v4
with:
node-version: '20'

- name: Validate XDK & Tools Pages
run: npx --yes mint@latest validate --no-build --files "xdks/**" "tools/**" "tools-and-libraries.mdx"

- name: Validate OpenAPI Spec, Overlay, and Navigation
run: npx --yes mint@latest validate --no-build --disable unknown-component

- name: Check XDK & Tools Internal Links
run: npx --yes mint@latest broken-links --files "xdks/**" "tools/**" "tools-and-libraries.mdx"
4 changes: 2 additions & 2 deletions .well-known/llms.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
- [X API v2 — Full Index](https://docs.x.com/x-api/llms.txt): 370+ reference pages (Posts, Users, DMs, Lists, Spaces, Streams, Compliance, Webhooks, Media, etc.)
- [Enterprise APIs — Full Index](https://docs.x.com/enterprise-api/llms.txt): Account Activity, X Activity (XAA), Compliance, Chat, Communities, Direct Messages, News, Trends, Webhooks, and historical GNIP/PowerTrack
- [Ads API — Full Index](https://docs.x.com/x-ads-api/llms.txt): Campaign management, creatives, audiences, analytics, lead generation, measurement, and conversions
- [Python SDK (XDK) — Full Index](https://docs.x.com/xdks/python/llms.txt): Complete Python client, models, paginators, and streaming reference
- [TypeScript SDK (XDK) — Full Index](https://docs.x.com/xdks/typescript/llms.txt): Full TypeScript/JavaScript client and 300+ model/interface references
- [SDKs (XDKs) — Full Index](https://docs.x.com/xdks/llms.txt): Official Python, TypeScript, Java, and C# (.NET) SDK clients, guides, and references
- [Python XDK](https://docs.x.com/xdks/python/llms.txt) · [TypeScript XDK](https://docs.x.com/xdks/typescript/llms.txt) · [Java XDK](https://docs.x.com/xdks/java/llms.txt) · [C# XDK](https://docs.x.com/xdks/csharp/llms.txt)

## Key Fundamentals & Tools

Expand Down
6 changes: 3 additions & 3 deletions AGENT.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ This document provides guidance for AI agents, coding assistants, and LLM-based
- https://docs.x.com/x-api/llms.txt (X API v2 — 370+ pages)
- https://docs.x.com/enterprise-api/llms.txt
- https://docs.x.com/x-ads-api/llms.txt
- https://docs.x.com/xdks/llms.txt (Python + TypeScript XDKs)
- https://docs.x.com/xdks/llms.txt (Official Python, TypeScript, Java, and C# XDKs)

2. **llms-full.txt** — Complete documentation as a single Markdown file for maximum context:
- https://docs.x.com/llms-full.txt
Expand All @@ -33,7 +33,7 @@ This document provides guidance for AI agents, coding assistants, and LLM-based
- **X API v2** (`/x-api/...`): Posts, Users, Direct Messages, Lists, Spaces, Media, Streams (filtered + volume), Compliance, Webhooks, Account Activity, Trends, News, Usage, Connections.
- **Enterprise APIs** (`/enterprise-api/...`): Account Activity (webhooks), X Activity (XAA), GNIP/PowerTrack historical & real-time, Compliance.
- **Ads API** (`/x-ads-api/...`): Campaign Management, Creatives, Audiences, Analytics, Measurement, Catalog, Lead Generation.
- **SDKs (XDKs)** (`/xdks/python/...` and `/xdks/typescript/...`): Official client libraries with full type coverage, pagination, and streaming helpers.
- **SDKs (XDKs)** (`/xdks/overview`, `/xdks/{python,typescript,java,csharp}/...`): Official client libraries in Python, TypeScript, Java, and C# with full type coverage, pagination, and streaming helpers.
- **Fundamentals**: Authentication, rate limits, data dictionary, expansions, fields, pagination, versioning, consistency.
- **AI & Agent Tools** (`/tools/ai`, `/tools/llms-txt`, `/tools/skill-md`, `/tools/mcp`).

Expand All @@ -54,7 +54,7 @@ All pages are available in the navigation tree defined in `docs.json`.
- For deep context on the entire platform, load `llms-full.txt`.
- For structured capabilities (what actions are possible), load `skill.md`.
- For live tool calling against the X API, use the MCP server.
- When writing code, prefer the official Python or TypeScript XDKs (full references available in their `llms.txt` files).
- When writing code, prefer the official Python, TypeScript, Java, or C# XDKs (full references available in `/xdks/llms.txt` and per-language `llms.txt` files).

## Do Not

Expand Down
6 changes: 3 additions & 3 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ This document provides guidance for AI agents, coding assistants, and LLM-based
- https://docs.x.com/x-api/llms.txt (X API v2 — 370+ pages)
- https://docs.x.com/enterprise-api/llms.txt
- https://docs.x.com/x-ads-api/llms.txt
- https://docs.x.com/xdks/llms.txt (Python + TypeScript XDKs)
- https://docs.x.com/xdks/llms.txt (Official Python, TypeScript, Java, and C# XDKs)

2. **llms-full.txt** — Complete documentation as a single Markdown file for maximum context:
- https://docs.x.com/llms-full.txt
Expand All @@ -33,7 +33,7 @@ This document provides guidance for AI agents, coding assistants, and LLM-based
- **X API v2** (`/x-api/...`): Posts, Users, Direct Messages, Lists, Spaces, Media, Streams (filtered + volume), Compliance, Webhooks, Account Activity, Trends, News, Usage, Connections.
- **Enterprise APIs** (`/enterprise-api/...`): Account Activity (webhooks), X Activity (XAA), GNIP/PowerTrack historical & real-time, Compliance.
- **Ads API** (`/x-ads-api/...`): Campaign Management, Creatives, Audiences, Analytics, Measurement, Catalog, Lead Generation.
- **SDKs (XDKs)** (`/xdks/python/...` and `/xdks/typescript/...`): Official client libraries with full type coverage, pagination, and streaming helpers.
- **SDKs (XDKs)** (`/xdks/overview`, `/xdks/{python,typescript,java,csharp}/...`): Official client libraries in Python, TypeScript, Java, and C# with full type coverage, pagination, and streaming helpers.
- **Fundamentals**: Authentication, rate limits, data dictionary, expansions, fields, pagination, versioning, consistency.
- **AI & Agent Tools** (`/tools/ai`, `/tools/llms-txt`, `/tools/skill-md`, `/tools/mcp`).

Expand All @@ -54,7 +54,7 @@ All pages are available in the navigation tree defined in `docs.json`.
- For deep context on the entire platform, load `llms-full.txt`.
- For structured capabilities (what actions are possible), load `skill.md`.
- For live tool calling against the X API, use the MCP server.
- When writing code, prefer the official Python or TypeScript XDKs (full references available in their `llms.txt` files).
- When writing code, prefer the official Python, TypeScript, Java, or C# XDKs (full references available in `/xdks/llms.txt` and per-language `llms.txt` files).

## Do Not

Expand Down
Loading
Loading