> ## Documentation Index
> Fetch the complete documentation index at: https://x-preview-oauth-2-ios.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Quickstart

export const Button = ({href, children}) => {
  return <div className="not-prose group">
    <a href={href}>
      <button className="flex items-center space-x-2.5 py-1 px-4 bg-primary-dark dark:bg-white text-white dark:text-gray-950 rounded-full group-hover:opacity-[0.9] font-medium">
        <span>
          {children}
        </span>
        <svg width="3" height="24" viewBox="0 -9 3 24" class="h-6 rotate-0 overflow-visible"><path d="M0 0L3 3L0 6" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"></path></svg>
      </button>
    </a>
  </div>;
};

## Getting started with the manage follows endpoints

This quick start guide will help you make your first request to the manage follows endpoints using [Postman](/tutorials/postman-getting-started).

If you would like to see sample code in different languages, please visit our [X API v2 sample code](https://github.com/xdevplatform/Twitter-API-v2-sample-code) GitHub repository. 

<Note>
  ### Prerequisites

  To complete this guide, you will need to have a set of [keys and tokens](/resources/fundamentals/authentication) to authenticate your request. You can generate these keys and tokens by following these steps:

  * [Sign up for a developer account](https://developer.x.com/en/apply-for-access) and receive approval.
  * Create a [Project](/resources/fundamentals/projects) and an associated [developer App](/resources/fundamentals/developer-apps) in the developer portal.
  * Navigate to your App's “Keys and tokens” page to generate the required credentials. Make sure to save all credentials in a secure location.
</Note>

### Steps to build a manage follows request

#### Step one: Start with a tool or library

There are several different tools, code examples, and libraries that you can use to make a request to this endpoint, but we are going to use the Postman tool here to simplify the process.

To load the X API v2 Postman collection into your environment, please click on the following button:

<Button href="https://app.getpostman.com/run-collection/9956214-784efcda-ed4c-4491-a4c0-a26470a67400">
  Add X API v2 to Postman
</Button>

Once you have the X API v2 collection loaded in Postman, navigate to the “Follows” folder, and select “Follow a user ID”.
 

#### Step two: Authenticate your request

To properly make a request to the X API, you need to verify that you have permission. To do so with this endpoint, you must authenticate your request using either [OAuth 1.0a User Context](/resources/fundamentals/authentication) or [OAuth 2.0 Authorization Code with PKCE](resources/fundamentals/authentication#oauth-2-0-authorization-code-flow-with-pkce-2).

In this example, we are going to use OAuth 1.0a User Context.

You must add your keys and tokens – specifically your API Key, API Secret Key, OAuth 1.0a user Access Token, and OAuth 1.0a user Access Token Secret – to Postman. You can do this by selecting the environment named “X API v2” in the top-right corner of Postman and adding your keys and tokens to the "initial value" and "current value" fields (by clicking the eye icon next to the environment dropdown).

These variables will automatically be pulled into the request's authorization tab if you've done this correctly.
 

#### Step three: Specify who is going to follow whom

Manage follows endpoints take two IDs: one for the source user (the user who wishes to follow or unfollow another user) and the target user (the user that will be followed or unfollowed). The source user’s ID must correspond to the user ID of the authenticating user. In this case, you can specify the ID belonging to your own user. You can find your ID in two ways:

1. Using the [user lookup by username](/x-api/users/user-lookup-by-id) endpoint, you can pass a username and receive the id field. 
2. Looking at your Access Token, you will find that the numeric part is your user ID.
    

The target ID can be any valid user ID. For example the user ID for @XDevelopers is 2244994945.

In Postman, navigate to the "Params" tab, and enter your ID into the "Value" column of the id path variable. Navigate to the “Body” tab and and 2244994945 (the user ID for @XDevelopers) as the value for the target\_user\_id parameter. Making sure to not include any spaces before or after any ID.

|                  |                |
| :--------------- | :------------- |
| **Key**          | **Value**      |
| `id`             | (your user ID) |
| target\_user\_id | 2244994945     |

If you click the "Send" button, you will receive a response object containing the status of the relationship:

* If you receive a "following": true, then the id is successfully following the target\_user\_id.
* If you receive a "pending": true, then the target\_user\_id is protected and must accept your follow request.

####

Step four: Make your request and review your response

Once you have everything set up, hit the "Send" button and you will receive the following response:

```{ theme={null}
    "data": {
        "following": true,
        "pending_follow": false
    }
}
```

Similarly, if you were trying to unfollow a user, you would use the "Unfollow a user ID" request within the same Postman collection. However, both the source\_user\_id and target\_user\_id parameters should be passed as path variables using the unfollow endpoint. 
