> For clean Markdown content of this page, append .md to this URL. For the complete documentation index, see https://learning.postman.com/llms.txt. For full content including API reference and SDK examples, see https://learning.postman.com/llms-full.txt.

# Merge a fork

POST https://api.getpostman.com/collections/merge
Content-Type: application/json

**This endpoint is deprecated.**

Merges a forked collection back into its parent collection. You must have the [Editor role](https://learning.postman.com/docs/collaborating-in-postman/roles-and-permissions/#collection-roles) for the collection to merge a fork.


Reference: https://learning.postman.com/api-docs/api-reference/collections/merge-collection-fork

## OpenAPI Specification

```yaml
openapi: 3.1.0
info:
  title: Postman API
  version: 1.0.0
paths:
  /collections/merge:
    post:
      operationId: mergeCollectionFork
      summary: Merge a fork
      description: >
        **This endpoint is deprecated.**


        Merges a forked collection back into its parent collection. You must
        have the [Editor
        role](https://learning.postman.com/docs/collaborating-in-postman/roles-and-permissions/#collection-roles)
        for the collection to merge a fork.
      tags:
        - collections
      parameters:
        - name: x-api-key
          in: header
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/mergeCollectionForkResponse'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: >-
                  #/components/schemas/MergeCollectionForkRequestUnauthorizedError
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MergeCollectionForkRequestForbiddenError'
        '404':
          description: Instance Not Found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/commonErrorNameMessageDetails'
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: >-
                  #/components/schemas/MergeCollectionForkRequestInternalServerError
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/mergeCollectionFork'
servers:
  - url: https://api.getpostman.com
    description: https://api.getpostman.com
  - url: https://api.eu.postman.com
    description: https://api.eu.postman.com
components:
  schemas:
    MergeCollectionForkStrategy:
      type: string
      enum:
        - deleteSource
        - updateSourceWithDestination
      default: updateSourceWithDestination
      description: >
        The fork's merge strategy:

        - `deleteSource` — Merge the changes into the parent collection. After
        the merge process is complete, Postman deletes the fork. You must have
        Editor access to both the parent and forked collections.

        - `updateSourceWithDestination` — Merge the changes into the parent
        collection. Any differences in the parent collection are also made to
        the fork.
      title: MergeCollectionForkStrategy
    mergeCollectionFork:
      type: object
      properties:
        destination:
          type: string
          format: uid
          description: The destination (parent) collection's unique ID.
        source:
          type: string
          format: uid
          description: The source collection's unique ID.
        strategy:
          $ref: '#/components/schemas/MergeCollectionForkStrategy'
          default: updateSourceWithDestination
          description: >
            The fork's merge strategy:

            - `deleteSource` — Merge the changes into the parent collection.
            After the merge process is complete, Postman deletes the fork. You
            must have Editor access to both the parent and forked collections.

            - `updateSourceWithDestination` — Merge the changes into the parent
            collection. Any differences in the parent collection are also made
            to the fork.
      required:
        - destination
        - source
      title: mergeCollectionFork
    MergeCollectionForkResponseCollection:
      type: object
      properties:
        id:
          type: string
          description: The source collection's ID.
        uid:
          type: string
          format: uid
          description: The source collection's unique ID.
      title: MergeCollectionForkResponseCollection
    mergeCollectionForkResponse:
      type: object
      properties:
        collection:
          $ref: '#/components/schemas/MergeCollectionForkResponseCollection'
      title: mergeCollectionForkResponse
    CommonErrorTypeTitleDetailStatusType:
      oneOf:
        - type: string
          format: uri-reference
        - type: string
      title: CommonErrorTypeTitleDetailStatusType
    commonErrorTypeTitleDetailStatus:
      type: object
      properties:
        type:
          $ref: '#/components/schemas/CommonErrorTypeTitleDetailStatusType'
        title:
          type: string
          description: A short summary of the problem.
        detail:
          type: string
          description: Information about the error.
        status:
          type: integer
          description: The error's HTTP status code.
      title: commonErrorTypeTitleDetailStatus
    CommonErrorNameMessageError:
      type: object
      properties:
        name:
          type: string
          description: The error name.
        message:
          type: string
          description: The error message.
      description: Information about the error.
      title: CommonErrorNameMessageError
    commonErrorNameMessage:
      type: object
      properties:
        error:
          $ref: '#/components/schemas/CommonErrorNameMessageError'
          description: Information about the error.
      title: commonErrorNameMessage
    MergeCollectionForkRequestUnauthorizedError:
      oneOf:
        - $ref: '#/components/schemas/commonErrorTypeTitleDetailStatus'
        - $ref: '#/components/schemas/commonErrorNameMessage'
      title: MergeCollectionForkRequestUnauthorizedError
    MergeCollectionForkRequestForbiddenError:
      oneOf:
        - $ref: '#/components/schemas/commonErrorTypeTitleDetailStatus'
        - $ref: '#/components/schemas/commonErrorNameMessage'
      title: MergeCollectionForkRequestForbiddenError
    CommonErrorNameMessageDetailsErrorDetails:
      oneOf:
        - type: object
          additionalProperties:
            description: Any type
        - type: array
          items:
            type: string
      description: Information about the error.
      title: CommonErrorNameMessageDetailsErrorDetails
    CommonErrorNameMessageDetailsError:
      type: object
      properties:
        name:
          type: string
          description: The error name.
        message:
          type: string
          description: The error message.
        details:
          $ref: '#/components/schemas/CommonErrorNameMessageDetailsErrorDetails'
          description: Information about the error.
      title: CommonErrorNameMessageDetailsError
    commonErrorNameMessageDetails:
      type: object
      properties:
        error:
          $ref: '#/components/schemas/CommonErrorNameMessageDetailsError'
      title: commonErrorNameMessageDetails
    CommonErrorTypeTitleDetailDetail:
      oneOf:
        - type: string
        - type: object
          additionalProperties:
            description: Any type
      description: Information about the error.
      title: CommonErrorTypeTitleDetailDetail
    commonErrorTypeTitleDetail:
      type: object
      properties:
        type:
          type: string
          description: The type of error.
        title:
          type: string
          description: A short summary of the problem.
        detail:
          $ref: '#/components/schemas/CommonErrorTypeTitleDetailDetail'
          description: Information about the error.
      title: commonErrorTypeTitleDetail
    MergeCollectionForkRequestInternalServerError:
      oneOf:
        - $ref: '#/components/schemas/commonErrorTypeTitleDetail'
        - $ref: '#/components/schemas/commonErrorTypeTitleDetailStatus'
        - $ref: '#/components/schemas/commonErrorNameMessage'
      title: MergeCollectionForkRequestInternalServerError
  securitySchemes:
    PostmanApiKey:
      type: apiKey
      in: header
      name: x-api-key
    scimApiKey:
      type: apiKey
      in: header
      name: Authorization
      description: >-
        A valid [SCIM API
        key](https://learning.postman.com/docs/administration/scim-provisioning/scim-provisioning-overview/#generating-scim-api-key)
        for calls to SCIM endpoints.
    basicAuth:
      type: http
      scheme: basic

```

## Examples

### Collection Fork Merged



**Request**

```json
undefined
```

**Response**

```json
{
  "collection": {
    "id": "12ece9e1-2abf-4edc-8e34-de66e74114d2",
    "uid": "12345678-12ece9e1-2abf-4edc-8e34-de66e74114d2"
  }
}
```

**SDK Code**

```python Collection Fork Merged
import requests

url = "https://api.getpostman.com/collections/merge"

headers = {
    "x-api-key": "<apiKey>",
    "Content-Type": "application/json"
}

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

print(response.json())
```

```javascript Collection Fork Merged
const url = 'https://api.getpostman.com/collections/merge';
const options = {
  method: 'POST',
  headers: {'x-api-key': '<apiKey>', 'Content-Type': 'application/json'},
  body: undefined
};

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

```go Collection Fork Merged
package main

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

func main() {

	url := "https://api.getpostman.com/collections/merge"

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

	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 Collection Fork Merged
require 'uri'
require 'net/http'

url = URI("https://api.getpostman.com/collections/merge")

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'

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

```java Collection Fork Merged
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.getpostman.com/collections/merge")
  .header("x-api-key", "<apiKey>")
  .header("Content-Type", "application/json")
  .asString();
```

```php Collection Fork Merged
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.getpostman.com/collections/merge', [
  'headers' => [
    'Content-Type' => 'application/json',
    'x-api-key' => '<apiKey>',
  ],
]);

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

```csharp Collection Fork Merged
using RestSharp;

var client = new RestClient("https://api.getpostman.com/collections/merge");
var request = new RestRequest(Method.POST);
request.AddHeader("x-api-key", "<apiKey>");
request.AddHeader("Content-Type", "application/json");
IRestResponse response = client.Execute(request);
```

```swift Collection Fork Merged
import Foundation

let headers = [
  "x-api-key": "<apiKey>",
  "Content-Type": "application/json"
]

let request = NSMutableURLRequest(url: NSURL(string: "https://api.getpostman.com/collections/merge")! 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()
```

### Merge Fork



**Request**

```json
{
  "destination": "12345678-09547fef-a9a5-4e00-998b-aa563e8db69a",
  "source": "12345678-12ece9e1-2abf-4edc-8e34-de66e74114d2",
  "strategy": "deleteSource"
}
```

**Response**

```json
{
  "collection": {
    "id": "12ece9e1-2abf-4edc-8e34-de66e74114d2",
    "uid": "12345678-12ece9e1-2abf-4edc-8e34-de66e74114d2"
  }
}
```

**SDK Code**

```python Merge Fork
import requests

url = "https://api.getpostman.com/collections/merge"

payload = {
    "destination": "12345678-09547fef-a9a5-4e00-998b-aa563e8db69a",
    "source": "12345678-12ece9e1-2abf-4edc-8e34-de66e74114d2",
    "strategy": "deleteSource"
}
headers = {
    "x-api-key": "<apiKey>",
    "Content-Type": "application/json"
}

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

print(response.json())
```

```javascript Merge Fork
const url = 'https://api.getpostman.com/collections/merge';
const options = {
  method: 'POST',
  headers: {'x-api-key': '<apiKey>', 'Content-Type': 'application/json'},
  body: '{"destination":"12345678-09547fef-a9a5-4e00-998b-aa563e8db69a","source":"12345678-12ece9e1-2abf-4edc-8e34-de66e74114d2","strategy":"deleteSource"}'
};

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

```go Merge Fork
package main

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

func main() {

	url := "https://api.getpostman.com/collections/merge"

	payload := strings.NewReader("{\n  \"destination\": \"12345678-09547fef-a9a5-4e00-998b-aa563e8db69a\",\n  \"source\": \"12345678-12ece9e1-2abf-4edc-8e34-de66e74114d2\",\n  \"strategy\": \"deleteSource\"\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 Merge Fork
require 'uri'
require 'net/http'

url = URI("https://api.getpostman.com/collections/merge")

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  \"destination\": \"12345678-09547fef-a9a5-4e00-998b-aa563e8db69a\",\n  \"source\": \"12345678-12ece9e1-2abf-4edc-8e34-de66e74114d2\",\n  \"strategy\": \"deleteSource\"\n}"

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

```java Merge Fork
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.getpostman.com/collections/merge")
  .header("x-api-key", "<apiKey>")
  .header("Content-Type", "application/json")
  .body("{\n  \"destination\": \"12345678-09547fef-a9a5-4e00-998b-aa563e8db69a\",\n  \"source\": \"12345678-12ece9e1-2abf-4edc-8e34-de66e74114d2\",\n  \"strategy\": \"deleteSource\"\n}")
  .asString();
```

```php Merge Fork
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.getpostman.com/collections/merge', [
  'body' => '{
  "destination": "12345678-09547fef-a9a5-4e00-998b-aa563e8db69a",
  "source": "12345678-12ece9e1-2abf-4edc-8e34-de66e74114d2",
  "strategy": "deleteSource"
}',
  'headers' => [
    'Content-Type' => 'application/json',
    'x-api-key' => '<apiKey>',
  ],
]);

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

```csharp Merge Fork
using RestSharp;

var client = new RestClient("https://api.getpostman.com/collections/merge");
var request = new RestRequest(Method.POST);
request.AddHeader("x-api-key", "<apiKey>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"destination\": \"12345678-09547fef-a9a5-4e00-998b-aa563e8db69a\",\n  \"source\": \"12345678-12ece9e1-2abf-4edc-8e34-de66e74114d2\",\n  \"strategy\": \"deleteSource\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Merge Fork
import Foundation

let headers = [
  "x-api-key": "<apiKey>",
  "Content-Type": "application/json"
]
let parameters = [
  "destination": "12345678-09547fef-a9a5-4e00-998b-aa563e8db69a",
  "source": "12345678-12ece9e1-2abf-4edc-8e34-de66e74114d2",
  "strategy": "deleteSource"
] as [String : Any]

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

let request = NSMutableURLRequest(url: NSURL(string: "https://api.getpostman.com/collections/merge")! 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()
```