Model or dataset
xdevplatform/samples avatar
xdevplatform/samples

xdevplatform samples: two hundred and six files, five languages, and one of them with no documented command

Sample code for the X API v2 endpoints

3,213 stars1,089 forksPythonApache-2.0

At a glance

What is it?
The X API v2 samples repository is a language-by-language catalogue of working examples with a table of feature coverage and a table of credential types. Read the structure block and the run section together and the asymmetries are the story: four languages have an install step and one does not, R has no invocation at all, and two feature categories exist only in Python.
Who is it for?
Use it as a catalogue rather than a library: these are files to read and adapt, with the two machine-readable files at the root, a context file for assistants and an endpoint catalogue, being the parts worth automating against. Two cautions.
Can I use it commercially?
Yes. Apache-2.0 is a permissive licence: you can use, modify and sell software built on it, as long as you keep its copyright and licence notices.
Is it still maintained?
Activity is slowing. The repository last received commits 8 months ago.
What is it written in?
Mainly Python, according to GitHub's language statistics.

Answers come from the project's GitHub data, last synced on November 23, 2026, and from our analysis. They are not legal advice.

From daily snapshots

Star history

  • xdevplatform/samples3,213 ★ · +5
Star history
Repository2026-09-242026-11-23
xdevplatform/samples3.2k3.2k

5 Stars in the last 60 days, measured from the daily GitHub snapshot. Compare with other projects

Editorial analysis

Two hundred and six files, and a run section that covers four languages

The repository is described in a single structure block, and it is the clearest statement of what the project is:

code
├── python/           # 65 Python examples
├── javascript/       # 59 JavaScript examples
├── ruby/             # 58 Ruby examples
├── java/             # 19 Java examples
├── r/                # 5 R examples
├── llms.txt          # LLM-friendly documentation
└── api-index.json    # Machine-readable endpoint catalog

Five language directories, 65, 59, 58, 19 and 5 examples, 206 in total, plus two files that are not samples.

The quick start then walks through four of them. Python installs from a requirements file and runs a module. Ruby installs from a bundle and runs a script. Java compiles a class with a classpath and runs it. JavaScript changes directory and runs a file with the runtime.

There is no invocation for R anywhere in the document, despite R having a directory, a count in the structure block, and a column in the coverage table. That is the first asymmetry, and it is the one a reader is most likely to hit, because R looks fully supported until you get to the step where you are told how to run things.

Four install behaviours, and one of them is nothing at all

Compare the four documented run paths and the differences are not stylistic.

Python gets a dependency install and a run command in the same breath:

code
cd python && pip install -r requirements.txt
python posts/search_recent.py

Ruby gets the same shape with a different installer. Java gets no installer at all, because its classpath already expects a directory of archives beside the sources:

code
javac -cp ".:lib/*" posts/RecentSearchDemo.java
java -cp ".:lib/*" RecentSearchDemo

JavaScript gets nothing. The instructions change into the directory and run the file. There is no install step and no mention of a package manifest, which tells you either that the samples rely on what a runtime provides by default or that the dependency step was simply left out.

Three different dependency strategies in one section, and a fourth language with none documented. A reader who assumes the four paths are interchangeable will discover this by running them.

The coverage table has eleven rows, and the file counts imply many more endpoints

The category table is the part of the readme that answers what is actually here, and it is worth reading as a feature matrix rather than an index.

It has eleven rows: posts, users, timelines, streams, lists, spaces, bookmarks, direct messages, media upload, compliance, and usage. Each row marks which languages have examples.

The arithmetic does not work as an index. Ruby is credited with 58 examples but appears in nine rows, and JavaScript with 59 examples in ten rows. So the table is not listing one file per category; it is grouping hundreds of endpoints into eleven headings and reporting only whether a language covers the heading at all.

That is a reasonable design for a matrix, and it has a cost: the table cannot tell you that a language has forty examples in one area and one in another. A reader comparing languages is reading presence and absence, not depth.

The two rows that matter most for scope planning are the two with a single language, which the next section covers.

Direct messages and media upload exist in the Python set only

Two categories are marked for Python and nothing else.

Direct messages: one language. Media upload: one language.

Next to them, posts and users are the only two rows complete across all five languages. Timelines, streams and spaces cover four each. Lists and bookmarks cover three. Compliance covers two. Usage covers three.

So the shape of the collection is a wide base of read and write operations with a narrow base underneath it, and the narrow part is exactly the part that needs user-specific credentials rather than a bearer token.

That connects to the credential table, which is the other axis of the same story. Reading and searching needs one environment variable. Posting, liking, reposting, bookmarking and muting needs a client id and a client secret. Legacy endpoints need a consumer key and a consumer secret. A developer working in, say, Java who expects to send a direct message from these samples is out of luck on both axes at once: there is no sample, and the credential it would need is the confidential-client pair rather than a read-only token.

