Skip to Content
Endpoints

Requirements

How to work with requirements using the public API

The requirements endpoints let you retrieve and manage the requirements that test cases link to within a project. Requirements help track traceability between test cases and external specifications, user stories, or other documentation.

About Requirements

Requirements are references to external documentation or specifications that test cases are designed to verify. They consist of:

  1. Text: A descriptive label for the requirement (1–255 characters)
  2. URL (optional): A link to the external requirement document or issue tracker

Requirements can be linked to multiple test cases, and a single test case can be linked to multiple requirements. This enables full traceability between your tests and the specifications they validate.

  • Requirements can be linked to external issues when a Jira or Linear integration is configured for the project
  • Use include=tcaseCount to see how many test cases are linked to each requirement
  • Requirements without any linked test cases are still returned in the list

List Requirements

GET/api/public/v0/project/{project_id}/requirement/paginated

/paginated endpoints are transitional. In API v1, the base paths will return paginated responses and the /paginated suffix will be removed.

Retrieves all requirements within a project, optionally sorted and with additional fields included.

Path Parameters

  • project_id: The project identifier (can be either the project code or UUID)

Query Parameters

ParameterTypeDescriptionDefaultExample
offsetnumberNumber of items to skip.0offset=10
limitnumberMaximum number of items to return. Accepted range: 0–1,000.100limit=20
sortFieldstringField to sort by: created_at or text.textsortField=text
sortOrderstringSort direction for sortField: asc or desc.ascsortOrder=asc
includestringInclude additional fields omitted by default. Accepted value: tcaseCount.Noneinclude=tcaseCount
  • Use include=tcaseCount to see how many test cases are linked to each requirement
  • Sorting by created_at shows the most recently created requirements first (with desc) or oldest first (with asc)
  • Sorting by text provides alphabetical ordering

Example Request

Fetch all requirements

curl \
  -H "Authorization: ApiKey your.api.key.here" \
  https://your-company.your-region-code.qasphere.com/api/public/v0/project/BD/requirement/paginated

Fetch all requirements sorted by text in ascending order

curl \
  -H "Authorization: ApiKey your.api.key.here" \
  "https://your-company.your-region-code.qasphere.com/api/public/v0/project/BD/requirement/paginated?sortField=text&sortOrder=asc"

Fetch all requirements with test case count included

curl \
  -H "Authorization: ApiKey your.api.key.here" \
  "https://your-company.your-region-code.qasphere.com/api/public/v0/project/BD/requirement/paginated?include=tcaseCount"

Response Fields

{
  total: number              // Number of matching requirements across all pages
  offset: number             // Offset applied to this response
  limit: number              // Limit applied to this response
  data: Array<{              // Requirements in this page
    id: string               //   Requirement ID
    text: string             //   Title of the requirement
    url: string              //   URL of the requirement, empty if it has none
    integrationLink: {       //   Jira or Linear issue linked to the requirement, null if none
      type: string           //     Integration type (`jira` | `linear`)
      integrationId: string  //     ID of the integration
      issueId: string        //     The issue as sent in `integrationIssueId`: its ID, or a Jira key / Linear identifier
      issueTitle: string     //     Title of the issue
      issueUrl: string       //     URL of the issue
      remoteLinkId: string   //     ID of the link back to the requirement in the tracker; empty once QA Sphere found that link removed in the tracker
    } | null
    tcaseCount?: number      //   Number of test cases linked to this requirement; only with `include=tcaseCount`
  }>
}

Example Response

