# Create a workspace POST https://api.prolific.com/api/v1/workspaces/ Content-Type: application/json Creates a new workspace and adds the user as a Workspace Admin. Reference: https://beta-docs.prolific.com/api-reference/workspaces/create-workspace ## OpenAPI Specification ```yaml openapi: 3.1.1 info: title: Create a workspace version: endpoint_workspaces.CreateWorkspace paths: /api/v1/workspaces/: post: operationId: create-workspace summary: Create a workspace description: Creates a new workspace and adds the user as a Workspace Admin. tags: - - subpackage_workspaces parameters: - name: Authorization in: header description: Header authentication of the form `undefined ` required: true schema: type: string responses: '201': description: Created workspace content: application/json: schema: $ref: '#/components/schemas/Workspace' '400': description: Error content: {} requestBody: content: application/json: schema: $ref: '#/components/schemas/CreateWorkspace' components: schemas: CreateWorkspace: type: object properties: title: type: string description: Name of workspace 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 project and study level. currency_code: type: string description: >- Currency used for all transactions within the workspace. Must be GBP or USD. 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 ProjectShort: 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 naivety_distribution_rate: type: - number - 'null' format: double description: The rate at which the studies within this project are distributed. required: - id - title Workspace: type: object properties: id: type: string description: Workspace id. It is created by Prolific. title: type: string description: Name of workspace description: type: string description: What is this workspace used for owner: type: string description: Workspace id. It is created by Prolific. users: type: array items: $ref: '#/components/schemas/WorkspaceUser' description: Data for a user related to a workspace projects: type: array items: $ref: '#/components/schemas/ProjectShort' description: Data for a project related to a workspace wallet: type: string description: Wallet tied to workspace naivety_distribution_rate: type: - number - 'null' format: double description: The rate at which the studies within this workspace are distributed. required: - id - title ``` ## SDK Code Examples ```python great_british_pounds_workspace import requests url = "https://api.prolific.com/api/v1/workspaces/" payload = { "title": "My workspace using British Pounds", "currency_code": "GBP" } headers = { "Authorization": "", "Content-Type": "application/json" } response = requests.post(url, json=payload, headers=headers) print(response.json()) ``` ```javascript great_british_pounds_workspace const url = 'https://api.prolific.com/api/v1/workspaces/'; const options = { method: 'POST', headers: {Authorization: '', 'Content-Type': 'application/json'}, body: '{"title":"My workspace using British Pounds","currency_code":"GBP"}' }; try { const response = await fetch(url, options); const data = await response.json(); console.log(data); } catch (error) { console.error(error); } ``` ```go great_british_pounds_workspace package main import ( "fmt" "strings" "net/http" "io" ) func main() { url := "https://api.prolific.com/api/v1/workspaces/" payload := strings.NewReader("{\n \"title\": \"My workspace using British Pounds\",\n \"currency_code\": \"GBP\"\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 great_british_pounds_workspace require 'uri' require 'net/http' url = URI("https://api.prolific.com/api/v1/workspaces/") 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 workspace using British Pounds\",\n \"currency_code\": \"GBP\"\n}" response = http.request(request) puts response.read_body ``` ```java great_british_pounds_workspace HttpResponse response = Unirest.post("https://api.prolific.com/api/v1/workspaces/") .header("Authorization", "") .header("Content-Type", "application/json") .body("{\n \"title\": \"My workspace using British Pounds\",\n \"currency_code\": \"GBP\"\n}") .asString(); ``` ```php great_british_pounds_workspace request('POST', 'https://api.prolific.com/api/v1/workspaces/', [ 'body' => '{ "title": "My workspace using British Pounds", "currency_code": "GBP" }', 'headers' => [ 'Authorization' => '', 'Content-Type' => 'application/json', ], ]); echo $response->getBody(); ``` ```csharp great_british_pounds_workspace var client = new RestClient("https://api.prolific.com/api/v1/workspaces/"); var request = new RestRequest(Method.POST); request.AddHeader("Authorization", ""); request.AddHeader("Content-Type", "application/json"); request.AddParameter("application/json", "{\n \"title\": \"My workspace using British Pounds\",\n \"currency_code\": \"GBP\"\n}", ParameterType.RequestBody); IRestResponse response = client.Execute(request); ``` ```swift great_british_pounds_workspace import Foundation let headers = [ "Authorization": "", "Content-Type": "application/json" ] let parameters = [ "title": "My workspace using British Pounds", "currency_code": "GBP" ] as [String : Any] let postData = JSONSerialization.data(withJSONObject: parameters, options: []) let request = NSMutableURLRequest(url: NSURL(string: "https://api.prolific.com/api/v1/workspaces/")! 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() ``` ```python united_states_dollars_workspace import requests url = "https://api.prolific.com/api/v1/workspaces/" payload = { "title": "My workspace using US Dollars", "currency_code": "USD" } headers = { "Authorization": "", "Content-Type": "application/json" } response = requests.post(url, json=payload, headers=headers) print(response.json()) ``` ```javascript united_states_dollars_workspace const url = 'https://api.prolific.com/api/v1/workspaces/'; const options = { method: 'POST', headers: {Authorization: '', 'Content-Type': 'application/json'}, body: '{"title":"My workspace using US Dollars","currency_code":"USD"}' }; try { const response = await fetch(url, options); const data = await response.json(); console.log(data); } catch (error) { console.error(error); } ``` ```go united_states_dollars_workspace package main import ( "fmt" "strings" "net/http" "io" ) func main() { url := "https://api.prolific.com/api/v1/workspaces/" payload := strings.NewReader("{\n \"title\": \"My workspace using US Dollars\",\n \"currency_code\": \"USD\"\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 united_states_dollars_workspace require 'uri' require 'net/http' url = URI("https://api.prolific.com/api/v1/workspaces/") 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 workspace using US Dollars\",\n \"currency_code\": \"USD\"\n}" response = http.request(request) puts response.read_body ``` ```java united_states_dollars_workspace HttpResponse response = Unirest.post("https://api.prolific.com/api/v1/workspaces/") .header("Authorization", "") .header("Content-Type", "application/json") .body("{\n \"title\": \"My workspace using US Dollars\",\n \"currency_code\": \"USD\"\n}") .asString(); ``` ```php united_states_dollars_workspace request('POST', 'https://api.prolific.com/api/v1/workspaces/', [ 'body' => '{ "title": "My workspace using US Dollars", "currency_code": "USD" }', 'headers' => [ 'Authorization' => '', 'Content-Type' => 'application/json', ], ]); echo $response->getBody(); ``` ```csharp united_states_dollars_workspace var client = new RestClient("https://api.prolific.com/api/v1/workspaces/"); var request = new RestRequest(Method.POST); request.AddHeader("Authorization", ""); request.AddHeader("Content-Type", "application/json"); request.AddParameter("application/json", "{\n \"title\": \"My workspace using US Dollars\",\n \"currency_code\": \"USD\"\n}", ParameterType.RequestBody); IRestResponse response = client.Execute(request); ``` ```swift united_states_dollars_workspace import Foundation let headers = [ "Authorization": "", "Content-Type": "application/json" ] let parameters = [ "title": "My workspace using US Dollars", "currency_code": "USD" ] as [String : Any] let postData = JSONSerialization.data(withJSONObject: parameters, options: []) let request = NSMutableURLRequest(url: NSURL(string: "https://api.prolific.com/api/v1/workspaces/")! 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() ``` ```python import requests url = "https://api.prolific.com/api/v1/workspaces/" payload = { "title": "My new workspace" } 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/'; const options = { method: 'POST', headers: {Authorization: '', 'Content-Type': 'application/json'}, body: '{"title":"My new workspace"}' }; 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/" payload := strings.NewReader("{\n \"title\": \"My new workspace\"\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/") 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 workspace\"\n}" response = http.request(request) puts response.read_body ``` ```java HttpResponse response = Unirest.post("https://api.prolific.com/api/v1/workspaces/") .header("Authorization", "") .header("Content-Type", "application/json") .body("{\n \"title\": \"My new workspace\"\n}") .asString(); ``` ```php request('POST', 'https://api.prolific.com/api/v1/workspaces/', [ 'body' => '{ "title": "My new workspace" }', 'headers' => [ 'Authorization' => '', 'Content-Type' => 'application/json', ], ]); echo $response->getBody(); ``` ```csharp var client = new RestClient("https://api.prolific.com/api/v1/workspaces/"); var request = new RestRequest(Method.POST); request.AddHeader("Authorization", ""); request.AddHeader("Content-Type", "application/json"); request.AddParameter("application/json", "{\n \"title\": \"My new workspace\"\n}", ParameterType.RequestBody); IRestResponse response = client.Execute(request); ``` ```swift import Foundation let headers = [ "Authorization": "", "Content-Type": "application/json" ] let parameters = ["title": "My new workspace"] as [String : Any] let postData = JSONSerialization.data(withJSONObject: parameters, options: []) let request = NSMutableURLRequest(url: NSURL(string: "https://api.prolific.com/api/v1/workspaces/")! 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() ```