The OAuth row names PKCE and hands you a client secret

One row of the authentication table has an internal tension, and it matters if you are implementing against it.

The row is labelled with the public-client authorization flow that adds a per-request code challenge and verifier. The environment variables it lists are a client identifier and a client secret.

Those are the two credentials of a confidential client, which is the flow where the secret is never exposed to the browser or the device. The flow named in the label is the one where there is no secret at all, because the verifier is what protects the exchange.

So a reader who follows the label and expects no secret will find the readme asking for one, and a reader who follows the environment variables will find the docs telling them they are using a flow that does not take a secret.

The third row is more honest about itself: the legacy flow is marked as applying to legacy endpoints if applicable, with that conditional doing a lot of quiet work in a repository that otherwise presents three clean credential types.

The two files an assistant can read are the most reusable assets here

Two entries in the structure block are not samples, and they are arguably the reason to clone the repository at all.

One is a context file, described as documentation for AI assistants. The other is a machine-readable catalogue of endpoints in JSON.

Both sit at the repository root rather than inside a language directory, which means they describe the API rather than any one binding of it. A tool that wants to know what the API surface is, rather than what a Python script does with it, has a file to read.

That matters because the samples are numerous and shallow by design. Two hundred and six files, grouped by language and then by whatever the source tree happened to accumulate, is a set you read rather than install. A catalogue is a set you query.

The readme does not explain how either file is produced or how current it is, and there is no generated-from marker in either description. For something meant to be consumed by tooling, that is the gap worth closing, and the root cause is visible in the commit date.

Two documentation hosts, one of them on the old brand's path

The small administrative details are where a repository like this shows its age.

The badge at the top of the readme and the resources list both point at a documentation path under the developer site that still carries the older brand in its path, while the project metadata records a different host for its documentation, under the newer documentation domain with a getting-started page.

So a reader arriving from the metadata and a reader arriving from the readme are sent to two different sites. Both are the same company's documentation, and both are reachable, but the split means redirects and search results that disagree with each other.

The licence section is the other one. It is a single line naming the Apache licence, with no link, while a licence file sits in the repository root and a code of conduct sits beside it.

For a repository whose stated purpose is to be copied from, a one-line licence with no pointer is the detail to fix first.

Editorial conclusion

Use it as a catalogue rather than a library: these are files to read and adapt, with the two machine-readable files at the root, a context file for assistants and an endpoint catalogue, being the parts worth automating against. Two cautions. The coverage table shows the narrowest categories, direct messages and media upload, exist only in the Python set, so a non-Python user is reading a smaller API surface than the file counts suggest. And the last commit is dated 2026-03-20, so treat the endpoint catalogue as a snapshot and check it against the current documentation before building against it.

Frequently asked questions

What is the X API v2 samples repository?

It is a collection of examples for the X API v2 in five languages: 65 Python, 59 JavaScript, 58 Ruby, 19 Java, and 5 R. It also ships two machine-readable files at the root, a context file described as documentation for AI assistants, and a JSON catalogue of endpoints.

How do I run the xdevplatform samples?

Get credentials from the developer portal and export the variable for the operation you are testing: a bearer token for read-only calls, a client id and secret for user actions, or a consumer key and secret for legacy endpoints. Then change into a language directory and run the file. Python, Ruby and Java each have an install step; JavaScript does not, and no invocation is documented for R.

What is a better word for samples?

That is a question about vocabulary rather than about this repository. What this repository calls itself is sample code for the X API v2, and its opening line describes it as working samples in Python, JavaScript, Ruby, Java, and R.

How do I use samples in fl studio?

That question is about audio sampling software and is unrelated to this repository. What this repository contains is API sample code, with an eleven-row table of feature categories across five languages and a table of three authentication types mapped to the environment variables each one needs.

Which X API categories have samples in every language?

Two: posts and users. Timelines, streams, and spaces cover four languages each, lists, bookmarks, and usage cover three, compliance covers two, and direct messages and media upload are Python only. The most recent commit is dated 2026-03-20.

Official sources

  1. Issues
  2. License: Apache-2.0
  3. Project website
  4. README
  5. xdevplatform/samples on GitHub
Add this badge to your README

If you maintain this project, the badge below links readers to this analysis and shows its maintenance status from the daily GitHub snapshot. Paste the markdown into your README; add ?metric=license or ?metric=stars to the image URL for a different field.

Add this badge to your README

markdown
[![Hysen Labs](https://hysenlabs.com/badge/xdevplatform-samples.svg)](https://hysenlabs.com/projects/xdevplatform-samples)

Star history chart for your README

markdown
[![Star history](https://hysenlabs.com/chart/xdevplatform-samples.svg)](https://hysenlabs.com/projects/xdevplatform-samples)

Was this useful?