# Create a project POST https://api.prolific.com/api/v1/workspaces/{workspace_id}/projects/ Content-Type: application/json Creates a new project within the workspace. When this project is created, it adds the user as a Project Editor. Reference: https://beta-docs.prolific.com/api-reference/projects/create-project ## OpenAPI Specification ```yaml openapi: 3.1.1 info: title: Create a project version: endpoint_projects.CreateProject paths: /api/v1/workspaces/{workspace_id}/projects/: post: operationId: create-project summary: Create a project description: |- Creates a new project within the workspace. When this project is created, it adds the user as a Project Editor. tags: - - subpackage_projects parameters: - name: workspace_id in: path description: Workspace id required: true schema: type: string - name: Authorization in: header description: Header authentication of the form `undefined ` required: true schema: type: string responses: '201': description: Successfully created project. content: application/json: schema: $ref: '#/components/schemas/Project' '400': description: Error content: {} requestBody: content: application/json: schema: $ref: '#/components/schemas/CreateProject' components: schemas: CreateProject: type: object properties: title: type: string description: Name of project naivety_distribution_rate: type: - number - 'null' format: double description: >- Control the balance between speed of your studies and the naivety of the participants. If not defined, by default Prolific calculates the best rate for most studies taking into account the `filters` and the `total_available_places` needed for this study. Use 0 if your priority is speed. When this property is set to 0 all eligible participants will have access to your study at the same time, without any prioritization. You can also set this at a workspace and study level. required: - title WorkspaceUser: type: object properties: id: type: string description: Id of user name: type: string description: Name of user email: type: string description: email of user roles: type: array items: type: string description: User roles in workspace required: - id Project: type: object properties: id: type: string description: Project id. It is created by Prolific. title: type: string description: Name of project description: type: string description: What is this project used for owner: type: string description: User id of the creator of the project. It is created by Prolific. users: type: array items: $ref: '#/components/schemas/WorkspaceUser' description: Data for all users who have access to this project workspace: type: string description: Id of the workspace this project is in. This is created by Prolific. naivety_distribution_rate: type: - number - 'null' format: double description: The rate at which the studies within this project are distributed. required: - id - title ``` ## SDK Code Examples ```python import requests url = "https://api.prolific.com/api/v1/workspaces/workspace_id/projects/" payload = { "title": "My new project" } headers = { "Authorization": "", "Content-Type": "application/json" } response = requests.post(url, json=payload, headers=headers) print(response.json()) ``` ```javascript const url = 'https://api.prolific.com/api/v1/workspaces/workspace_id/projects/'; const options = { method: 'POST', headers: {Authorization: '', 'Content-Type': 'application/json'}, body: '{"title":"My new project"}' }; try { const response = await fetch(url, options); const data = await response.json(); console.log(data); } catch (error) { console.error(error); } ``` ```go package main import ( "fmt" "strings" "net/http" "io" ) func main() { url := "https://api.prolific.com/api/v1/workspaces/workspace_id/projects/" payload := strings.NewReader("{\n \"title\": \"My new project\"\n}") req, _ := http.NewRequest("POST", url, payload) req.Header.Add("Authorization", "") req.Header.Add("Content-Type", "application/json") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) } ``` ```ruby require 'uri' require 'net/http' url = URI("https://api.prolific.com/api/v1/workspaces/workspace_id/projects/") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Post.new(url) request["Authorization"] = '' request["Content-Type"] = 'application/json' request.body = "{\n \"title\": \"My new project\"\n}" response = http.request(request) puts response.read_body ``` ```java HttpResponse response = Unirest.post("https://api.prolific.com/api/v1/workspaces/workspace_id/projects/") .header("Authorization", "") .header("Content-Type", "application/json") .body("{\n \"title\": \"My new project\"\n}") .asString(); ``` ```php request('POST', 'https://api.prolific.com/api/v1/workspaces/workspace_id/projects/', [ 'body' => '{ "title": "My new project" }', 'headers' => [ 'Authorization' => '', 'Content-Type' => 'application/json', ], ]); echo $response->getBody(); ``` ```csharp var client = new RestClient("https://api.prolific.com/api/v1/workspaces/workspace_id/projects/"); var request = new RestRequest(Method.POST); request.AddHeader("Authorization", ""); request.AddHeader("Content-Type", "application/json"); request.AddParameter("application/json", "{\n \"title\": \"My new project\"\n}", ParameterType.RequestBody); IRestResponse response = client.Execute(request); ``` ```swift import Foundation let headers = [ "Authorization": "", "Content-Type": "application/json" ] let parameters = ["title": "My new project"] as [String : Any] let postData = JSONSerialization.data(withJSONObject: parameters, options: []) let request = NSMutableURLRequest(url: NSURL(string: "https://api.prolific.com/api/v1/workspaces/workspace_id/projects/")! as URL, cachePolicy: .useProtocolCachePolicy, timeoutInterval: 10.0) request.httpMethod = "POST" request.allHTTPHeaderFields = headers request.httpBody = postData as Data 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() ```