---
title: "Publish a logical data model to the project"
method: POST
path: "/gdc/projects/{projectId}/model/publish"
tags: ["logicaldatamodel"]
---

# Publish a logical data model to the project

`POST /gdc/projects/{projectId}/model/publish`

## Request

- Base URL: `https://secure.gooddata.com`
- URL: `https://secure.gooddata.com/gdc/projects/{projectId}/model/publish`
- Auth: none declared

This method publishes the provided logical data model (target LDM) to the project and returns the link to a polling resource that returns the project LDM after publishing.</br>
You provide the target LDM as a JSON structure in the request body.</br>
</br>
While running, this method performs the following operations:</br>
   **1.** Obtains the current LDM of the project (if any) </br>
   **2.** Generates a diff between the current LDM and the target LDM </br>
   **3.** Generates and executes MAQL DDL scripts to update the current LDM to make it equal to the submitted target LDM</br>
</br>
By default, the target LDM is published **only** if no data is going to be deleted from the project datasets. If the API detects that publishing will delete some data, the publishing task will fail and no changes will be done to the existing LDM.
In this case, you can have the following options:</br>
* Review and update the target LDM so that no data is going to be deleted, and execute the API again.
* Force-publish the LDM even if some data is going to be deleted.</br>
To do so, add the `preserveData` parameter under `publishOptions` in the request body, set it to `false`, and execute the API again.</br>
 **NOTE:** If not explicitly set to `false`, this parameter defaults to `true`.</br>
This option is not available for some update combinations (for example, if `preserveData=false` exists in all possible MAQL DDL scripts).

## Request body

- PublishModel
  - `publishModel` object, required
    - `publishOptions` object: Set true or false for preserveData publish option( set false if you publish with overwrite mode)
      - `preserveData` boolean, required
    - `targetModel` ProjectModel1, required
      - `projectModel` object, required
        - `modelMetadata` ModelMetadata
          - `containCA` boolean: true if the model is generated including computed attributes
        - `datasets` PmDataset1[], nullable
          - `dataset` PmDatasetRequest, required
            - `identifier` string, required
            - `title` string, required
            - `description` string
            - `anchor` PmAttribute1
              - …
            - `attributes` PmAttribute1[]
              - …
            - `bridges` string[]
            - `facts` PmFact1[]
              - …
            - `references` string[]: IDs of referenced dataset / date dimensions
            - `summary` string, nullable
            - `production` boolean
        - `dateDimensions` PmDateDimension1[], nullable
          - `dateDimension` PmDateDimensionRequest, required
            - `name` string, required
            - `title` string, required
            - `urn` string
            - `identifier` string
            - `identifierPrefix` string
            - `bridges` string[]
            - `production` boolean

## Response `202`

Accepted - create publish project model async task

- AsyncTask: Deprecated taskman async task used in old API resources. It contains `link` element in singular which doesn't comply with our API rules.
  - `asyncTask` object, required
    - `link` AsyncTaskPollLink, required
      - `poll` string, uri, required: URI of the polling resource

## Other responses

- `403`: Forbidden - if current user does not have modification project model permission

---

[API](https://skmtc.dev/gooddata/apis/gooddata-api-documentation.md) - [All operations](https://skmtc.dev/gooddata/apis/gooddata-api-documentation/llms.txt) - [OpenAPI document](https://skmtc.dev/gooddata/apis/gooddata-api-documentation/revisions/e5dc0ee6ab00?raw)
