> For the complete documentation index, see [llms.txt](https://docs.nected.ai/nected-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.nected.ai/nected-docs/management-api/workspace-api/git-sync-via-api.md).

# Git Sync via API

Pull the latest rules, workflows and other entities from your connected remote Git repository into a workspace branch. Use it to bring a branch up to date from a CI/CD pipeline or script, without opening the Nected UI.

{% hint style="info" %}
This replaces the deprecated `POST /dev/remote/pull` endpoint (Pull Remote Data). Use `POST /dev/v1/remote/pull` for all new integrations.
{% endhint %}

## Pull remote data (Git Sync)

> Starts a pull from your remote source into the workspace branch. The pull runs in the background, so the response returns straight away with a \`taskId\` and the current \`taskState\`.\
> \
> The request needs no body. Authenticate with \`Nected-API-Key\`, and send \`Nected-Branch\` to choose the branch to pull into.

```json
{"openapi":"3.0.3","info":{"title":"Nected Management API — Git Sync","version":"1.0"},"tags":[{"name":"Workspace","description":"Workspace-level APIs."}],"servers":[{"url":"https://api.nected.ai","description":"Production"}],"security":[{"DevAuth":[]}],"components":{"securitySchemes":{"DevAuth":{"type":"apiKey","in":"header","name":"Nected-API-Key","description":"Your Nected API key."}},"schemas":{"Response":{"type":"object","description":"Standard API response wrapper.","properties":{"code":{"type":"string"},"message":{"type":"string"},"data":{"type":"object","nullable":true},"pageNo":{"type":"integer"},"pageSize":{"type":"integer"},"totalCount":{"type":"integer"},"totalPages":{"type":"integer"}}},"PullResponse":{"type":"object","description":"Handle for the background pull.","properties":{"taskId":{"type":"string","description":"Unique ID of the pull task."},"taskState":{"type":"string","description":"Current state of the pull task.","enum":["pending","in-progress","completed","failed"]}}}}},"paths":{"/dev/v1/remote/pull":{"post":{"operationId":"postGitSyncPull","tags":["Workspace"],"summary":"Pull remote data (Git Sync)","description":"Starts a pull from your remote source into the workspace branch. The pull runs in the background, so the response returns straight away with a `taskId` and the current `taskState`.\n\nThe request needs no body. Authenticate with `Nected-API-Key`, and send `Nected-Branch` to choose the branch to pull into.","parameters":[{"name":"Nected-Branch","in":"header","required":false,"description":"Name of the workspace branch to pull into, for example `main`.","schema":{"type":"string"}}],"responses":{"200":{"description":"The pull has started.","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/Response"},{"type":"object","properties":{"data":{"$ref":"#/components/schemas/PullResponse"}}}]}}}},"400":{"description":"Bad Request. The branch name is invalid or the branch doesn't exist in the workspace.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Response"}}}},"401":{"description":"Unauthorized. The `Nected-API-Key` header is missing, empty or invalid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Response"}}}},"500":{"description":"Internal Server Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Response"}}}}}}}}}
```

### Good to know

* **The pull runs in the background.** The response returns right away with a `taskId` and a `taskState`, and the pull keeps running after that. Save the `taskId` so you can identify the pull.
* **Task states:** `pending` (queued), `in-progress` (running), `completed` (finished successfully) and `failed` (stopped with an error).
* **Choose the branch** with the `Nected-Branch` header. The branch must already exist in your workspace, and you need permission to pull on it.
