# getUserPosts

**Identifier:** `x_getUserPosts`

**Provider:** [X (formerly Twitter)](https://kirha.com/providers/x.md)

Get 10 recent posts from a user's timeline. Use getUserByUsername first to get the userId.

## Run it with the CLI

```bash
kirha tools run x_getUserPosts \
  --input '{
    "userId": "<userId>"
  }'
```

`--input` takes a JSON object that matches the input schema. Pass `--input -` to read it from stdin.

## Call it over HTTP

```bash
curl https://api.kirha.com/tools/v1/execute \
  --request POST \
  --header 'Content-Type: application/json' \
  --header 'Authorization: **********' \
  --data '{
  "tool_name": "x_getUserPosts",
  "input": {
    "userId": "<userId>"
  }
}'
```

Replace the stars with an API key from https://app.kirha.com/api-keys.

## Input schema

```json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "properties": {
    "excludeReplies": {
      "default": false,
      "type": "boolean"
    },
    "excludeRetweets": {
      "default": false,
      "type": "boolean"
    },
    "userId": {
      "description": "From getUserByUsername",
      "type": "string"
    }
  },
  "required": [
    "userId"
  ],
  "type": "object"
}
```

## Output schema

```json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "additionalProperties": false,
  "properties": {
    "context": {
      "type": "string"
    },
    "ids": {
      "description": "Post IDs for composition",
      "items": {
        "type": "string"
      },
      "type": "array"
    },
    "posts": {
      "items": {
        "additionalProperties": false,
        "properties": {
          "authorId": {
            "description": "Use with getUserPosts",
            "type": "string"
          },
          "authorIsVerified": {
            "type": "boolean"
          },
          "authorName": {
            "type": "string"
          },
          "authorUsername": {
            "type": "string"
          },
          "bookmarks": {
            "type": "number"
          },
          "conversationId": {
            "type": "string"
          },
          "createdAt": {
            "type": "string"
          },
          "hashtags": {
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "id": {
            "type": "string"
          },
          "impressions": {
            "type": "number"
          },
          "inReplyToUserId": {
            "type": "string"
          },
          "lang": {
            "type": "string"
          },
          "likes": {
            "type": "number"
          },
          "mentions": {
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "quotedPostId": {
            "type": "string"
          },
          "quotes": {
            "type": "number"
          },
          "repliedToPostId": {
            "type": "string"
          },
          "replies": {
            "type": "number"
          },
          "reposts": {
            "type": "number"
          },
          "retweetedPostId": {
            "type": "string"
          },
          "text": {
            "type": "string"
          },
          "url": {
            "type": "string"
          },
          "urls": {
            "items": {
              "type": "string"
            },
            "type": "array"
          }
        },
        "required": [
          "id",
          "text",
          "likes",
          "reposts",
          "replies",
          "impressions",
          "bookmarks",
          "quotes",
          "hashtags",
          "mentions",
          "urls"
        ],
        "type": "object"
      },
      "type": "array"
    },
    "resultCount": {
      "type": "number"
    }
  },
  "required": [
    "context",
    "posts",
    "resultCount",
    "ids"
  ],
  "type": "object"
}
```

## Related tools

Other X (formerly Twitter) tools that this tool refers to, or that refer to it.

- [`getPostById`](https://kirha.com/providers/x/getPostById.md)
- [`searchRecentPosts`](https://kirha.com/providers/x/searchRecentPosts.md)
- [`getUserByUsername`](https://kirha.com/providers/x/getUserByUsername.md)

-----

[All X (formerly Twitter) tools](https://kirha.com/providers/x.md) · [< Back to tools list](https://kirha.com/tools.md)