---
title: "Export & API"
canonical: "https://docs.getxray.app/space/XRAYCLOUD/301400083/Export%20%26%20API"
format: markdown
---
![image](media://32f2b91d-12b9-4d5b-9bc9-1bbda4cbde6d)

> Macro (rw-ui-expands-macro)
> 
> > Macro (rw-expand)
> 
> > Macro (toc)

# Introduction

The focus of [Test Case Designer](https://getxraydocs.atlassian.net/wiki/spaces/XRAYCLOUD/pages/44565543) (TCD) is Test optimization, which means you move the artifacts to [either Xray or Test automation solutions](https://getxraydocs.atlassian.net/wiki/spaces/XRAYCLOUD/pages/44579866) at the end of your workflow. Furthermore, given the iterative nature of the TCD model-based approach, the same artifact may need to be re-exported quite a few times over the course of its lifecycle.

This article describes the next step in unlocking more API capabilities and taking the export versatility to a higher level. The goal is to make the connection to external tools more streamlined, particularly in the automation-focused and CI/CD environments.

# How it Works

> ✅ [TCD Access and Configuration](https://getxraydocs.atlassian.net/wiki/spaces/XRAYCLOUD/pages/44566012)

For each Export Type available on the TCD Export screen (Figure 3), you get an extra option called *API Endpoint* (Figure 4 - 1). It allows you to publish the optimized output in the specified format to a unique URL, which can then be used in HTTP REST GET-type API calls from other solutions.

> ℹ️ This implementation will allow other tools to “pull” the output from TCD. For future releases, Xray is evaluating a more flexible API connection with a select roster of external tools, so that you could also “push” the output to them.

# Operations

## Creating Endpoints

> Macro (rw-ui-steps-macro)
> 
> > Macro (rw-step)
> 
> [Access your TCD instance](https://getxraydocs.atlassian.net/wiki/spaces/XRAYCLOUD/pages/44566012) and copy a model (Figure 1 - 2) from a Sample Project (Figure 1 - 1) or open any existing model or create a new one (you must have Editing rights).
> 
> ![Figure 1 - TCD](media://081689bb-629c-413e-9530-4ddaa55c11a4)
> 
> > Macro (rw-step)
> 
> The *Export & API* option will appear on the left side menu (Figure 2 - 1). Click it.
> 
> ![Figure 2 - Export.png](media://86ab65fe-1681-4d67-86e6-bbf5dd72dd4b)
> 
> > Macro (rw-step)
> 
> The Export screen will appear (Figure 3). For this example, we will click the *Automate Gherkin Script* button (Figure 3 - 1).
> 
> ![Figure 3 - Gherkin](media://6ed6709c-0193-40f2-81ba-1284f1d5e144)
> 
> > Macro (rw-step)
> 
> A modal will open (Figure 4). Click the *API Endpoint* button (Figure 4 - 1). 
> 
> ![Figure 4 - Modal.png](media://816e3e5e-7105-429a-9282-4934aef8ee94)
> 
> > Macro (rw-step)
> 
> A unique URL will be created (Figure 5 - 1). You can stop the API creation process by clicking the *X* icon in the top-left of your browser (where the refresh page button is).
> 
> ![Figure 5 - API endpoint](media://edf7358d-b1b3-4258-8bcd-95d093bffad8)
> 
> > Macro (rw-step)
> 
> Here (Figure 5), you can:
> 
> - Stop the API creation process by clicking the X icon (Figure 5 - 3) and go back to the Export screen (Figure 3).
> - Click the *Copy* button (Figure 5 - 1) to save the API URL in the buffer.
> - Close the Endpoint Settings window (Figure 5 - 3).
> - Add the endpoint name (optional field; Figure 5 - 4). Click *Save* (Figure 5 - 8) to save it.
> - Set the expiration API endpoint period by clicking *Never* (Figure 5 - 5). Note: After = *0 days *is the same as Never. *On date X* will display in YYYY-MM-DD format after applying (Figure 5 - 7).
> - Manage API endpoints (Figure 5 - 2).
> 
> > Macro (rw-step)
> 
> Once you're finished, click *OK* (Figure 5 - 6) or X (Figure 5 - 3) to close the Endpoint Settings window.
> 
> > ℹ️ **Choosing the Same Exporter**
> > ℹ️ 
> > ℹ️ If you choose the same exporter again (e.g., Automate Gherkin Scripts; Figure 3 - 1) and click *API Endpoint *(Figure 4 - 1), you will see the existing endpoints (Figure 6 - 1).
> > ℹ️ 
> > ℹ️ Even if you change any aspect from the list below, you will get a choice to update an existing URL (Figure 6 - 3) **or** create a new one (Figure 6 - 2):
> > ℹ️ 
> > ℹ️ - Strength (i.e. n-way setting as well as standard vs optimized),
> > ℹ️ - Format (more relevant for e.g., Scenarios or Automated Test Framework that support multiple options).
> > ℹ️ - Script name.
> > ℹ️ - Configuration (for Test management exporters; the combination of metadata fields).
> > ℹ️ - Model revision.
> > ℹ️ 
> > ℹ️ You can find these elements in Figure 7.
> > ℹ️ 
> > ℹ️ ![Figure 6 - Existing endpoints](media://cba8c47c-0877-4818-a63d-ce00b87d036a)

## Using Endpoints 

Once an API endpoint is created, you can pull the optimized output by:

- Opening the URL in the browser.
- Passing the URL in a cURL/wget or any other programmatic HTTP request, potentially as part of the automation script or the CI/CD pipeline step.

**Sample Syntax**

```
curl <endpoint url> -o <filename>  (saves the file in the active directory with the specified name and extension)
 
curl -X GET “<endpoint url>” (puts the file content into the terminal)
```

> ℹ️ The API endpoint for the Xray exporter will not replace the existing Synchronization option (Figure 7 - 3) because there will not be a *CSV to JSON* conversion baked into the functionality described in this article (while the Sync flow does perform it behind the scenes).

## Managing Endpoints

> Macro (rw-ui-steps-macro)
> 
> > Macro (rw-step)
> 
> To manage API endpoints, you can navigate to the endpoint management screen from the button at the top of the Export & API landing page (the button is hidden when no endpoints exist; it shows only when there's, at least, one endpoint; Figure 3 - 2) or from the URL creation modal (Figure 5 - 2). 
> 
> > Macro (rw-step)
> 
> You can click the *New Export* button (Figure 7 - 1) to navigate back to the exporter tiles view (Figure 3).
> 
> ![Figure 7 - API endpoint management](media://0ed3f746-109f-49cc-9ecd-385d1e44f914)
> 
> Here (Figure 7), you can:
> 
> - Review all the endpoints in a given model (Figure 7 - 2) and see the characteristics mentioned above, such as the associated model revision, export type, and strength (Figure 7 - 5). Y
> - See when the URL was created and when it was last accessed (hovering gives a more precise timestamp; Figure 7 - 6).
> - Hover over an endpoint to see the icons to copy or delete it (for expired URLs, you can only delete). Press the pencil icon (Figure 7 - 4) to edit the expiration settings for active endpoints at any time.
> 
> > ℹ️ - There is no limit on the number of endpoints per model.
> > ℹ️ - In cURL, there is no “figure out best match” mechanism, so you would need to match the file extension to the corresponding exporter manually. I.e. if you are targeting an endpoint for Automate Gherkin Scripts, your *<filename>* value needs to have the .feature extension.
> > ℹ️ - If you encounter a certificate error in the API call, you can add `--ssl-revoke-best-effort` as an argument: i.e., `curl --ssl-revoke-best-effort <endpoint url> -o <filename>`

> Macro (rw-ui-expands-macro)
> 
> > Macro (rw-expand)
> 
> For more information, please contact your Customer Success Manager and/or the Xray Support team [via the Customer Portal (Jira service management)](https://jira.getxray.app/servicedesk/customer/portal/2/user/login?destination=portal%2F2%2Fcreate%2F28) to access Xray's Compliance Portal for the AI security white paper.