
# Meta Muse

Muse has no built-in X or Reddit connector, but it can build a custom connector from an API. This
page is written for Muse to read while it builds one: give it this page's address and your Weir
key.

## Connect

1. Create a key under [API keys](https://weirapp.io/dashboard/keys). It starts with `weir_live_`
   and **is shown once**.
2. Tell Muse:

   ```
   Create a custom connector for Weir by following https://docs.weirapp.io/muse.md. Use my Weir API key as a Bearer token.
   ```

3. When Muse asks for the key, paste it. Muse keeps it in its Secure Credentials Store.
4. Check the connection: ask Muse to call Weir's usage endpoint. It is free and returns your
   balance.

Muse is available in the US and Canada. Meta does not review custom connectors, and Weir is not in
Muse's connector directory.

## For Muse: building the connector

Everything from here on is for the agent building the connector.

- **Base URL:** `https://api.weirapp.io`
- **Authentication:** send `Authorization: Bearer <the user's Weir key>` on every request. Keep
  the key in the credentials store. Never print it or put it in a URL.
- **Contract:** `https://api.weirapp.io/openapi.json` (OpenAPI 3.1) describes every endpoint,
  field and price.
- **Responses** are JSON: results in `data`, and `meta.nextCursor` when there is another page. To
  continue, pass that value back unchanged as `cursor`, with the other parameters unchanged.
- **Cost of each call:** the `x-credits-charged` response header says what the call cost, and
  `x-credits-remaining` what is left.

### Actions to add

| Action                     | Request                                       | Credits                            |
| -------------------------- | --------------------------------------------- | ---------------------------------- |
| Search X                   | `POST /v1/x/search`, JSON body                | 1 + 1 per post                     |
| Get one X post             | `GET /v1/x/posts/{id}`                        | 2                                  |
| Replies to an X post       | `GET /v1/x/posts/{id}/replies`                | 1 + 1 per post                     |
| An X account's posts       | `GET /v1/x/users/{username}/posts?limit=20`   | 1 + 2 for the profile + 1 per post |
| An X profile               | `GET /v1/x/users/{username}`                  | 3                                  |
| Search Reddit              | `POST /v1/reddit/search`, JSON body           | 1 + 3 per post                     |
| A Reddit thread's comments | `GET /v1/reddit/posts/{id}/comments?limit=50` | 1 + 3 per comment                  |
| Balance and usage          | `GET /v1/usage`                               | Free                               |

The account's posts cost 2 for the profile on the first page only. Later pages carry the account in
the cursor and cost 1 per post.

### Search X

`POST https://api.weirapp.io/v1/x/search`, with `Content-Type: application/json`. Every field is
optional; use the ones the request needs.

| Field            | Meaning                                                                                       |
| ---------------- | --------------------------------------------------------------------------------------------- |
| `query`          | Words that must all appear. X search operators pass through: `"exact phrase"`, `OR`, `-word`. |
| `fromUsers`      | Posted by any of these usernames, without the `@`.                                            |
| `since`, `until` | ISO 8601 instants in UTC, such as `2026-10-24T00:00:00Z`.                                     |
| `minLikes`       | At least this many likes.                                                                     |
| `language`       | X's language code, such as `en`, `ja` or `zh`.                                                |
| `sort`           | `latest` (the default) or `top`, X's own engagement ranking.                                  |
| `sinceId`        | Only posts newer than this post id: pass the newest id already seen to read only new posts.   |
| `limit`          | Most posts to return: 25 by default, 100 at most. X serves about 20 per page.                 |
| `cursor`         | `meta.nextCursor` from the previous page.                                                     |

```http
POST /v1/x/search HTTP/1.1
Host: api.weirapp.io
Authorization: Bearer weir_live_...
Content-Type: application/json

{"query": "AI agents", "since": "2026-10-24T00:00:00Z", "minLikes": 100, "sort": "top", "limit": 10}
```

Each post in `data` carries `id`, `text`, `url`, `createdAt`, `lang`, `likeCount`, `retweetCount`,
`replyCount`, `quoteCount`, `viewCount`, and an `author` with `username`, `name`, `verified` and
`followersCount`.

### Search Reddit

`POST https://api.weirapp.io/v1/reddit/search`, with `Content-Type: application/json`. `query` is
required.

| Field        | Meaning                                                              |
| ------------ | -------------------------------------------------------------------- |
| `query`      | Reddit search syntax: words, `"exact phrases"`, `OR`, `-exclusions`. |
| `subreddits` | Only these communities, by name without `r/` (up to 25).             |
| `sort`       | `relevance` (the default), `hot`, `top`, `new` or `comments`.        |
| `time`       | `all` (the default), `year`, `month`, `week`, `day` or `hour`.       |
| `limit`      | Most posts to return: 25 by default, 100 at most.                    |
| `cursor`     | `meta.nextCursor` from the previous page.                            |

Each post in `data` carries `id`, `subreddit`, `title`, `selftext`, `permalink`, `url`, `score`,
`numComments` and `createdAt`.

### Rules for the connector

- **Start small.** Use a `limit` of 10 or less, and narrow first: one account in `fromUsers`, one
  keyword, `since` the last 24 hours. Widen only if that finds too little. A 10-post X search costs
  11 credits.
- **Link every post** you cite, by its `url`.
- **Page with `cursor`**, never by repeating a search.
- **For a recurring digest,** save the newest post id and pass it as `sinceId` next time, so each
  run reads only what is new.
- **Errors:** a `402` means the account is out of credits. It is not retryable, so tell the user. A
  `429` is retryable after the seconds in `Retry-After`. A `400` names the field that is wrong. A
  `404` means the post or account does not exist or is not public.
- **Weir only reads.** There is no endpoint that posts, likes or follows.

## Credits

Every account gets 5,000 free credits a month: about 4,700 X posts at 20 per search, or about 1,600
Reddit posts. [Billing and credits](/billing) has the rates, and `GET /v1/usage` shows the balance.

## Ask Muse

- _Search X with Weir for posts about AI agents since yesterday with at least 100 likes, and
  summarise the five most liked, with links._
- _Every morning, read the newest posts from @OpenAI and @AnthropicAI through Weir and send me the
  highlights._
- _Search Reddit with Weir for "invoice software" in r/smallbusiness this week and list the
  complaints, with links._
