> 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.

# Get a component draft

GET https://api.postman.com/components/{componentId}/drafts

Gets information about the current working draft of a component, including its content and format. Drafts represent the latest unpublished edits of a component, which may be different from the most recently published version.

Reference: https://learning.postman.com/api-docs/api-reference/components/get-component-draft

## 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

- `componentId` (string, required) — The component's ID.

## Response

### 200

Successful Response

- `content` (string, optional) — The component's draft content.
- `format` (string, optional) — The component draft's content format.

## Errors

### 400 Bad Request Error

Bad Request

- `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.

### 401 Unauthorized Error

Unauthorized

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

### 403 Forbidden Error

Forbidden

- `GetComponentDraftRequestForbiddenError`
  - 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

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

## Types

### CommonErrorTypeTitleDetailStatusType

The type of error.

- string
- string

### 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.

### 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.

### CommonErrorTypeTitleDetailDetail

Information about the error.

- string
- map from string to any

## Examples

**Response**

```json
{
  "content": "openapi: 3.0.0\ninfo:\n  title: Example API\n  version: 1.0.0",
  "format": "YAML"
}
```

**SDK Code**

```python Successful Response
import requests

url = "https://api.postman.com/components/01KT964C30J3DPJQKEACZH39N8/drafts"

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

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

print(response.json())
```

```javascript Successful Response
const url = 'https://api.postman.com/components/01KT964C30J3DPJQKEACZH39N8/drafts';
const options = {method: 'GET', 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/components/01KT964C30J3DPJQKEACZH39N8/drafts"

	req, _ := http.NewRequest("GET", 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/components/01KT964C30J3DPJQKEACZH39N8/drafts")

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

request = Net::HTTP::Get.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.get("https://api.postman.com/components/01KT964C30J3DPJQKEACZH39N8/drafts")
  .header("x-api-key", "<apiKey>")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('GET', 'https://api.postman.com/components/01KT964C30J3DPJQKEACZH39N8/drafts', [
  'headers' => [
    'x-api-key' => '<apiKey>',
  ],
]);

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

```csharp Successful Response
using RestSharp;

var client = new RestClient("https://api.postman.com/components/01KT964C30J3DPJQKEACZH39N8/drafts");
var request = new RestRequest(Method.GET);
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/components/01KT964C30J3DPJQKEACZH39N8/drafts")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "GET"
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()
```