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 MenuAPI. 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. The rate limit is currently 1200 requests per hour.

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 MenuAPI

API Calls

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:

ParameterKeyType
NamenameString
TeamteamJSON 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.
StatusstatusString. One of active or archived.
Descriptiondescription String
External IDexternalIdString
Issue URL TemaplteissueUrlTemplateString
Reference URL TemapltereferenceUrlTemplateString
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"
              }
              }
          }'
  
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:

ParameterKeyType
NamenameString.
DescriptiondescriptionString.
ProjectprojectString. ID or name .
Test SuitetestSuiteString. ID or name .
Test Suite SectiontestSuiteSectionString. ID or name .
Test Case TypetestCaseTypeString. ID or name .
Estimated Execution TimeestimatedTimeInMinutes Integer. The estimate time in minutes required to execute this test case.
Custom FieldscustomFieldsA 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",
           }
       }}'
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:

ParameterKeyType
ProjectprojectString. ID or name .
Test CasestestCasesJSON array of objects where every object represents a test case. Refer to the "Add test case" API call for the details of this object.
OptionsoptionsA 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
                }
            }
       }}'
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:

ParameterKeyType
NamenameString. 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.
ProjectprojectString. ID or name .
Test Case Inclusion TypetestCaseInclusionTypeString. 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 CasestestCasesArray of IDs, keys or names . Required if you have specified testCaseInclusionType as SPECIFIC.
DescriptiondescriptionString
DeadlinedeadlineDate .
Assigned ToassignedTo 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"
         }
     }
}'
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.

ParameterKeyType
Test RuntestRunString. ID or name .
NamenameString.
DescriptiondescriptionString
DeadlinedeadlineDate .
Assigned ToassignedTo 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"
                }
              }
          }'
  
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:

ParameterKeyType
Result StatusstatusString. Result status key. E.g. PASSED.
Test RuntestRunString. ID or name .
Test CasestestCasesArray of IDs, keys or names . This result will be applied to all test cases specified in this list.
Assigned ToassignedTo String. ID, name or email of the user. If present, the test case in this test run will be assigned to this user.
Commentscomments String
Time SpenttimeSpentInMinutes Integer
Custom FieldscustomFieldsA 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"'

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>
ParameterKeyType
Status statusString. 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 CasestestCasesString. Optional. Comma separated test case keys, IDs or names. If present, only the matching test cases will be returned.
PagepageInteger. 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 failed

The 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'
      
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:

ParameterKeyType
ProjectsprojectsArray 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 withnameStartsWithString. If specified the test runs should have their name starting with this value.
Older than daysolderThanDaysNumber. If specified, the test runs should be older than this value (in days).
PurgepurgeBoolean. 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 the "Acme Shopping" project whose name stats with "[AUTO]" and were created before 10 days.

  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,
                }
              }
          }'