# What are uid, mid and bid on Weibo?

> Weibo's three IDs: uid for accounts, mid for posts, bid for the short code in weibo.com links. Shapes, the base62 conversion with a worked example, and which one each API call takes.

Canonical page: https://okdata.online/answers/weibo-uid-mid-bid/

**Short answer: **uid is the numeric account ID, mid is the numeric post ID (16 digits today), and bid is the same mid written in base62, the 9-character code in links like weibo.com/<uid>/<bid>. okdata Weibo post search returns the mid as id and the bid inside url for $0.002 a page, and Weibo account profile takes the numeric uid for $0.002.

Weibo uses three identifiers, and two of them are the same number in different clothes. The `uid` names an account. The `mid` names a post. The `bid` is that post's mid encoded in base62, and it is what you see in a post's address: in `weibo.com/6082913457/Qkz3PvVLT`, the first part is the author's uid and the second the bid.

## The three side by side

| | uid | mid | bid |
|---|---|---|---|
| Names | An account | A post | A post |
| Shape | Digits, usually 10 | Digits, 16 for current posts | 9 characters from 0-9, a-z, A-Z |
| Example | `6082913457` | `5249013377610245` | `Qkz3PvVLT` |
| Seen in | `weibo.com/u/<uid>`, every author object | Web and app JSON (`mid`, `idstr`) | Post URLs (`mblogid` in web JSON) |

The names are not used consistently. In Weibo's web and app JSON, `mid` is the numeric string and the short code is `mblogid`. In the documentation of the official API, `id` is the number and "mid" is the base62 form: `statuses/querymid` turns a numeric id into a code such as `8Ras3qlz`, and `statuses/queryid` goes back. When a tool asks for a "mid", check whether it wants digits or letters.

## Converting mid to bid

Split the numeric mid into groups of 7 digits from the right. Write each group in base62 with the alphabet `0-9a-zA-Z` and pad it to 4 characters, except the leftmost group. Join the pieces.

Worked example for `5249013377610245`: the groups are `52`, `4901337` and `7610245`; in base62 they are `Q`, `kz3P` and `vVLT`; joined, `Qkz3PvVLT`. Going back, split the bid into 4-character groups from the right, decode each and pad to 7 digits. We checked the method against six real posts whose numeric mid and link code we had from the same response; all six matched.

## What okdata takes and returns

| Endpoint | Takes | Returns | Cost |
|---|---|---|---|
| [Weibo post search](/apis/weibo/posts/search/) | `query` | `id` = mid, `url` = weibo.com/uid/bid, `author.id` = uid | $0.002 a page |
| [Weibo account profile](/apis/weibo/users/get/) | `id` = numeric uid | the account, with `id` = uid | $0.002 |

`author.username` holds the account's custom address (个性域名) when it has one, the part after `weibo.com/` in a link like `weibo.com/somebrand`. The profile endpoint does not accept it; use the numeric `author.id`.

## Example

```python
import os, requests

ALPHA = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"

def mid_to_bid(mid: str) -> str:
    parts, end = [], len(mid)
    while end > 0:
        start = max(0, end - 7)
        n, code = int(mid[start:end]), ""
        while n:
            n, r = divmod(n, 62)
            code = ALPHA[r] + code
        parts.insert(0, code.rjust(4, "0") if start else code or "0")
        end = start
    return "".join(parts)

assert mid_to_bid("5249013377610245") == "Qkz3PvVLT"

body = requests.get("https://api.okdata.online/v1/weibo/posts/search", timeout=60,
    headers={"Authorization": f"Bearer {os.environ['OKDATA_API_KEY']}"},
    params={"query": "新品发布", "fields": "id,url,author.id,author.username"}).json()
for p in body["data"]["items"]:
    print(p["author"]["id"], p["id"], mid_to_bid(p["id"]), p["url"])
```

## Limits

- Keep mids and uids as strings. A 16-digit mid is beyond the 15 digits Excel keeps, and JavaScript code should not do arithmetic on it.
- There is no Weibo post-by-ID endpoint in the catalog. A mid or bid tells you which post it is, but you reach posts here through search.
- The uid stays the same when the nickname changes, so key accounts on the uid rather than on a name or a custom address.

For profile numbers from a uid, see [getting a Weibo user's followers from their UID](/answers/weibo-user-profile-by-uid/).

## Endpoints used

- [Weibo post search](https://okdata.online/apis/weibo/posts/search/) `weibo.posts.search`: $0.002 per call · about 10 posts per page
- [Weibo account profile](https://okdata.online/apis/weibo/users/get/) `weibo.users.get`: $0.002 per call

## More about Weibo

- [Weibo API](https://okdata.online/apis/weibo/)
- [Weibo API in Python: search, profiles and hot search (2026)](https://okdata.online/guides/weibo-api-python/)
- [How do I get IP location (IP属地) data from Weibo posts and Bilibili comments?](https://okdata.online/answers/weibo-bilibili-ip-location-data/)
- [How do I find Weibo bloggers (KOLs) in a niche?](https://okdata.online/answers/weibo-find-kols-in-niche/)
- [Does Weibo still have an open API for reading posts in 2026?](https://okdata.online/answers/weibo-official-api-2026/)
- [How do I collect Weibo posts on a topic for public-opinion analysis?](https://okdata.online/answers/weibo-public-opinion-dataset/)
- [How do I export Weibo search results to Excel?](https://okdata.online/answers/weibo-search-export-excel/)
- [Profile API](https://okdata.online/roles/accounts-get/)
- [Post search API](https://okdata.online/roles/posts-search/)
- [Weibo hot search: today’s list](https://okdata.online/tools/hot-search/weibo/)

## Sources

- [Weibo Open Platform: statuses/querymid (numeric id to base62 mid)](https://open.weibo.com/wiki/2/statuses/querymid) (read 2026-11-12)
- [Weibo Open Platform: statuses/queryid (base62 mid to numeric id)](https://open.weibo.com/wiki/2/statuses/queryid) (read 2026-11-12)
- [Weibo Open Platform: users/show](https://open.weibo.com/wiki/2/users/show) (read 2026-11-12)

Where people asked this (read 2026-11-12): 

- https://github.com/dataabc/weiboSpider/issues/236
- https://www.v2ex.com/t/461346
- https://github.com/nghuyong/WeiboSpider/issues/276

Updated 2026-11-12
