---
title: "Get Twitter User Profile - API Reference"
description: "User lookup API: retrieve full profile details for any Twitter/X username. Flat-rate $0.0002 per request, flexible rate limits and no subscriptions."
source: "https://docs.socialdata.tools/reference/get-user-profile/"
---

Retrieve user information by their Twitter screen name.

GET https://api.socialdata.tools/twitter/user/{username}

## Headers

**Authorization** `string` — required

Authorization Bearer header containing your SocialData API key

Example: Bearer YOUR\_API\_KEY

## Path Parameters

**username** `string` — required

Username of the target user profile without @. Either a user\_id or username is required for this endpoint.

Example: elonmusk

## Code Examples

#### curl

```shellscript
curl "https://api.socialdata.tools/twitter/user/elonmusk" \
    -H 'Authorization: Bearer API_KEY' \
    -H 'Accept: application/json'

# OR

curl "https://api.socialdata.tools/twitter/user/343990983" \
    -H 'Authorization: Bearer API_KEY' \
    -H 'Accept: application/json'
```

#### JavaScript

```js
const username = 'elonmusk';
const API_KEY = 'YOUR_API_KEY_HERE';

fetch(`https://api.socialdata.tools/twitter/user/${username}`, {
    method: 'GET',
    headers: {
        'Authorization': `Bearer ${API_KEY}`,
        'Accept': 'application/json'
    }
})
.then(response => response.json())
.then(response => console.log(response))
.catch(err => console.error(err));
```

#### Python

```python
import requests

username = 'elonmusk'
API_KEY = 'YOUR_API_KEY_HERE'

url = f'https://api.socialdata.tools/twitter/user/{username}'

headers = {
    'Authorization': f'Bearer {API_KEY}',
    'Accept': 'application/json'
}

response = requests.get(url, headers=headers)

if response.status_code == 200:
    data = response.json()
    print(data)
else:
    print(f"Error: {response.status_code}")
    print(response.text)
```

#### PHP

```php
$username = 'elonmusk';
$API_KEY = 'YOUR_API_KEY_HERE';

$url = "https://api.socialdata.tools/twitter/user/{$username}";

$ch = curl_init();

curl_setopt_array($ch, [
    CURLOPT_URL => $url,
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER => [
        "Authorization: Bearer $API_KEY",
        "Accept: application/json"
    ]
]);

$response = curl_exec($ch);
$data = json_decode($response, true);
print_r($data);

curl_close($ch);
```

## Example Responses

#### 200

```json
{
    "id": 44196397,
    "id_str": "44196397",
    "name": "Elon Musk",
    "screen_name": "elonmusk",
    "location": "\\ud835\\udd4f\\u00d0",
    "url": null,
    "description": "",
    "protected": false,
    "verified": true,
    "followers_count": 166213974,
    "friends_count": 506,
    "listed_count": 149577,
    "favourites_count": 37987,
    "statuses_count": 34934,
    "created_at": "2009-06-02T20:12:29.000000Z",
    "profile_banner_url": "https:\\/\\/pbs.twimg.com\\/profile_banners\\/44196397\\/1690621312",
    "profile_image_url_https": "https:\\/\\/pbs.twimg.com\\/profile_images\\/1683325380441128960\\/yRsRRjGO_normal.jpg",
    "can_dm": false
}
```

#### 402

```json
{
    "status": "error",
    "message": "Insufficient balance"
}
```

#### 404

```json
{
    "status": "error",
    "message": "User not found"
}
```

#### 500

```json
{
    "status": "error",
    "message": "Failed to fetch data from Twitter"
}
```

## Response Codes

-   **200 OK** - request succeeded
-   **402 Payment Required** - not enough credits to perform this request
-   **404 Not Found** - requested user does not exist
-   **422 Unprocessable Content** - validation failed (e.g. one of the required parameters was not provided)
-   **500 Internal Error** - API internal error, typically means that SocialData API failed to obtain the requested information and you should try again later

## Related endpoints

-   [Get multiple user profiles by IDs](https://docs.socialdata.tools/reference/get-multiple-user-profiles/)
-   [Get user extended bio](https://docs.socialdata.tools/reference/get-user-extended-bio/)
-   [Get similar profiles](https://docs.socialdata.tools/reference/get-user-similar-profiles/)
-   [Get user affiliates](https://docs.socialdata.tools/reference/get-user-affiliates/)

## Before you integrate

-   [Authentication](https://docs.socialdata.tools/getting-started/authentication/)
-   [Rate limits](https://docs.socialdata.tools/getting-started/rate-limits/)
-   [Errors](https://docs.socialdata.tools/getting-started/errors/)
-   [Pricing](https://docs.socialdata.tools/getting-started/pricing/)
