Follow User

POST /2/users/{id}/following

Causes the user(in the path) to follow, or “request to follow” for protected users, the target user. The user(in the path) must match the user context authorizing the request

Path parameters

  • id string Required

    The ID of the user that is requesting to follow the target user

Body

  • target_user_id string Required

    Format should match the following pattern: ^[0-9]{1,19}$.

Responses

  • 200

    The request was successful

    Hide response attributes Show response attributes object
    • data object
      Hide data attributes Show data attributes object
      • following boolean
      • pending_follow boolean
    • errors array[object]

      An HTTP Problem Details object, as defined in IETF RFC 7807 (https://tools.ietf.org/html/rfc7807).

      At least 1 element.

      Hide errors attributes Show errors attributes array[object]
      • type string Required
      • title string Required
      • detail string
      • status integer
  • default

    The request has failed.

    Hide response attributes Show response attributes object
    • code integer(int32) Required
    • message string Required
POST /2/users/{id}/following
curl \
 -X POST https://api.twitter.com/2/users/2244994945/following \
 -H "Authorization: Oauth $ACCESS_TOKEN" \
 -H "Content-Type: application/json" \
 -d '{"target_user_id":"string"}'
Request example
{
  "target_user_id": "string"
}
Request examples
{
  "target_user_id": "string"
}
Response examples (200)
{
  "data": {
    "following": true,
    "pending_follow": true
  },
  "errors": [
    {
      "type": "string",
      "title": "string",
      "detail": "string",
      "status": 42
    }
  ]
}
Response examples (200)
{
  "data": {
    "following": true,
    "pending_follow": true
  },
  "errors": [
    {
      "type": "string",
      "title": "string",
      "detail": "string",
      "status": 42
    }
  ]
}
Response examples (default)
{
  "code": 42,
  "message": "string"
}
Response examples (default)
{
  "code": 42,
  "message": "string"
}