home / skills / yuyz0112 / public-api-skills / x-api-v2

x-api-v2 skill

/apis/twitter/x-api-v2

This skill helps you explore and interact with the X API v2 by guiding resource and operation navigation across endpoints.

npx playbooks add skill yuyz0112/public-api-skills --skill x-api-v2

Review the files below or copy the command above to add this skill to your agents.

Files (668)
SKILL.md
3.0 KB
---
name: x-api-v2
description: X API v2 available endpoints. Use when working with the X API v2 or when the user needs to interact with this API.
license: X Developer Agreement and Policy (https://developer.x.com/en/developer-terms/agreement-and-policy.html)
metadata:
  api-version: "2.157"
  openapi-version: "3.0.0"
---

# X API v2

X API v2 available endpoints

## How to Use This Skill

This API documentation is split into multiple files for on-demand loading.

**Directory structure:**
```
references/
├── resources/      # 20 resource index files
├── operations/     # 192 operation detail files
└── schemas/        # 111 schema groups, 393 schema files
```

**Navigation flow:**
1. Find the resource you need in the list below
2. Read `references/resources/<resource>.md` to see available operations
3. Read `references/operations/<operation>.md` for full details
4. If an operation references a schema, read `references/schemas/<prefix>/<schema>.md`

## Base URL

- `https://api.x.com` - X API

## Authentication

Supported methods: **BearerToken**, **OAuth2UserToken**, **UserToken**. See `references/authentication.md` for details.

## Resources

- **Users** → `references/resources/Users.md` (42 ops) - Endpoints related to retrieving, managing relation
- **Tweets** → `references/resources/Tweets.md` (38 ops) - Endpoints related to retrieving, searching, and mo
- **Stream** → `references/resources/Stream.md` (22 ops) - Endpoints related to streaming
- **Lists** → `references/resources/Lists.md` (17 ops) - Endpoints related to retrieving, managing Lists
- **Media** → `references/resources/Media.md` (11 ops) - Endpoints related to Media
- **Direct Messages** → `references/resources/Direct-Messages.md` (8 ops) - Endpoints related to retrieving, managing Direct M
- **Webhooks** → `references/resources/Webhooks.md` (8 ops)
- **Compliance** → `references/resources/Compliance.md` (7 ops) - Endpoints related to keeping X data in your system
- **Account Activity** → `references/resources/Account-Activity.md` (6 ops) - Endpoints relating to retrieving, managing AAA sub
- **Spaces** → `references/resources/Spaces.md` (6 ops) - Endpoints related to retrieving, managing Spaces
- **Activity** → `references/resources/Activity.md` (5 ops)
- **Community Notes** → `references/resources/Community-Notes.md` (5 ops)
- **Bookmarks** → `references/resources/Bookmarks.md` (5 ops) - Endpoints related to retrieving, managing bookmark
- **Communities** → `references/resources/Communities.md` (2 ops)
- **Connections** → `references/resources/Connections.md` (2 ops) - Endpoints related to streaming connections
- **Likes** → `references/resources/Likes.md` (2 ops)
- **News** → `references/resources/News.md` (2 ops) - Endpoint for retrieving news stories
- **Trends** → `references/resources/Trends.md` (2 ops)
- **General** → `references/resources/General.md` (1 ops) - Miscellaneous endpoints for general API functional
- **Usage** → `references/resources/Usage.md` (1 ops)

Overview

This skill documents the X API v2 available endpoints and how to navigate them. It provides a clear map of resources, operations, and schemas so you can find and use endpoints for users, tweets, streaming, media, and more. Use this skill when you need precise endpoint details, authentication methods, or schema references for building integrations with the X API v2.

How this skill works

The skill is organized into three main reference sets: resources (index of endpoints), operations (detailed endpoint specs), and schemas (data models). Start from a resource file to see available operations, open an operation file for parameters and responses, and consult schema files when operations reference specific models. The base API root is https://api.x.com, and supported auth methods include BearerToken, OAuth2UserToken, and UserToken.

When to use it

  • Exploring available endpoints before implementing a new integration with X API v2.
  • Looking up request parameters, response shapes, and example payloads for a specific endpoint.
  • Verifying required authentication and scopes for an operation.
  • Finding related schema definitions to validate or map API objects.
  • Troubleshooting API behavior by reviewing operation details and response codes.

Best practices

  • Start from the resource index to identify the correct operation set for your goal.
  • Read the operation detail file for exact parameters, path/query/body requirements, and status codes.
  • Consult schema files for official field names, data types, and nested object structures.
  • Use the documented authentication methods and ensure tokens have the required scopes.
  • Cache schema and operation details locally for faster development, since references are split across files.

Example use cases

  • Fetch a user profile and map the returned user schema into your app's user model.
  • Search tweets with advanced query parameters and parse the tweet objects using schema definitions.
  • Set up a streaming client by following the Stream resource operations and connection requirements.
  • Upload and manage media by using the Media resource endpoints and associated media schemas.
  • Implement webhook or account-activity handling by following the Webhooks and Account Activity resources.

FAQ

What is the base URL for API requests?

Use https://api.x.com as the base URL for all X API v2 endpoints.

Which authentication methods are supported?

Supported methods are BearerToken, OAuth2UserToken, and UserToken; check the authentication reference for scope details.