{
  "total": 3,
  "offset": 0,
  "limit": 100,
  "data": [
    {
      "id": "1CKgJ5HMU_1VQTDrRJDdDVW",
      "text": "User Authentication",
      "url": "https://docs.example.com/specs/auth",
      "integrationLink": null,
      "tcaseCount": 5
    },
    {
      "id": "1CKgJ5HMU_2BJje4hdXZHag",
      "text": "PROJ-456: Implement password reset functionality",
      "url": "https://jira.example.com/browse/PROJ-456",
      "integrationLink": {
        "type": "jira",
        "integrationId": "1CTPNLhFU_rPbCr23CbqftL",
        "issueId": "10456",
        "issueTitle": "Implement password reset functionality",
        "issueUrl": "https://jira.example.com/browse/PROJ-456",
        "remoteLinkId": "12345"
      },
      "tcaseCount": 3
    },
    {
      "id": "1CKgJ5HMU_3apSDSQWRw6Ys",
      "text": "Performance Requirements",
      "url": "",
      "integrationLink": null,
      "tcaseCount": 0
    }
  ]
}

Get Requirement

GET/api/public/v0/project/{project_id}/requirement/{requirement_id}

Returns one requirement, in the shape of a List Requirements item, with tcaseCount always included.

Response

Status: 200 OK

{
  id: string               // Requirement ID
  text: string             // Title of the requirement
  url: string              // URL of the requirement, empty if it has none
  integrationLink: {       // Jira or Linear issue linked to the requirement, null if none
    type: string           //   Integration type (`jira` | `linear`)
    integrationId: string  //   ID of the integration
    issueId: string        //   The issue as sent in `integrationIssueId`: its ID, or a Jira key / Linear identifier
    issueTitle: string     //   Title of the issue
    issueUrl: string       //   URL of the issue
    remoteLinkId: string   //   ID of the link back to the requirement in the tracker; empty once QA Sphere found that link removed in the tracker
  } | null
  tcaseCount: number       // Number of test cases linked to this requirement
}

Example Response

{
  "id": "1CKgJ5HMU_2BJje4hdXZHag",
  "text": "PROJ-456: Implement password reset functionality",
  "url": "https://jira.example.com/browse/PROJ-456",
  "integrationLink": {
    "type": "jira",
    "integrationId": "1CTPNLhFU_rPbCr23CbqftL",
    "issueId": "10456",
    "issueTitle": "Implement password reset functionality",
    "issueUrl": "https://jira.example.com/browse/PROJ-456",
    "remoteLinkId": "12345"
  },
  "tcaseCount": 3
}

Create Requirement

POST/api/public/v0/project/{project_id}/requirement

Creates a requirement. Update Test Case Requirements also creates missing requirements while linking them to test cases.

Request Body

{
  text: string                 // Title of the requirement (1–255 characters), unique in the project
  url?: string                 // URL of the requirement (http or https, max 255 characters)
  integrationIssueId?: string  // Issue to link the requirement to in the project's Jira or Linear integration
}
  • integrationIssueId: ID or key of an issue in the project's Jira or Linear integration. QA Sphere stores the value sent (as issueId), the issue's title and URL in the requirement's integrationLink and adds a link back to the requirement on the issue. It is ignored when the project has no Jira or Linear integration. If the issue cannot be fetched, the requirement is not created: the response is 400 Bad Request for an issue that doesn't exist, and otherwise has the status the integration endpoints return when the tracker refuses a request.

Response

Status: 201 Created

The created requirement, as Get Requirement returns it.

Errors

Status CodeDescription
409A requirement with the same text exists

Update Requirement

PATCH/api/public/v0/project/{project_id}/requirement/{requirement_id}

Changes a requirement's label, URL or issue link. Test cases linked to it show the change, without a new version.

Request Body

{
  text?: string                // New title (1–255 characters), unique in the project
  url?: string                 // New URL; "" clears it
  integrationIssueId?: string  // Issue to link instead, as in Create Requirement; "" removes the link
}

Omitted fields are left unchanged. Changing or removing the issue link also removes the link back to the requirement from the old issue.

  • integrationIssueId: If the new issue can't be fetched, or the link back can't be added to it, the update fails and the requirement is left unchanged. Sending the value already in integrationLink.issueId changes nothing, while naming the same issue another way (its ID instead of its key) re-creates the link back. When the project has no Jira or Linear integration, "" still removes the link from the requirement (the old issue keeps its link back), and any other value is ignored.

