> This page is for Postman API Docs.

> For clean Markdown content of this page, append .md to this URL. For the complete documentation index, see https://learning.postman.com/llms.txt.

# Pull source changes

POST https://api.postman.com/environments/{environmentUid}/pulls
Content-Type: application/json

[Pulls](https://learning.postman.com/docs/collaborating-in-postman/using-version-control/forking-elements/#pull-updates-from-a-parent-element) the changes from a parent (source) environment into the forked environment.


Reference: https://learning.postman.com/api-docs/api-reference/environments/pull-environment

## Authentication

- `x-api-key` header (required) — API Key authentication via header

## Servers

- `https://api.postman.com` (https://api.postman.com, default)
- `https://api.eu.postman.com` (https://api.eu.postman.com)

## Request

### Path parameters

- `environmentUid` (string, required) — The destination environment's unique ID.

### Body (application/json)

This endpoint expects a pullEnvironment.

- `source` (string, required) — The source environment's unique ID to pull data from.

## Response

### 200

Successful Response

- `environment` (PullEnvironmentResponseEnvironment, optional) — Information about the merged environment.

## Errors

### 400 Bad Request Error

Bad Request

- `type` (string, optional) — The type of error.
- `title` (string, optional) — A short summary of the problem.
- `detail` (CommonErrorTypeTitleDetailDetail, optional) — Information about the error.

### 401 Unauthorized Error

Unauthorized

- `PullEnvironmentRequestUnauthorizedError`
  - Error (Type, Title, Detail, Status): commonErrorTypeTitleDetailStatus
  - Error (Name, Message): commonErrorNameMessage

### 404 Not Found Error

Not Found

- `type` (CommonErrorTypeTitleDetailStatusType, optional) — The type of error.
- `title` (string, optional) — A short summary of the problem.
- `detail` (string, optional) — Information about the error.
- `status` (integer, optional) — The error's HTTP status code.

### 500 Internal Server Error

Internal Server Error

- `PullEnvironmentRequestInternalServerError`
  - Error (Type, Title, Detail): commonErrorTypeTitleDetail
  - Error (Type, Title, Detail, Status): commonErrorTypeTitleDetailStatus
  - Error (Name, Message): commonErrorNameMessage

## Types

### PullEnvironmentResponseEnvironment

Information about the merged environment.

- `uid` (string, optional) — The merged environment's unique ID.

### CommonErrorTypeTitleDetailDetail

Information about the error.

- string
- map from string to any

### commonErrorTypeTitleDetailStatus

- `type` (CommonErrorTypeTitleDetailStatusType, optional) — The type of error.
- `title` (string, optional) — A short summary of the problem.
- `detail` (string, optional) — Information about the error.
- `status` (integer, optional) — The error's HTTP status code.

### commonErrorNameMessage

- `error` (CommonErrorNameMessageError, optional) — Information about the error.

### CommonErrorTypeTitleDetailStatusType

The type of error.

- string
- string

### commonErrorTypeTitleDetail

- `type` (string, optional) — The type of error.
- `title` (string, optional) — A short summary of the problem.
- `detail` (CommonErrorTypeTitleDetailDetail, optional) — Information about the error.

### CommonErrorNameMessageError

Information about the error.

- `name` (string, optional) — The error name.
- `message` (string, optional) — The error message.

## Examples

### Successful Response

**Response**

```json
{
  "environment": {
    "uid": "12345678-d9c7dc8f-904e-4bba-99b5-4d490aae1957"
  }
}
```

**SDK Code**

```python Successful Response
import requests

url = "https://api.postman.com/environments/12345678-5daabc50-8451-43f6-922d-96b403b4f28e/pulls"

headers = {"x-api-key": "<apiKey>"}

response = requests.post(url, headers=headers)

print(response.json())
```

```javascript Successful Response
const url = 'https://api.postman.com/environments/12345678-5daabc50-8451-43f6-922d-96b403b4f28e/pulls';
const options = {method: 'POST', headers: {'x-api-key': '<apiKey>'}};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go Successful Response
package main

import (
	"fmt"
	"net/http"
	"io"
)

func main() {

	url := "https://api.postman.com/environments/12345678-5daabc50-8451-43f6-922d-96b403b4f28e/pulls"

	req, _ := http.NewRequest("POST", url, nil)

	req.Header.Add("x-api-key", "<apiKey>")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby Successful Response
require 'uri'
require 'net/http'

url = URI("https://api.postman.com/environments/12345678-5daabc50-8451-43f6-922d-96b403b4f28e/pulls")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<apiKey>'

response = http.request(request)
puts response.read_body
```

```java Successful Response
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.postman.com/environments/12345678-5daabc50-8451-43f6-922d-96b403b4f28e/pulls")
  .header("x-api-key", "<apiKey>")
  .asString();
```

```php Successful Response
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.postman.com/environments/12345678-5daabc50-8451-43f6-922d-96b403b4f28e/pulls', [
  'headers' => [
    'x-api-key' => '<apiKey>',
  ],
]);

echo $response->getBody();
```

```csharp Successful Response
using RestSharp;

var client = new RestClient("https://api.postman.com/environments/12345678-5daabc50-8451-43f6-922d-96b403b4f28e/pulls");
var request = new RestRequest(Method.POST);
request.AddHeader("x-api-key", "<apiKey>");
IRestResponse response = client.Execute(request);
```

```swift Successful Response
import Foundation

let headers = ["x-api-key": "<apiKey>"]

let request = NSMutableURLRequest(url: NSURL(string: "https://api.postman.com/environments/12345678-5daabc50-8451-43f6-922d-96b403b4f28e/pulls")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```

### Pull Source Change

**Request**

```json
{
  "source": "12345678-d9c7dc8f-904e-4bba-99b5-4d490aae1957"
}
```

**Response**

```json
{
  "environment": {
    "uid": "12345678-d9c7dc8f-904e-4bba-99b5-4d490aae1957"
  }
}
```

**SDK Code**

```python Pull Source Change
import requests

url = "https://api.postman.com/environments/12345678-5daabc50-8451-43f6-922d-96b403b4f28e/pulls"

payload = { "source": "12345678-d9c7dc8f-904e-4bba-99b5-4d490aae1957" }
headers = {
    "x-api-key": "<apiKey>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript Pull Source Change
const url = 'https://api.postman.com/environments/12345678-5daabc50-8451-43f6-922d-96b403b4f28e/pulls';
const options = {
  method: 'POST',
  headers: {'x-api-key': '<apiKey>', 'Content-Type': 'application/json'},
  body: '{"source":"12345678-d9c7dc8f-904e-4bba-99b5-4d490aae1957"}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go Pull Source Change
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://api.postman.com/environments/12345678-5daabc50-8451-43f6-922d-96b403b4f28e/pulls"

	payload := strings.NewReader("{\n  \"source\": \"12345678-d9c7dc8f-904e-4bba-99b5-4d490aae1957\"\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("x-api-key", "<apiKey>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby Pull Source Change
require 'uri'
require 'net/http'

url = URI("https://api.postman.com/environments/12345678-5daabc50-8451-43f6-922d-96b403b4f28e/pulls")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<apiKey>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"source\": \"12345678-d9c7dc8f-904e-4bba-99b5-4d490aae1957\"\n}"

response = http.request(request)
puts response.read_body
```

```java Pull Source Change
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.postman.com/environments/12345678-5daabc50-8451-43f6-922d-96b403b4f28e/pulls")
  .header("x-api-key", "<apiKey>")
  .header("Content-Type", "application/json")
  .body("{\n  \"source\": \"12345678-d9c7dc8f-904e-4bba-99b5-4d490aae1957\"\n}")
  .asString();
```

```php Pull Source Change
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.postman.com/environments/12345678-5daabc50-8451-43f6-922d-96b403b4f28e/pulls', [
  'body' => '{
  "source": "12345678-d9c7dc8f-904e-4bba-99b5-4d490aae1957"
}',
  'headers' => [
    'Content-Type' => 'application/json',
    'x-api-key' => '<apiKey>',
  ],
]);

echo $response->getBody();
```

```csharp Pull Source Change
using RestSharp;

var client = new RestClient("https://api.postman.com/environments/12345678-5daabc50-8451-43f6-922d-96b403b4f28e/pulls");
var request = new RestRequest(Method.POST);
request.AddHeader("x-api-key", "<apiKey>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"source\": \"12345678-d9c7dc8f-904e-4bba-99b5-4d490aae1957\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Pull Source Change
import Foundation

let headers = [
  "x-api-key": "<apiKey>",
  "Content-Type": "application/json"
]
let parameters = ["source": "12345678-d9c7dc8f-904e-4bba-99b5-4d490aae1957"] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://api.postman.com/environments/12345678-5daabc50-8451-43f6-922d-96b403b4f28e/pulls")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```