# Download Swagger

Get [Swagger](https://swagger.io/docs/specification/v2_0/what-is-swagger/) (OpenAPI 2.0) documentation for a Spark service.

Returns: [Swagger](https://swagger.io/docs/specification/v2_0/what-is-swagger/) (OpenAPI 2.0) documentation for a Spark service.

{% code overflow="wrap" %}

```shellscript
GET /{tenant}/api/v3/folders/{folder}/services/{service}/downloadswagger/{category}/{isDownload}/{versionId}
```

{% endcode %}

### Authorization

* `Bearer {token}` accessible from [Authorization - Bearer token](/spark-apis/authorization-bearer-token.md) or systematically via [Client Credentials](/identity-and-access-management/client-credentials.md).
  * The request headers should include a key for `Authorization` with the value `Bearer {token}`.
* API key created from [Authorization - API keys](/spark-apis/authorization-api-keys.md).\
  The [Authorization - API keys](/spark-apis/authorization-api-keys.md#api-key-groups) must contain [Manage users](/tenant-administration/manage-users.md#user-groups) that are also assigned to [Permissions - Features permissions](/spark-apis/authorization-api-keys/permissions-features-permissions.md) `Spark.DownloadSwagger.json` or `Spark.AllEncompassingProxy.json`.
  * The request headers should include the keys `x-synthetic-key` and `x-tenant-name` with the values of the API key and tenant name respectively.

### Path parameters

| Key             | Value                                                                                                                                                                                  |
| --------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `tenant` \*     | Tenant is part of your [Login and logout](/navigation/login-and-logout.md#log-in-to-spark) URL and also available in the  [Navigation menu](/navigation/navigation-menu.md#user-menu). |
| `folder` \*     | Folder associated with the request.                                                                                                                                                    |
| `service` \*    | Service associated with the request.                                                                                                                                                   |
| `category` \*   | `All` for all subservices or a list of the requested subservices. Reference [How to: Work with subservices](/build-spark-services/subservices.md).                                     |
| `isDownload` \* | `true` for integrating with this endpoint.                                                                                                                                             |
| `versionId` \*  | `version_id` of the Spark service version.                                                                                                                                             |

### Sample request with API key

See [How to: Setup a feature permission](/spark-apis/authorization-api-keys/how-to-setup-a-feature-permission.md) for guidance in assigning the enable the [Authorization - API keys](/spark-apis/authorization-api-keys.md) to access [Permissions - Features permissions](/spark-apis/authorization-api-keys/permissions-features-permissions.md)`Spark.DownloadSwagger.json`.

```sh
curl --location 'https://excel.myenvironmentname.coherent.global/mytenantname/api/v3/folders/myfoldername/services/myservicename/DownloadWwagger/All/true/4cf188ff-e901-4f9e-9451-a37967e421a3' \
--header 'x-tenant-name: <mytenantname>' \
--header 'x-synthetic-key: <myapikey>'
```

### Sample response

`HTTP 200 OK` `Content-Type: application/json`

<details>

<summary>Sample Swagger</summary>

```json
{
  "swagger": "2.0",
  "info": {
    "title": "AtimesB",
    "description": "\n Product Name : Arithmetic\n Service Name : AtimesB\n",
    "version": "v3",
    "contact": {
      "name": "Spark",
      "url": "https://www.coherent.global/products#spark"
    }
  },
  "host": "excel.myenvironment.coherent.global",
  "schemes": [
    "https",
    "http"
  ],
  "paths": {
    "/coherent/api/v3/folders/Arithmetic/services/AtimesB/execute": {
      "post": {
        "tags": [
          "Spark Api"
        ],
        "consumes": [
          "application/json"
        ],
        "parameters": [
          {
            "name": "x-tenant-name",
            "in": "header",
            "required": true,
            "type": "string",
            "x-example": "coherent",
            "description": "Tenant Name - This is optional if Bearer Authorization is used."
          },
          {
            "name": "x-synthetic-key",
            "in": "header",
            "required": true,
            "type": "string",
            "description": "API key provided by Coherent - This is optional if Bearer Authorization is used."
          },
          {
            "name": "request",
            "in": "body",
            "required": true,
            "description": "Engine Request Object.",
            "x-example": "https://editor.swagger.io/",
            "schema": {
              "type": "object",
              "properties": {
                "request_data": {
                  "type": "object",
                  "properties": {
                    "inputs": {
                      "type": "object",
                      "properties": {
                        "A": {
                          "type": "integer",
                          "example": 2,
                          "minimum": 1,
                          "maximum": 5
                        },
                        "B": {
                          "type": "integer",
                          "example": 3,
                          "minimum": 1,
                          "maximum": 5
                        }
                      }
                    }
                  }
                }
              },
              "example": {
                "request_data": {
                  "inputs": {
                    "A": 2,
                    "B": 3
                  }
                },
                "request_meta": {
                  "version_id": "c53d397f-af04-4b6a-9437-232c7bc30ea4",
                  "transaction_date": null,
                  "call_purpose": null,
                  "source_system": null,
                  "correlation_id": null,
                  "service_category": "",
                  "requested_output": null
                }
              }
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success response",
            "schema": {
              "type": "object",
              "properties": {
                "response_data": {
                  "type": "object",
                  "properties": {
                    "outputs": {
                      "type": "object",
                      "properties": {
                        "AtimesB": {
                          "type": "integer",
                          "example": 5
                        }
                      }
                    }
                  }
                }
              },
              "example": {
                "status": "Success",
                "response_data": {
                  "outputs": {
                    "AtimesB": 5
                  },
                  "warnings": null,
                  "errors": null,
                  "service_chain": null
                },
                "response_meta": {
                  "service_id": "8d438c34-d120-46b5-b82c-07278caefd6e",
                  "version_id": "c53d397f-af04-4b6a-9437-232c7bc30ea4",
                  "version": "0.1.0",
                  "process_time": 5,
                  "call_id": "76932f2b-817a-4351-a489-59e9850f9adf",
                  "compiler_type": "Neuron",
                  "compiler_version": "1.25.0",
                  "source_hash": null,
                  "engine_id": "394ED4529FAF3778D13C2AE6918DB9C2",
                  "correlation_id": "",
                  "parameterset_version_id": null,
                  "system": "SPARK",
                  "request_timestamp": "2026-01-20T03:18:33.386Z"
                },
                "error": null
              }
            }
          },
          "401": {
            "description": "Access token is missing or invalid"
          },
          "404": {
            "description": "Service cannot be found"
          },
          "500": {
            "description": "Internal server error occurred. Please contact administrator."
          }
        }
      }
    }
  }
}
```

</details>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.coherent.global/spark-apis/service-apis/download-swagger.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
