---
title: "POST /subscriptions/{subscriptionId}/providers/Microsoft.Resources/deploymentStacks/{deploymentStackName}/exportTemplate"
method: POST
path: "/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deploymentStacks/{deploymentStackName}/exportTemplate"
tags: ["DeploymentStacksAtSubscription"]
---

# POST /subscriptions/{subscriptionId}/providers/Microsoft.Resources/deploymentStacks/{deploymentStackName}/exportTemplate

`POST /subscriptions/{subscriptionId}/providers/Microsoft.Resources/deploymentStacks/{deploymentStackName}/exportTemplate`

Exports the template used to create the Deployment stack at the specified scope.

## Path parameters

- `deploymentStackName` string, required

## Parameters

- `../../../../../../common-types/resource-management/v6/types.json#/components/parameters/ApiVersionParameter` — unresolved $ref
- `../../../../../../common-types/resource-management/v6/types.json#/components/parameters/SubscriptionIdParameter` — unresolved $ref

## Response `200`

Azure operation completed successfully.

- DeploymentStackTemplateDefinition — Export Template specific properties of the Deployment stack.
  - `template` object — The template content. Use this element to pass the template syntax directly in the request rather than link to an existing template. It can be a JObject or well-formed JSON string. Use either the templateLink property or the template property, but not both.
  - `templateLink` DeploymentStacksTemplateLink — Entity representing the reference to the template.
    - `uri` string — The URI of the template to deploy. Use either the uri or id property, but not both.
    - `id` string — The resourceId of a Template Spec. Use either the id or uri property, but not both.
    - `relativePath` string — The relativePath property can be used to deploy a linked template at a location relative to the parent. If the parent template was linked with a TemplateSpec, this will reference an artifact in the TemplateSpec. If the parent was linked with a URI, the child deployment will be a combination of the parent and relativePath URIs.
    - `queryString` string — The query string (for example, a SAS token) to be used with the templateLink URI.
    - `contentVersion` string — If included, must match the ContentVersion in the template.

## Other responses

- `default` — An unexpected error response.

## Changes

- **2025-08-20** (2022-08-01-preview) `c35c8c573b02` — 2 info
  - api tag `DeploymentStacksAtSubscription` added
  - api tag `DeploymentStacks` removed
- **2025-06-04** (2022-08-01-preview) `46e0d627c40f` — 2 info
  - api tag `DeploymentStacks` added
  - api tag `DeploymentStacksAtSubscription` removed

[Change history](https://skmtc.dev/azure/apis/resources-microsoft-resources-deploymentstacks/changes/subscriptions/:subscriptionId/providers/Microsoft.Resources/deploymentStacks/:deploymentStackName/exportTemplate/post.md)

---

[API](https://skmtc.dev/azure/apis/resources-microsoft-resources-deploymentstacks.md) · [All operations](https://skmtc.dev/azure/apis/resources-microsoft-resources-deploymentstacks/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/azure/resources-microsoft-resources-deploymentstacks/revisions/0817df7a4e67/schema)
