# Update credential pool PATCH https://api.prolific.com/api/v1/credentials/{credential_pool_id}/ Content-Type: application/json Add new credentials to an existing credential pool. This operation is additive - new credentials are appended to the existing pool rather than replacing them. The credentials service validates that no duplicate usernames exist. The credentials are provided as a CSV string where each line contains a username and password separated by a comma (e.g., "user4,pass4\nuser5,pass5"). Reference: https://beta-docs.prolific.com/api-reference/credentials/update-credential-pool ## OpenAPI Specification ```yaml openapi: 3.1.1 info: title: Update credential pool version: endpoint_credentials.UpdateCredentialPool paths: /api/v1/credentials/{credential_pool_id}/: patch: operationId: update-credential-pool summary: Update credential pool description: >- Add new credentials to an existing credential pool. This operation is additive - new credentials are appended to the existing pool rather than replacing them. The credentials service validates that no duplicate usernames exist. The credentials are provided as a CSV string where each line contains a username and password separated by a comma (e.g., "user4,pass4\nuser5,pass5"). tags: - - subpackage_credentials parameters: - name: credential_pool_id in: path description: Credential pool ID required: true schema: type: string - name: Authorization in: header description: Header authentication of the form `undefined ` required: true schema: type: string - name: Authorization in: header required: true schema: type: string responses: '200': description: Credential pool updated successfully content: application/json: schema: $ref: >- #/components/schemas/Credentials_UpdateCredentialPool_Response_200 '400': description: Error content: {} '403': description: Forbidden - User does not have workspace.workspace_update permission content: {} '404': description: Not Found - Credential pool does not exist content: {} '409': description: >- Conflict - Duplicate credentials detected (username already exists in pool) content: {} '502': description: Bad Gateway - Credentials service unavailable or internal error content: {} requestBody: content: application/json: schema: type: object properties: credentials: type: string description: >- CSV-formatted credentials to add (username,password per line) required: - credentials components: schemas: Credentials_UpdateCredentialPool_Response_200: type: object properties: credential_pool_id: type: string description: The unique identifier for the updated credential pool ``` ## SDK Code Examples ```python import requests url = "https://api.prolific.com/api/v1/credentials/credential_pool_id/" payload = { "credentials": "user4,password4 user5,password5" } headers = { "Authorization": "", "Content-Type": "application/json" } response = requests.patch(url, json=payload, headers=headers) print(response.json()) ``` ```javascript const url = 'https://api.prolific.com/api/v1/credentials/credential_pool_id/'; const options = { method: 'PATCH', headers: {Authorization: '', 'Content-Type': 'application/json'}, body: '{"credentials":"user4,password4\nuser5,password5"}' }; 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/credentials/credential_pool_id/" payload := strings.NewReader("{\n \"credentials\": \"user4,password4\\nuser5,password5\"\n}") req, _ := http.NewRequest("PATCH", 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/credentials/credential_pool_id/") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Patch.new(url) request["Authorization"] = '' request["Content-Type"] = 'application/json' request.body = "{\n \"credentials\": \"user4,password4\\nuser5,password5\"\n}" response = http.request(request) puts response.read_body ``` ```java HttpResponse response = Unirest.patch("https://api.prolific.com/api/v1/credentials/credential_pool_id/") .header("Authorization", "") .header("Content-Type", "application/json") .body("{\n \"credentials\": \"user4,password4\\nuser5,password5\"\n}") .asString(); ``` ```php request('PATCH', 'https://api.prolific.com/api/v1/credentials/credential_pool_id/', [ 'body' => '{ "credentials": "user4,password4\\nuser5,password5" }', 'headers' => [ 'Authorization' => '', 'Content-Type' => 'application/json', ], ]); echo $response->getBody(); ``` ```csharp var client = new RestClient("https://api.prolific.com/api/v1/credentials/credential_pool_id/"); var request = new RestRequest(Method.PATCH); request.AddHeader("Authorization", ""); request.AddHeader("Content-Type", "application/json"); request.AddParameter("application/json", "{\n \"credentials\": \"user4,password4\\nuser5,password5\"\n}", ParameterType.RequestBody); IRestResponse response = client.Execute(request); ``` ```swift import Foundation let headers = [ "Authorization": "", "Content-Type": "application/json" ] let parameters = ["credentials": "user4,password4 user5,password5"] as [String : Any] let postData = JSONSerialization.data(withJSONObject: parameters, options: []) let request = NSMutableURLRequest(url: NSURL(string: "https://api.prolific.com/api/v1/credentials/credential_pool_id/")! as URL, cachePolicy: .useProtocolCachePolicy, timeoutInterval: 10.0) request.httpMethod = "PATCH" 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() ```