You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
> **Legacy / env-var flow:** You can also set `CLIENT_ID` and `CLIENT_SECRET` as environment variables. They'll be auto-saved into the active app on first use.
61
+
30
62
#### OAuth 2.0 User-Context
31
63
**Note:** For OAuth 2.0 authentication, you must specify the redirect URI in the [X API developer portal](https://developer.x.com/en/portal/dashboard).
32
64
33
65
1. Create an app at the [X API developer portal](https://developer.x.com/en/portal/dashboard).
34
66
2. Go to authentication settings and set the redirect URI to `http://localhost:8080/callback`.
35
67

36
68

37
-
3. Set the client ID and secret in your environment variables.
Tokens are stored securely in `~/.xurl` in your home directory.
279
+
Tokens and app credentials are stored in `~/.xurl` in YAML format. Each registered app has its own isolated set of tokens. Example:
280
+
281
+
```yaml
282
+
apps:
283
+
my-app:
284
+
client_id: abc123
285
+
client_secret: secret456
286
+
default_user: alice
287
+
oauth2_tokens:
288
+
alice:
289
+
type: oauth2
290
+
oauth2:
291
+
access_token: "..."
292
+
refresh_token: "..."
293
+
expiration_time: 1234567890
294
+
bearer_token:
295
+
type: bearer
296
+
bearer: "AAAA..."
297
+
default_app: my-app
298
+
```
299
+
300
+
> **Migration:** If you have an existing JSON-format `~/.xurl` file from a previous version, it will be automatically migrated to the new YAML multi-app format on first use. Your tokens are preserved in a `default` app.
Copy file name to clipboardExpand all lines: SKILL.md
+57-10Lines changed: 57 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
1
---
2
2
name: xurl
3
-
description: A curl-like CLI tool for making authenticated requests to the X (Twitter) API. Use this skill when you need to post tweets, reply, quote, search, read posts, manage followers, send DMs, upload media, or interact with any X API v2 endpoint. Supports OAuth 2.0, OAuth 1.0a, and app-only auth.
3
+
description: A curl-like CLI tool for making authenticated requests to the X (Twitter) API. Use this skill when you need to post tweets, reply, quote, search, read posts, manage followers, send DMs, upload media, or interact with any X API v2 endpoint. Supports multiple apps, OAuth 2.0, OAuth 1.0a, and app-only auth.
4
4
---
5
5
6
6
# xurl — Agent Skill Reference
@@ -11,24 +11,40 @@ description: A curl-like CLI tool for making authenticated requests to the X (Tw
11
11
12
12
## Prerequisites
13
13
14
-
Before using any command you must be authenticated. Run `xurl auth status` to check. If not authenticated, set up one of:
14
+
Before using any command you must be authenticated. Run `xurl auth status` to check.
15
+
16
+
### Register an app (recommended)
15
17
16
18
```bash
17
-
# Option 1 — OAuth 2.0 (user‑context, most common)
18
-
export CLIENT_ID=your_client_id
19
-
export CLIENT_SECRET=your_client_secret
19
+
# Register your X API app credentials (stored in ~/.xurl)
xurl auth default prod-app alice # set default app + user
32
+
xurl --app dev-app /2/users/me # one-off override
33
+
```
34
+
35
+
### Other auth methods
21
36
22
-
# Option 2 — OAuth 1.0a
37
+
```bash
38
+
# OAuth 1.0a
23
39
xurl auth oauth1 \
24
40
--consumer-key KEY --consumer-secret SECRET \
25
41
--access-token TOKEN --token-secret SECRET
26
42
27
-
#Option 3 — App‑only bearer token
43
+
# App‑only bearer token
28
44
xurl auth app --bearer-token TOKEN
29
45
```
30
46
31
-
Tokens are persisted to `~/.xurl`. Once authenticated, every command below will auto‑attach the right `Authorization` header.
47
+
Tokens are persisted to `~/.xurl` in YAML format. Each app has its own isolated tokens. Once authenticated, every command below will auto‑attach the right `Authorization` header.
32
48
33
49
---
34
50
@@ -66,6 +82,15 @@ Tokens are persisted to `~/.xurl`. Once authenticated, every command below will
66
82
| List DMs |`xurl dms -n 10`|
67
83
| Upload media |`xurl media upload path/to/file.mp4`|
68
84
| Media status |`xurl media status MEDIA_ID`|
85
+
|**App Management**||
86
+
| Register app |`xurl auth apps add NAME --client-id ID --client-secret SEC`|
| Set default (command) |`xurl auth default APP_NAME [USERNAME]`|
92
+
| Use app per-request |`xurl --app NAME /2/users/me`|
93
+
| Auth status |`xurl auth status`|
69
94
70
95
> **Post IDs vs URLs:** Anywhere `POST_ID` appears above you can also paste a full post URL (e.g. `https://x.com/user/status/1234567890`) — xurl extracts the ID automatically.
71
96
@@ -216,10 +241,11 @@ xurl post "lol" --media-id MEDIA_ID
216
241
217
242
## Global Flags
218
243
219
-
These flags work on every shortcut command:
244
+
These flags work on every command:
220
245
221
246
| Flag | Short | Description |
222
247
|---|---|---|
248
+
|`--app`|| Use a specific registered app for this request (overrides default) |
223
249
|`--auth`|| Force auth type: `oauth1`, `oauth2`, or `app`|
224
250
|`--username`|`-u`| Which OAuth2 account to use (if you have multiple) |
225
251
|`--verbose`|`-v`| Print full request/response headers |
xurl auth default prod alice # prod app, alice user
376
+
xurl --app staging /2/users/me # one-off request against staging
377
+
```
378
+
335
379
---
336
380
337
381
## Error Handling
@@ -348,4 +392,7 @@ xurl timeline -n 20
348
392
-**Rate limits:** The X API enforces rate limits per endpoint. If you get a 429 error, wait and retry. Write endpoints (post, reply, like, repost) have stricter limits than read endpoints.
349
393
-**Scopes:** OAuth 2.0 tokens are requested with broad scopes. If you get a 403 on a specific action, your token may lack the required scope — re‑run `xurl auth oauth2` to get a fresh token.
350
394
-**Token refresh:** OAuth 2.0 tokens auto‑refresh when expired. No manual intervention needed.
351
-
-**Multiple accounts:** You can authenticate multiple OAuth 2.0 accounts and switch between them with `--username` / `-u`.
395
+
-**Multiple apps:** Register multiple apps with `xurl auth apps add`. Each app has its own isolated credentials and tokens. Switch with `xurl auth default` or `--app`.
396
+
-**Multiple accounts:** You can authenticate multiple OAuth 2.0 accounts per app and switch between them with `--username` / `-u` or set a default with `xurl auth default APP USER`.
397
+
-**Default user:** When no `-u` flag is given, xurl uses the default user for the active app (set via `xurl auth default`). If no default user is set, it uses the first available token.
398
+
-**Token storage:**`~/.xurl` is YAML. Each app stores its own credentials and tokens.
0 commit comments