API
Tuskr provides a powerful and easy REST API that enables you to programmatically access the software.
Authentication
To use the API an access token must be passed for every request. The token must be sent in the HTTP header like this:
Authorization: Bearer YourPermanentAccessTokenHere
To obtain a permanent access token, go to Top Menu ▸ ▸ API. Treat this token as a secret. Anybody with access to the token can access, modify or delete your data.
Authorization
The API request will be treated as a request coming from the user whose access token is used for that request. The API call will be allowed only if the user has the privilege. Otherwise, the call will fail with a HTTP status code of 403 (Forbidden).
Rate Limiting
To prevent abuse, there is a limit on the number of API calls you can make per hour. This limit applies to your entire account, not just users. Although your rate limit is determined by your plan, all plans have a hard limit of 10 requests/second. Consider using bulk calls, wherever possible (e.g. adding results), to reduce your requests.
Your Tenant ID
All API calls require a tenant ID to be specified. Tenant ID is the unique ID of your account. This will be the same for all users under the account. It will be a string like this: 5f465f45-37d2-4209-8764-3b0f8aee1754.
To get your account's Tenant ID, go to Top Menu ▸ ▸ API
API Calls
Create a project Creates a blank project.
HTTP Request
POST https://api.tuskr.live/api/tenant/<tenant-id>/project
HTTP Request Body means mandatory
The request body must be a JSON object. This object must contain the key data and its value must be the JSON object having the request details. The example below should make this clearer.
The request object should have the following details:
Parameter | Key | Type |
---|---|---|
Name | name | String |
Team | team | JSON Object. This object specifies the users in this project team along with the roles they play. The key should be the user's email address while its value should be the role's name. For example, {"peter.parker@avengers.com": "Tester"} means Peter will be playing the Tester role in this project. At least one user email and role should be passed in the request. |
Status | status | String. One of active or archived. |
Description | description | String |
External ID | externalId | String |
Integration Data | integrationData | String |
Issue URL Temaplte | issueUrlTemplate | String |
Reference URL Temaplte | referenceUrlTemplate | String |
Return Value
On success, an HTTP 200 response is returned and the body contains the project data. In case of an error, a non-200 code is returned and the body of the response contains the error message.
Example
The following creates a project with name "Endgame v3" with "Tony Stark" and "Peter Parker" in the project team playing the "Manager" and "Tester" roles respectively.
curl --location \ --request POST 'https://api.tuskr.live/api/tenant/07bdb096-dac9-410b-a5fb-10b7c67ac792/project' \ --header 'Authorization: Bearer KYguRJ3AwA41tF0fpCKvbDRySZD7We1FD4lsyyKm' \ --header 'Content-Type: application/json' \ --data-raw '{ "data": { "name": "Endgame v3", "team": { "tony.stark@avengers.com": "Manager", "peter.parker@avengers.com": "Tester" }, "status": "active", "externalId" : "ENDGAME-V3", "description": "This is a project created using API" } } }'
βUpsert (update or insert) a test case Updates a test case if it exists, else creates a new test case.
HTTP Request
POST https://api.tuskr.live/api/tenant/<tenant-id>/test-case/upsert
HTTP Request Body means mandatory
The request body must be a JSON object. This object must contain the key data and its value must be the JSON object having the request details. The example below should make this clearer.
The request object should have the following details:
Parameter | Key | Type |
---|---|---|
Project | project | String. ID, name or external ID . |
ID | id | UUID. If specified, the test case must exist and it will be updated. If
unspecified, then the externalId parameter must be present. |
External ID | externalId | String. A unique ID in a system outside of Tuskr. If specified, and if there exists a test case with this value in the specified project, that test case will be updated, else a new test case will be created and its external ID will be set to this value. |
Options | options | A JSON object with two keys: createMissingSuite and createMissingSection. Their values can be either true or false. If true, and if the suite or section parameters does not exist in the project, they will be created. If false, and if the suite or section parameter does not exist in the project, an error will be returned. Default is false. |
For other parameters like name, testSuite, etc. refer to the parameters in the Add test case API call. |
Return Value
On success, an HTTP 200 response is returned and the body contains the test case data. In case of an error, a non-200 code is returned and the body of the response contains the error message.
Update Example
The following updates a test case using the External ID.
curl --location \ --request POST 'https://api.tuskr.live/api/tenant/07bdb096-dac9-410b-a5fb-10b7c67ac792/test-case/upsert' \ --header 'Authorization: Bearer KYguRJ3AwA41tF0fpCKvbDRySZD7We1FD4lsyyKm' \ --header 'Content-Type: application/json' \ --data-raw '{ "data": { "project": "Acme Shoppping", "externalId": "JIRA-X1", "name": "Update test case name, time and it's custom fields", "estimatedTimeInMinutes": 15, "customFields": { "url": "https://acme.app/checkout", "stepsWithExpectedResults": [ { "step": 1, "description": "step 1", "expectedResult": "expected 1" }, { "step": 2, "description": "step 2", "expectedResult": "expected 2" } ], "multi_select": [ "option 1", "option 2" ], "date": "2021-08-24" } } }'
Create Example
The following creates a test case using the External ID. It also creates the missing test suite and test suite section.
curl --location \ --request POST 'https://api.tuskr.live/api/tenant/07bdb096-dac9-610c-b5fb-10b7c67ac792/test-case/upsert' \ --header 'Authorization: Bearer KYguRJ3AwA41tF0fpCKvbYRySZD7Te1FD4lsytKm' \ --header 'Content-Type: application/json' \ --data-raw '{ "data": { "testSuite": "New Suite", "testSuiteSection": "New Section", "externalId":"JIRA-XYZ", "name": "Create test case if not exist", "estimatedTimeInMinutes": 15, "testCaseType": "Functional", "project": "Acme Shoppping", "options": { "createMissingSuite": true, "createMissingSection": true } } }'
Add a test case Add a test case to an existing suite and section in a project.
HTTP Request
POST https://api.tuskr.live/api/tenant/<tenant-id>/test-case
HTTP Request Body means mandatory
The request body must be a JSON object. This object must contain the key data and its value must be the JSON object having the request details. The example below should make this clearer.
The request object should have the following details:
Parameter | Key | Type |
---|---|---|
Name | name | String. |
Description | description | String. |
Project | project | String. ID or name . |
Test Suite | testSuite | String. ID or name . |
Test Suite Section | testSuiteSection | String. ID or name . |
Test Case Type | testCaseType | String. ID or name . |
Estimated Execution Time | estimatedTimeInMinutes | Integer. The estimate time in minutes required to execute this test case. |
Custom Fields | customFields | A JSON object. See example. |
Return Value
On success, an HTTP 200 response is returned and the body contains a JSON object of the test case. In case of an error, a non-200 code is returned and the body of the response contains the error message.
Example
The following call creates a test case along with some custom fields.
curl --location \ --request POST 'https://api.tuskr.live/api/tenant/07bdb096-dac9-410b-a5fb-10b7c67ac792/test-case' \ --header 'Authorization: Bearer IYguRJ3AwA41tF0fpCKvbDRySZD7We1FD4lsyyKS' \ --header 'Content-Type: application/json' \ --data-raw '{ "data": { "name": "A test case created from API", "project": "Acme Shopping App", "testSuite": "Checkout", "testSuiteSection": "Payment Choices", "testCaseType": "Functional", "estimatedTimeInMinutes": 15, "customFields": { "url": "https://acme.app/checkout", "stepsWithExpectedResults": [ { "step": 1, "description": "step 1", "expectedResult": "expected 1" }, { "step": 2, "description": "step 2", "expectedResult": "expected 2" } ], "multi_select": [ "option 1", "option 2" ], "date": "2021-08-24", } }}'
Import your test plan Create test suites, test suite sections and test cases.
HTTP Request
POST https://api.tuskr.live/api/tenant/<tenant-id>/test-case/import
HTTP Request Body means mandatory
The request body must be a JSON object. This object must contain the key data and its value must be the JSON object having the request details. The example below should make this clearer.
The request object should have the following details:
Parameter | Key | Type |
---|---|---|
Project | project | String. ID or name . |
Test Cases | testCases | JSON array of objects where every object represents a test case. Refer to the "Add test case" API call for the details of this object. |
Options | options | A JSON object with two keys: createMissingSuites and createMissingSections. Their values can be either true or false. If true, then if a suite or section is supplied in a test case that does not exist in the project, it will be created. If false, then if a suite or a section supplied in a test case that does not exist in the project, an error will be returned. Default is false. |
Return Value
On success, an HTTP 200 response is returned and the body contains a JSON object of the test case. In case of an error, a non-200 code is returned and the body of the response contains the error message. The response object will have a rowsWithErrors property that will contain an array of errors encountered for individual test case object present in the request.
{ "totalTestCases": 10, "successCount": 9, "errorCount": 1, "rowsWithError": [ { "record": 2, "errorMessage": "No entry found for Manager." } ] }
Example
The following call creates a test case along with some custom fields. It will also result in creation of a suite and a section.
curl --location \ --request POST 'https://api.tuskr.live/api/tenant/07bdb096-dac9-410b-a5fb-10b7c67ac792/test-case/import' \ --header 'Authorization: Bearer IYguRJ3AwA41tF0fpCKvbDRySZD7We1FD4lsyyKS' \ --header 'Content-Type: application/json' \ --data-raw '{ "data": { "project": "Acme Shopping", "testCases": [ { "name": "A test case imported from API", "testSuite": "New Suite", "testSuiteSection": "New Section", "estimatedTimeInMinutes": 20, "testCaseType": "Functional", "customFields": { "datetype": "2022-01-18", "dropdown": "option 1", "string": "text data", "multi": ["option 1","option 2"], "stepsWithExpectedResults": [ { "step": 1, "description": "step 1", "expectedResult": "expected 1" }, { "step": 2, "description": "step 2", "expectedResult": "expected 2" } ], "integer": 10, "url": "https://tuskr.app", "checkbox": true, "text_single_line": "dummy string data" } } ], "options": { "createMissingSuites": true, "createMissingSections": true } } }}'
Create a test run Creates a new test run in a project.
HTTP Request
POST https://api.tuskr.live/api/tenant/<tenant-id>/test-run
HTTP Request Body means mandatory
The request body must be a JSON object. This object must contain the key data and its value must be the JSON object having the request details. The example below should make this clearer.
The request object should have the following details:
Parameter | Key | Type |
---|---|---|
Name | name | String. If you are automatically creating test runs for CI/CD, prefix the title with something common like "CI" so that it becomes easy for you to delete older runs using our delete test runs API. |
Project | project | String. ID or name . |
Test Case Inclusion Type | testCaseInclusionType | String. One of ALL or SPECIFIC. If you specify ALL, all test cases in the project will be included in the test run. If you specify SPECIFIC, then you will have to indicate the test cases to include as explained below. |
Test Cases | testCases | Array of IDs, keys or names . Required if you have specified testCaseInclusionType as SPECIFIC. |
Description | description | String |
Deadline | deadline | Date . |
Assigned To | assignedTo | String. ID, name or email of the user. If present, the test run will be assigned to this user. |
Return Value
On success, an HTTP 200 response is returned and the body contains a JSON object of the test run. In case of an error, a non-200 code is returned and the body of the response contains the error message.
All Test Cases Example
The following call creates a test run with all test cases present in the project and assigns it to Peter.
curl --location \ --request POST 'https://api.tuskr.live/api/tenant/07bdb096-dac9-410b-a5fb-10b7c67ac792/test-run' \ --header 'Authorization: Bearer KYguRJ3AwA41tF0fpCKvbDRySZD7We1FD4lsyyKm' \ --header 'Content-Type: application/json' \ --data-raw '{ "data": { "name": "All test cases run", "project": "Acme Shopping", "testCaseInclusionType": "ALL", "description": "This test run includes every test case.", "assignedTo": "peter@mycompany.com", "deadline": "2022-07-30" } } }'
Specific Test Cases Example
The following call creates a test run with four test cases and assigns it to Peter. Test cases have been specified using their ID, keys and name.
curl --location \ --request POST 'https://api.tuskr.live/api/tenant/07bdb096-dac9-410b-a5fb-10b7c67ac792/test-run' \ --header 'Authorization: Bearer KYguRJ3AwA41tF0fpCKvbDRySZD7We1FD4lsyyKm' \ --header 'Content-Type: application/json' \ --data-raw '{ "data": { "name": "Specific test cases run", "project": "Acme Shopping", "testCaseInclusionType": "SPECIFIC", "testCases": ["29535988-43a0-41d6-a0c4-7e82e4792c67", "c-4", "C-5", "Filter by rating"], "description": "This test run includes the test cases mentioned in the testCases array.", "assignedTo": "peter@mycompany.com", "deadline": "2022-07-30" } } }'
Copy a test run Creates a copy of a test run along with all its test cases.
HTTP Request
POST https://api.tuskr.live/api/tenant/<tenant-id>/test-run/copy
HTTP Request Body means mandatory
The request body must be a JSON object. This object must contain the key data and its value must be the JSON object having the request details. The example below should make this clearer.
The request object should have the following details:
If any of the following parameters are absent, the original test run's attribute will be used.
Parameter | Key | Type |
---|---|---|
Test Run | testRun | String. ID or name . |
Name | name | String. |
Description | description | String |
Deadline | deadline | Date . |
Assigned To | assignedTo | String. ID, name or email of the user. If present, the test run will be assigned to this user. |
Return Value
On success, an HTTP 200 response is returned and the body contains a JSON object of the test run. In case of an error, a non-200 code is returned and the body of the response contains the error message.
Example
The following call creates a new copy of a test run in the same project.
curl --location \ --request POST 'https://api.tuskr.live/api/tenant/07bdb096-dac9-410b-a5fb-10b7c67ac792/test-run/copy' \ --header 'Authorization: Bearer KYguRJ3AwA41tF0fpCKvbDRySZD7We1FD4lsyyKm' \ --header 'Content-Type: application/json' \ --data-raw '{ "data": { "testRun": "Basic run", "name": "Copy of Basic run", "description": "This test run is a copy of Basic run.", "assignedTo": "peter@mycompany.com", "deadline": "2022-07-30" } } }'
Add results for test cases in a test run Mark one or more test cases as passed, failed or something else in a test run.
HTTP Request
POST https://api.tuskr.live/api/tenant/<tenant-id>/test-run-result/bulk
HTTP Request Body means mandatory
The request body must be a JSON object. This object must contain the key data and its value must be the JSON object having the request details. The example below should make this clearer.
The request object should have the following details:
Parameter | Key | Type |
---|---|---|
Result Status | status | String. Result status key. E.g. PASSED. |
Test Run | testRun | String. ID or name . |
Test Cases | testCases | Array of IDs, keys or names . This result will be applied to all test cases specified in this list. |
Assigned To | assignedTo | String. ID, name or email of the user. If present, the test case in this test run will be assigned to this user. |
Comments | comments | String |
Time Spent | timeSpentInMinutes | Integer |
Custom Fields | customFields | A JSON object. See example. |
Return Value
On success, an HTTP 200 response is returned and the body contains a JSON object of the test run result. In case of an error, a non-200 code is returned and the body of the response contains the error message.
Example
The following call marks three test cases as failed and assigns them to Peter. It also submits the custom fields.
curl --location \ --request POST 'https://api.tuskr.live/api/tenant/07bdb096-dac9-410b-a5fb-10b7c67ac792/test-run-result/bulk' \ --header 'Authorization: Bearer KYguRJ3AwA41tF0fpCKvbDRySZD7We1FD4lsyyKm' \ --header 'Content-Type: application/json' \ --data-raw '{ "data": { "comments": "this is an example of bulk add result", "timeSpentInMinutes": 10, "status": "FAILED", "assignedTo": "peter@mycompany.co", "testRun": "Release Build 22-10-2021", "testCases": ["C-2", "Pagination", "e590699d-88df-430f-b551-98753512914d"], "customFields": { "steps": [ { "step": 1, "description": "step 1" } ], "text": "some text...", "string": "Hello World!", "stepsWithExpectedResults": [ { "step": 1, "description": "step 1", "expectedResult": "expected result 1" } ], "multi_select": [ "option 1", "option 2" ], "date": "2021-08-26", "integer": 108, "dropdown": "option 1", "checkbox": true } } }'
Adding attachments
You can also attach files like screenshots and log files while creating results.
To add attachments, you will need do a POST multipart request with the body
form parameter containing the JSON string representation of the request as described above, and the attachment
form parameter containing the files as shown below.
The files will be attached to all result records for the specified test cases.
Only 2 attachments with max size of 5 MB each are allowed in this API call.
curl --location \ --request POST 'https://api.tuskr.live/api/tenant/07bdb096-dac9-410b-a5fb-10b7c67ac792/test-run-result/bulk' \ --header 'Authorization: Bearer KYguRJ3AwA41tF0fpCKvbDRySZD7We1FD4lsyyKm' \ -F 'body="{\"data\": {\"comments\": \"Sample comment\",\"timeSpentInMinutes\": 10,\"status\": \"FAILED\",\"testRun\": \"Alpha 3\",\"testCases\": [\"C-1\", \"Grid view\", \"4ded1648-6fc9-499b-a057-0482263d2f26\"],\"customFields\": {\"steps\": [{\"step\": 1,\"description\": \"step 1 description\"}]}}}"' \ -F 'attachment=@"/Users/joe/screenshot.png"' \ -F 'attachment=@"/Users/joe/error-log.txt"'
Get results in a test run Fetch test cases and their results in a test run.
HTTP Request
GET https://api.tuskr.live/api/tenant/<tenant-id>/test-run/<test-run-id>/results?status=<result-statuses>&testCases=<test-cases>&page=<page-number>
Parameter | Key | Type |
---|---|---|
Status | status | String. Optional. Comma separated result status keys. For example, if you specify: RETEST,FAILED it would fetch only those test cases having their current status either RETEST or FAILED. |
Test Cases | testCases | String. Optional. Comma separated test case keys, IDs or names. If present, only the matching test cases will be returned. |
Page | page | Integer. Default 1. The page number to fetch. |
Return Value
On success, an HTTP 200 response is returne. The body is a json object with two keys: data that contains the array of test case result objects, and a meta which is an object containing the total number of test cases and number of pages. In case of an error, a non-200 code is returned and the body of the response contains the error message.
{ "data": [ { "testCase": { "id": "24921ff9-1512-4340-b43b-852a32e82f03", "name": "Filter by brand", "key": "C-5", ... }, "latestStatus": "FAILED" }, { "testCase": { "id": "6bfe6b23-c565-4612-8280-a75fdc9c526b", "name": "Phrase match search", "key": "C-15", ... }, "latestStatus": "RETEST" }, ... ], "meta": { "total": 110, "pages": 2 } }
Examples
Two examples that fetch test cases and their reults in a test run having ID of 246d1fa7-f9ff-4b21-b234-1eaec1284541.
Example 1: Get test cases that failedThe following fetches all test cases that have their most recent status as FAILED.
curl --location \ --request GET 'https://api.tuskr.live/api/tenant/07bdb096-dac9-410b-a5fb-10b7c67ac792/test-run/246d1fa7-f9ff-4b21-b234-1eaec1284541/results?status=FAILED' \ --header 'Authorization: Bearer KYguRJ3AwA41tF0fpCKvbDRySZD7We1FD4lsyyKm' \ --header 'Content-Type: application/json'Example 2: Get results of specific test cases
The following fetches results of three test cases. One having key=C-1, the second having name=Pagination and the third having ID=7911ff67-54a7-46ee-92f9-390d8c13cc5c.
curl --location \ --request GET 'https://api.tuskr.live/api/tenant/07bdb096-dac9-410b-a5fb-10b7c67ac792/test-run/246d1fa7-f9ff-4b21-b234-1eaec1284541/results?testCases=C-1,7911ff67-54a7-46ee-92f9-390d8c13cc5c,Pagination' \ --header 'Authorization: Bearer KYguRJ3AwA41tF0fpCKvbDRySZD7We1FD4lsyyKm' \ --header 'Content-Type: application/json'
Delete test runs Deletes multiple test runs based on your criteria. Useful if you regularly create test runs via API.
HTTP Request
DELETE https://api.tuskr.live/api/tenant/<tenant-id>/test-run/bulk
HTTP Request Body means mandatory
The request body must be a JSON object. This object must contain the key data and its value must be the JSON object having the request details. The example below should make this clearer.
The request object should have the following details:
Parameter | Key | Type |
---|---|---|
Projects | projects | Array of IDs or names . If specified, the test runs will be searched in these projects. If unspecified, they will be searched across all projects. |
Test run name starts with | nameStartsWith | String. If specified the test runs should have their name starting with this value. |
Older than days | olderThanDays | Number. If specified, the test runs should be older than this value (in days). |
Purge | purge | Boolean. If unspecified or false, test runs will be moved to the recycle bin, otherwise, they will be permanently deleted from the database. Use with caution. |
Return Value
On success, an HTTP 200 response is returned and the body contains the number of deleted test runs. In case of an error, a non-200 code is returned and the body of the response contains the error message.
Example
The following deletes all the test runs in 1) the "Acme Shopping" project 2) having names that start with "[AUTO]", and 3) that were created 10 days ago.
curl --location \ --request DELETE 'https://api.tuskr.live/api/tenant/07bdb096-dac9-410b-a5fb-10b7c67ac792/test-run/bulk' \ --header 'Authorization: Bearer KYguRJ3AwA41tF0fpCKvbDRySZD7We1FD4lsyyKm' \ --header 'Content-Type: application/json' \ --data-raw '{ "data": { "projects": ["Acme Shopping"], "nameStartsWith": "[AUTO]", "olderThanDays": 10, } } }'