Response

Status: 200 OK

The updated requirement, as Get Requirement returns it.

Errors

Status CodeDescription
409A requirement with the same text exists

Delete Requirement

DELETE/api/public/v0/project/{project_id}/requirement/{requirement_id}

Deletes a requirement.

Irreversible

Deleted requirements don't go to the trash and can't be restored. A requirement is unlinked from every test case, in every version, and its link is removed from the Jira or Linear issue.

Response

Status: 200 OK

{
  message: string
}

List Requirements (Deprecated)

Deprecated

This endpoint is deprecated. Use List Requirements (GET /api/public/v0/project/{project_id}/requirement/paginated) instead.

GET/api/public/v0/project/{project_id}/requirement

Retrieves all requirements within a project, optionally sorted and with additional fields included.

Path Parameters

  • project_id: The project identifier (can be either the project code or UUID)

Query Parameters

All query parameters are optional.

ParameterTypeDescriptionDefaultExample
sortFieldstringField to sort by: created_at or text.textsortField=text
sortOrderstringSort direction for sortField: asc or desc.ascsortOrder=asc
includestringInclude additional fields omitted by default. Accepted value: tcaseCount.Noneinclude=tcaseCount
  • Use include=tcaseCount to see how many test cases are linked to each requirement
  • Sorting by created_at shows the most recently created requirements first (with desc) or oldest first (with asc)
  • Sorting by text provides alphabetical ordering

Example Request

Fetch all requirements

curl \
  -H "Authorization: ApiKey your.api.key.here" \
  https://your-company.your-region-code.qasphere.com/api/public/v0/project/BD/requirement

Fetch all requirements sorted by text in ascending order

curl \
  -H "Authorization: ApiKey your.api.key.here" \
  "https://your-company.your-region-code.qasphere.com/api/public/v0/project/BD/requirement?sortField=text&sortOrder=asc"

Fetch all requirements with test case count included

curl \
  -H "Authorization: ApiKey your.api.key.here" \
  "https://your-company.your-region-code.qasphere.com/api/public/v0/project/BD/requirement?include=tcaseCount"

Response Fields

{
  requirements: Array<{      // List of requirement objects
    id: string               //   Requirement ID
    text: string             //   Title of the requirement
    url: string              //   URL of the requirement, empty if it has none
    integrationLink: {       //   Jira or Linear issue linked to the requirement, null if none
      type: string           //     Integration type (`jira` | `linear`)
      integrationId: string  //     ID of the integration
      issueId: string        //     The issue as sent in `integrationIssueId`: its ID, or a Jira key / Linear identifier
      issueTitle: string     //     Title of the issue
      issueUrl: string       //     URL of the issue
      remoteLinkId: string   //     ID of the link back to the requirement in the tracker; empty once QA Sphere found that link removed in the tracker
    } | null
    tcaseCount?: number      //   Number of test cases linked to this requirement; only with `include=tcaseCount`
  }>
}

Example Response

{
  "requirements": [
    {
      "id": "1CKgJ5HMU_1VQTDrRJDdDVW",
      "text": "User Authentication",
      "url": "https://docs.example.com/specs/auth",
      "integrationLink": null,
      "tcaseCount": 5
    },
    {
      "id": "1CKgJ5HMU_2BJje4hdXZHag",
      "text": "PROJ-456: Implement password reset functionality",
      "url": "https://jira.example.com/browse/PROJ-456",
      "integrationLink": {
        "type": "jira",
        "integrationId": "1CTPNLhFU_rPbCr23CbqftL",
        "issueId": "10456",
        "issueTitle": "Implement password reset functionality",
        "issueUrl": "https://jira.example.com/browse/PROJ-456",
        "remoteLinkId": "12345"
      },
      "tcaseCount": 3
    },
    {
      "id": "1CKgJ5HMU_3apSDSQWRw6Ys",
      "text": "Performance Requirements",
      "url": "",
      "integrationLink": null,
      "tcaseCount": 0
    }
  ]
}