> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.prolific.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.prolific.com/_mcp/server.

# API Fundamentals

## Authentication & Token Management

### Creating an API Token

To create an API token, head over to the [API Tokens](https://app.prolific.com/researcher/tokens/) page in your toolbar, then click `Create API Token`. Give your token a name, and once you've done that, you'll see a button to copy it.

![To create an API token](https://files.buildwithfern.com/prolific.docs.buildwithfern.com/e683d916290bf569f21f3b78fd3b8398e87ac4f7df9bb7773cace843f6456b30/docs/assets/creating-api-token.gif)

### Deleting an API Token

To delete an API token, you'll need to head over to the [API Tokens](https://app.prolific.com/researcher/tokens/) page in your toolbar, find the token you wish to delete, and click `Delete`.

You'll be asked to enter the name of the token in order to delete it.

Please be aware that once a token is deleted, you will be unable to perform any more actions with it and it cannot be recovered.

![To delete an API token](https://files.buildwithfern.com/prolific.docs.buildwithfern.com/dc980b2e76f3e148fa00a49744b09370416c2a5f66c99ad6c4a6751072a4d40e/docs/assets/deleting-api-token.gif)

### Token Best Practices

* The Prolific API tokens have no expiry date and are best used for server-to-server communication only. We advise rotating API tokens as required.
* The Prolific API tokens are scoped to the Researcher account - anything your researcher account can access, your API token can also access.
* We recommend you do not integrate with the Prolific API directly from your web application. This would expose your tokens publicly.

### Using Your Token

When making a call to Prolific's API, add an `Authorization` header with the value `Token <your token>`.

### Request

GET [https://api.prolific.com/api/v1/users/me/](https://api.prolific.com/api/v1/users/me/)

```curl Users_GetUser_example
curl https://api.prolific.com/api/v1/users/me/ \
     -H "Authorization: Token <token>"
```

```python Users_GetUser_example
import requests

url = "https://api.prolific.com/api/v1/users/me/"

headers = {"Authorization": "Token <token>"}

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

print(response.json())
```

```javascript Users_GetUser_example
const url = 'https://api.prolific.com/api/v1/users/me/';
const options = {method: 'GET', headers: {Authorization: 'Token <token>'}};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go Users_GetUser_example
package main

import (
	"fmt"
	"net/http"
	"io"
)

func main() {

	url := "https://api.prolific.com/api/v1/users/me/"

	req, _ := http.NewRequest("GET", url, nil)

	req.Header.Add("Authorization", "Token <token>")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby Users_GetUser_example
require 'uri'
require 'net/http'

url = URI("https://api.prolific.com/api/v1/users/me/")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Token <token>'

response = http.request(request)
puts response.read_body
```

```java Users_GetUser_example
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.get("https://api.prolific.com/api/v1/users/me/")
  .header("Authorization", "Token <token>")
  .asString();
```

```php Users_GetUser_example
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('GET', 'https://api.prolific.com/api/v1/users/me/', [
  'headers' => [
    'Authorization' => 'Token <token>',
  ],
]);

echo $response->getBody();
```

```csharp Users_GetUser_example
using RestSharp;

var client = new RestClient("https://api.prolific.com/api/v1/users/me/");
var request = new RestRequest(Method.GET);
request.AddHeader("Authorization", "Token <token>");
IRestResponse response = client.Execute(request);
```

```swift Users_GetUser_example
import Foundation

let headers = ["Authorization": "Token <token>"]

let request = NSMutableURLRequest(url: NSURL(string: "https://api.prolific.com/api/v1/users/me/")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "GET"
request.allHTTPHeaderFields = headers

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```

## Error codes

The Prolific API may return the following error codes.

| Code    | Description                                                                                                                                                                                                                                                      |
| ------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **400** | Bad Request - The request was unacceptable. Check the response for more details.                                                                                                                                                                                 |
| **401** | Unauthorized - No valid token was provided.                                                                                                                                                                                                                      |
| **404** | Not Found - The resource does not exist.                                                                                                                                                                                                                         |
| **405** | Method Not Allowed - You tried to access a resource with an invalid method.                                                                                                                                                                                      |
| **422** | Un-processable entity - A validation error on a well-formed request. Check the response for more details.                                                                                                                                                        |
| **429** | Too many requests - You have sent too many requests (either in general, for a resource or for a related resource) in a given amount of time. [Click here](/documentation/core-concepts/managing-high-loads) for more information on handling 429s from Prolific. |

**Note:** You may also get a 401 or 404 error if you do not have access to the requested resource.

If the error is unclear or none of the above applies, please [submit a request](https://researcher-help.prolific.com/en/articles/476151-api-support) to our support team.

## API Status

Prolific's status page can be found [here](https://status.prolific.com). You can also subscribe to updates.