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

# Create an access request

POST https://api.getpostman.com/teams/{teamId}/access-requests
Content-Type: application/json

Creates an access request for a team. Access requests include actions such as request to join a team, upgrading a user's role, adding members, and requesting team role access to another team.

**Note:**

If a team discovery is enabled, the team's access request is automatically approved.


Reference: https://learning.postman.com/api-docs/api-reference/teams/create-access-request

## OpenAPI Specification

```yaml
openapi: 3.1.0
info:
  title: Postman API
  version: 1.0.0
paths:
  /teams/{teamId}/access-requests:
    post:
      operationId: createAccessRequest
      summary: Create an access request
      description: >
        Creates an access request for a team. Access requests include actions
        such as request to join a team, upgrading a user's role, adding members,
        and requesting team role access to another team.


        **Note:**


        If a team discovery is enabled, the team's access request is
        automatically approved.
      tags:
        - teams
      parameters:
        - name: teamId
          in: path
          description: The team's ID.
          required: true
          schema:
            $ref: '#/components/schemas/teamId'
        - name: x-api-key
          in: header
          required: true
          schema:
            type: string
        - name: identifierType
          in: header
          description: Use SCIM user and group IDs instead of Postman user IDs.
          required: false
          schema:
            $ref: '#/components/schemas/identifierType'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/createAccessRequestResponse'
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CreateAccessRequestRequestBadRequestError'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/commonErrorTypeTitleDetailStatusInstance'
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/teamsError'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/createAccessRequest'
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:
    teamId:
      type: integer
      title: teamId
    identifierType:
      type: string
      title: identifierType
    TeamEntityInfoEntityType:
      type: string
      enum:
        - user
        - group
        - team
        - organization
      description: The entity type.
      title: TeamEntityInfoEntityType
    TeamEntityInfoEntityId:
      oneOf:
        - type: integer
        - type: string
      description: The entity's ID.
      title: TeamEntityInfoEntityId
    teamEntityInfo:
      type: object
      properties:
        entityType:
          $ref: '#/components/schemas/TeamEntityInfoEntityType'
          description: The entity type.
        entityId:
          $ref: '#/components/schemas/TeamEntityInfoEntityId'
          description: The entity's ID.
      required:
        - entityType
        - entityId
      title: teamEntityInfo
    CreateAccessRequestRole:
      type: string
      enum:
        - TEAM_MANAGER
        - TEAM_DEVELOPER
        - TEAM_GUEST_DEVELOPER
        - TEAM_GUEST_VIEWER
        - TEAM_PARTNER_MANAGER
        - TEAM_PARTNER_LEAD
        - TEAM_GUEST
        - TEAM_PARTNER
        - TEAM_COMMUNITY_MANAGER
      description: The team role to request.
      title: CreateAccessRequestRole
    CreateAccessRequestRequestType:
      type: string
      enum:
        - REQUEST_TO_ADD_MEMBERS
        - REQUEST_TO_JOIN
        - UPGRADE_ROLE
      description: The type of access request.
      title: CreateAccessRequestRequestType
    createAccessRequest:
      type: object
      properties:
        entityList:
          type: array
          items:
            $ref: '#/components/schemas/teamEntityInfo'
          description: A list of the entities for which to create access requests.
        role:
          oneOf:
            - $ref: '#/components/schemas/CreateAccessRequestRole'
            - type: 'null'
          description: The team role to request.
        reason:
          type: string
          description: The reason for the access request.
        requestType:
          $ref: '#/components/schemas/CreateAccessRequestRequestType'
          description: The type of access request.
      required:
        - entityList
        - role
        - reason
        - requestType
      title: createAccessRequest
    TeamsAccessRequestDataEntityId:
      oneOf:
        - type: integer
        - type: string
      description: The entity's ID.
      title: TeamsAccessRequestDataEntityId
    teamsAccessRequestData:
      type: object
      properties:
        entityType:
          type: string
          description: The entity type.
        entityId:
          $ref: '#/components/schemas/TeamsAccessRequestDataEntityId'
          description: The entity's ID.
        role:
          type: string
          description: The entity's role.
        previousRole:
          type:
            - string
            - 'null'
          description: >-
            The entity's previous role. This value only returns if the entity's
            role is modified.
        status:
          type: string
          description: The request's status.
        reason:
          type: string
          description: >-
            The reason for the access request. This only returns if there's an
            issue with the request.
      title: teamsAccessRequestData
    createAccessRequestResponse:
      type: object
      properties:
        result:
          type: array
          items:
            $ref: '#/components/schemas/teamsAccessRequestData'
      title: createAccessRequestResponse
    TeamsErrorDetailError:
      type: object
      properties:
        name:
          type: string
          description: The error name.
        message:
          type: string
          description: The error message.
      description: Information about the error.
      title: TeamsErrorDetailError
    teamsErrorDetail:
      type: object
      properties:
        error:
          $ref: '#/components/schemas/TeamsErrorDetailError'
          description: Information about the error.
      description: An explanation about the problem.
      title: teamsErrorDetail
    TeamsErrorDetailInvalidEntriesResultItemsEntityId:
      oneOf:
        - type: integer
        - type: string
      description: The entity ID.
      title: TeamsErrorDetailInvalidEntriesResultItemsEntityId
    TeamsErrorDetailInvalidEntriesResultItems:
      type: object
      properties:
        entityType:
          type: string
          description: The entity type.
        entityId:
          $ref: >-
            #/components/schemas/TeamsErrorDetailInvalidEntriesResultItemsEntityId
          description: The entity ID.
        role:
          type:
            - string
            - 'null'
          description: The assigned role.
        status:
          type: string
          description: The `Invalid` response status.
        reason:
          type: string
          description: The reason for the error.
      title: TeamsErrorDetailInvalidEntriesResultItems
    teamsErrorDetailInvalidEntries:
      type: object
      properties:
        error:
          type: string
          description: The error message.
        result:
          type: array
          items:
            $ref: '#/components/schemas/TeamsErrorDetailInvalidEntriesResultItems'
          description: A list of invalid entities.
      description: An explanation about the problem.
      title: teamsErrorDetailInvalidEntries
    TeamsErrorDetail:
      oneOf:
        - $ref: '#/components/schemas/teamsErrorDetail'
        - $ref: '#/components/schemas/teamsErrorDetailInvalidEntries'
      title: TeamsErrorDetail
    teamsError:
      type: object
      properties:
        type:
          type: string
          format: uri-reference
          description: >-
            The [URI reference](https://www.rfc-editor.org/rfc/rfc3986) that
            identifies the type of problem.
        status:
          type: integer
          description: The HTTP status code generated by the origin server.
        title:
          type: string
          description: A short summary of the problem.
        detail:
          $ref: '#/components/schemas/TeamsErrorDetail'
        instance:
          type: string
          description: >-
            The URI reference that identifies the specific occurrence of the
            problem.
      title: teamsError
    commonErrorTypeTitleDetailStatusInstance:
      type: object
      properties:
        type:
          type: string
          format: uri-reference
          description: >-
            The [URI reference](https://www.rfc-editor.org/rfc/rfc3986) that
            identifies the type of problem.
        title:
          type: string
          description: A short summary of the problem.
        detail:
          type: string
          description: An explanation about the problem.
        status:
          type: integer
          description: The HTTP status code generated by the origin server.
        instance:
          type: string
          description: >-
            The URI reference that identifies the specific occurrence of the
            problem.
      title: commonErrorTypeTitleDetailStatusInstance
    CreateAccessRequestRequestBadRequestError:
      oneOf:
        - $ref: '#/components/schemas/teamsError'
        - $ref: '#/components/schemas/commonErrorTypeTitleDetailStatusInstance'
      title: CreateAccessRequestRequestBadRequestError
  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

### Request a Role for User



**Request**

```json
{
  "entityList": [
    {
      "entityType": "user",
      "entityId": "12345678"
    }
  ],
  "role": "TEAM_MANAGER",
  "reason": "Needs the manager role.",
  "requestType": "UPGRADE_ROLE"
}
```

**Response**

```json
{
  "result": [
    {
      "entityType": "user",
      "entityId": 12345678,
      "role": "TEAM_MANAGER",
      "status": "Skipped",
      "reason": "Entity has this role"
    }
  ]
}
```

**SDK Code**

```python Request a Role for User
import requests

url = "https://api.getpostman.com/teams/123/access-requests"

payload = {
    "entityList": [
        {
            "entityType": "user",
            "entityId": "12345678"
        }
    ],
    "role": "TEAM_MANAGER",
    "reason": "Needs the manager role.",
    "requestType": "UPGRADE_ROLE"
}
headers = {
    "x-api-key": "<apiKey>",
    "Content-Type": "application/json"
}

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

print(response.json())
```

```javascript Request a Role for User
const url = 'https://api.getpostman.com/teams/123/access-requests';
const options = {
  method: 'POST',
  headers: {'x-api-key': '<apiKey>', 'Content-Type': 'application/json'},
  body: '{"entityList":[{"entityType":"user","entityId":"12345678"}],"role":"TEAM_MANAGER","reason":"Needs the manager role.","requestType":"UPGRADE_ROLE"}'
};

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

```go Request a Role for User
package main

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

func main() {

	url := "https://api.getpostman.com/teams/123/access-requests"

	payload := strings.NewReader("{\n  \"entityList\": [\n    {\n      \"entityType\": \"user\",\n      \"entityId\": \"12345678\"\n    }\n  ],\n  \"role\": \"TEAM_MANAGER\",\n  \"reason\": \"Needs the manager role.\",\n  \"requestType\": \"UPGRADE_ROLE\"\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 Request a Role for User
require 'uri'
require 'net/http'

url = URI("https://api.getpostman.com/teams/123/access-requests")

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  \"entityList\": [\n    {\n      \"entityType\": \"user\",\n      \"entityId\": \"12345678\"\n    }\n  ],\n  \"role\": \"TEAM_MANAGER\",\n  \"reason\": \"Needs the manager role.\",\n  \"requestType\": \"UPGRADE_ROLE\"\n}"

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

```java Request a Role for User
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.getpostman.com/teams/123/access-requests")
  .header("x-api-key", "<apiKey>")
  .header("Content-Type", "application/json")
  .body("{\n  \"entityList\": [\n    {\n      \"entityType\": \"user\",\n      \"entityId\": \"12345678\"\n    }\n  ],\n  \"role\": \"TEAM_MANAGER\",\n  \"reason\": \"Needs the manager role.\",\n  \"requestType\": \"UPGRADE_ROLE\"\n}")
  .asString();
```

```php Request a Role for User
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.getpostman.com/teams/123/access-requests', [
  'body' => '{
  "entityList": [
    {
      "entityType": "user",
      "entityId": "12345678"
    }
  ],
  "role": "TEAM_MANAGER",
  "reason": "Needs the manager role.",
  "requestType": "UPGRADE_ROLE"
}',
  'headers' => [
    'Content-Type' => 'application/json',
    'x-api-key' => '<apiKey>',
  ],
]);

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

```csharp Request a Role for User
using RestSharp;

var client = new RestClient("https://api.getpostman.com/teams/123/access-requests");
var request = new RestRequest(Method.POST);
request.AddHeader("x-api-key", "<apiKey>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"entityList\": [\n    {\n      \"entityType\": \"user\",\n      \"entityId\": \"12345678\"\n    }\n  ],\n  \"role\": \"TEAM_MANAGER\",\n  \"reason\": \"Needs the manager role.\",\n  \"requestType\": \"UPGRADE_ROLE\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Request a Role for User
import Foundation

let headers = [
  "x-api-key": "<apiKey>",
  "Content-Type": "application/json"
]
let parameters = [
  "entityList": [
    [
      "entityType": "user",
      "entityId": "12345678"
    ]
  ],
  "role": "TEAM_MANAGER",
  "reason": "Needs the manager role.",
  "requestType": "UPGRADE_ROLE"
] as [String : Any]

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

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

### Request User as Guest Viewer



**Request**

```json
{
  "entityList": [
    {
      "entityType": "user",
      "entityId": "87654321"
    }
  ],
  "role": "TEAM_GUEST_VIEWER",
  "reason": "",
  "requestType": "REQUEST_TO_ADD_MEMBERS"
}
```

**Response**

```json
{
  "result": [
    {
      "entityType": "user",
      "entityId": 87654321,
      "role": "TEAM_GUEST_VIEWER",
      "previousRole": null,
      "status": "Accepted"
    }
  ]
}
```

**SDK Code**

```python Request User as Guest Viewer
import requests

url = "https://api.getpostman.com/teams/123/access-requests"

payload = {
    "entityList": [
        {
            "entityType": "user",
            "entityId": "87654321"
        }
    ],
    "role": "TEAM_GUEST_VIEWER",
    "reason": "",
    "requestType": "REQUEST_TO_ADD_MEMBERS"
}
headers = {
    "x-api-key": "<apiKey>",
    "Content-Type": "application/json"
}

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

print(response.json())
```

```javascript Request User as Guest Viewer
const url = 'https://api.getpostman.com/teams/123/access-requests';
const options = {
  method: 'POST',
  headers: {'x-api-key': '<apiKey>', 'Content-Type': 'application/json'},
  body: '{"entityList":[{"entityType":"user","entityId":"87654321"}],"role":"TEAM_GUEST_VIEWER","reason":"","requestType":"REQUEST_TO_ADD_MEMBERS"}'
};

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

```go Request User as Guest Viewer
package main

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

func main() {

	url := "https://api.getpostman.com/teams/123/access-requests"

	payload := strings.NewReader("{\n  \"entityList\": [\n    {\n      \"entityType\": \"user\",\n      \"entityId\": \"87654321\"\n    }\n  ],\n  \"role\": \"TEAM_GUEST_VIEWER\",\n  \"reason\": \"\",\n  \"requestType\": \"REQUEST_TO_ADD_MEMBERS\"\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 Request User as Guest Viewer
require 'uri'
require 'net/http'

url = URI("https://api.getpostman.com/teams/123/access-requests")

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  \"entityList\": [\n    {\n      \"entityType\": \"user\",\n      \"entityId\": \"87654321\"\n    }\n  ],\n  \"role\": \"TEAM_GUEST_VIEWER\",\n  \"reason\": \"\",\n  \"requestType\": \"REQUEST_TO_ADD_MEMBERS\"\n}"

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

```java Request User as Guest Viewer
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.getpostman.com/teams/123/access-requests")
  .header("x-api-key", "<apiKey>")
  .header("Content-Type", "application/json")
  .body("{\n  \"entityList\": [\n    {\n      \"entityType\": \"user\",\n      \"entityId\": \"87654321\"\n    }\n  ],\n  \"role\": \"TEAM_GUEST_VIEWER\",\n  \"reason\": \"\",\n  \"requestType\": \"REQUEST_TO_ADD_MEMBERS\"\n}")
  .asString();
```

```php Request User as Guest Viewer
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.getpostman.com/teams/123/access-requests', [
  'body' => '{
  "entityList": [
    {
      "entityType": "user",
      "entityId": "87654321"
    }
  ],
  "role": "TEAM_GUEST_VIEWER",
  "reason": "",
  "requestType": "REQUEST_TO_ADD_MEMBERS"
}',
  'headers' => [
    'Content-Type' => 'application/json',
    'x-api-key' => '<apiKey>',
  ],
]);

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

```csharp Request User as Guest Viewer
using RestSharp;

var client = new RestClient("https://api.getpostman.com/teams/123/access-requests");
var request = new RestRequest(Method.POST);
request.AddHeader("x-api-key", "<apiKey>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"entityList\": [\n    {\n      \"entityType\": \"user\",\n      \"entityId\": \"87654321\"\n    }\n  ],\n  \"role\": \"TEAM_GUEST_VIEWER\",\n  \"reason\": \"\",\n  \"requestType\": \"REQUEST_TO_ADD_MEMBERS\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Request User as Guest Viewer
import Foundation

let headers = [
  "x-api-key": "<apiKey>",
  "Content-Type": "application/json"
]
let parameters = [
  "entityList": [
    [
      "entityType": "user",
      "entityId": "87654321"
    ]
  ],
  "role": "TEAM_GUEST_VIEWER",
  "reason": "",
  "requestType": "REQUEST_TO_ADD_MEMBERS"
] as [String : Any]

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

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

### Request to Add Users as Guest Developers



**Request**

```json
{
  "entityList": [
    {
      "entityType": "user",
      "entityId": "87654321"
    },
    {
      "entityType": "user",
      "entityId": "45678123"
    }
  ],
  "role": "TEAM_GUEST_DEVELOPER",
  "reason": "Joining for debugging.",
  "requestType": "REQUEST_TO_ADD_MEMBERS"
}
```

**Response**

```json
{
  "result": [
    {
      "entityType": "user",
      "entityId": 87654321,
      "role": "TEAM_GUEST_DEVELOPER",
      "previousRole": null,
      "status": "Accepted"
    },
    {
      "entityType": "user",
      "entityId": 45678123,
      "role": "TEAM_GUEST_DEVELOPER",
      "previousRole": null,
      "status": "Accepted"
    }
  ]
}
```

**SDK Code**

```python Request to Add Users as Guest Developers
import requests

url = "https://api.getpostman.com/teams/123/access-requests"

payload = {
    "entityList": [
        {
            "entityType": "user",
            "entityId": "87654321"
        },
        {
            "entityType": "user",
            "entityId": "45678123"
        }
    ],
    "role": "TEAM_GUEST_DEVELOPER",
    "reason": "Joining for debugging.",
    "requestType": "REQUEST_TO_ADD_MEMBERS"
}
headers = {
    "x-api-key": "<apiKey>",
    "Content-Type": "application/json"
}

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

print(response.json())
```

```javascript Request to Add Users as Guest Developers
const url = 'https://api.getpostman.com/teams/123/access-requests';
const options = {
  method: 'POST',
  headers: {'x-api-key': '<apiKey>', 'Content-Type': 'application/json'},
  body: '{"entityList":[{"entityType":"user","entityId":"87654321"},{"entityType":"user","entityId":"45678123"}],"role":"TEAM_GUEST_DEVELOPER","reason":"Joining for debugging.","requestType":"REQUEST_TO_ADD_MEMBERS"}'
};

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

```go Request to Add Users as Guest Developers
package main

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

func main() {

	url := "https://api.getpostman.com/teams/123/access-requests"

	payload := strings.NewReader("{\n  \"entityList\": [\n    {\n      \"entityType\": \"user\",\n      \"entityId\": \"87654321\"\n    },\n    {\n      \"entityType\": \"user\",\n      \"entityId\": \"45678123\"\n    }\n  ],\n  \"role\": \"TEAM_GUEST_DEVELOPER\",\n  \"reason\": \"Joining for debugging.\",\n  \"requestType\": \"REQUEST_TO_ADD_MEMBERS\"\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 Request to Add Users as Guest Developers
require 'uri'
require 'net/http'

url = URI("https://api.getpostman.com/teams/123/access-requests")

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  \"entityList\": [\n    {\n      \"entityType\": \"user\",\n      \"entityId\": \"87654321\"\n    },\n    {\n      \"entityType\": \"user\",\n      \"entityId\": \"45678123\"\n    }\n  ],\n  \"role\": \"TEAM_GUEST_DEVELOPER\",\n  \"reason\": \"Joining for debugging.\",\n  \"requestType\": \"REQUEST_TO_ADD_MEMBERS\"\n}"

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

```java Request to Add Users as Guest Developers
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.getpostman.com/teams/123/access-requests")
  .header("x-api-key", "<apiKey>")
  .header("Content-Type", "application/json")
  .body("{\n  \"entityList\": [\n    {\n      \"entityType\": \"user\",\n      \"entityId\": \"87654321\"\n    },\n    {\n      \"entityType\": \"user\",\n      \"entityId\": \"45678123\"\n    }\n  ],\n  \"role\": \"TEAM_GUEST_DEVELOPER\",\n  \"reason\": \"Joining for debugging.\",\n  \"requestType\": \"REQUEST_TO_ADD_MEMBERS\"\n}")
  .asString();
```

```php Request to Add Users as Guest Developers
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.getpostman.com/teams/123/access-requests', [
  'body' => '{
  "entityList": [
    {
      "entityType": "user",
      "entityId": "87654321"
    },
    {
      "entityType": "user",
      "entityId": "45678123"
    }
  ],
  "role": "TEAM_GUEST_DEVELOPER",
  "reason": "Joining for debugging.",
  "requestType": "REQUEST_TO_ADD_MEMBERS"
}',
  'headers' => [
    'Content-Type' => 'application/json',
    'x-api-key' => '<apiKey>',
  ],
]);

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

```csharp Request to Add Users as Guest Developers
using RestSharp;

var client = new RestClient("https://api.getpostman.com/teams/123/access-requests");
var request = new RestRequest(Method.POST);
request.AddHeader("x-api-key", "<apiKey>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"entityList\": [\n    {\n      \"entityType\": \"user\",\n      \"entityId\": \"87654321\"\n    },\n    {\n      \"entityType\": \"user\",\n      \"entityId\": \"45678123\"\n    }\n  ],\n  \"role\": \"TEAM_GUEST_DEVELOPER\",\n  \"reason\": \"Joining for debugging.\",\n  \"requestType\": \"REQUEST_TO_ADD_MEMBERS\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Request to Add Users as Guest Developers
import Foundation

let headers = [
  "x-api-key": "<apiKey>",
  "Content-Type": "application/json"
]
let parameters = [
  "entityList": [
    [
      "entityType": "user",
      "entityId": "87654321"
    ],
    [
      "entityType": "user",
      "entityId": "45678123"
    ]
  ],
  "role": "TEAM_GUEST_DEVELOPER",
  "reason": "Joining for debugging.",
  "requestType": "REQUEST_TO_ADD_MEMBERS"
] as [String : Any]

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

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

### Request a Role Upgrade



**Request**

```json
{
  "entityList": [
    {
      "entityType": "user",
      "entityId": "12345678"
    }
  ],
  "role": "TEAM_MANAGER",
  "reason": "I need the team manager role.",
  "requestType": "UPGRADE_ROLE"
}
```

**Response**

```json
{
  "result": [
    {
      "entityType": "user",
      "entityId": 12345678,
      "role": "TEAM_MANAGER",
      "previousRole": "TEAM_DEVELOPER",
      "status": "Accepted"
    }
  ]
}
```

**SDK Code**

```python Request a Role Upgrade
import requests

url = "https://api.getpostman.com/teams/123/access-requests"

payload = {
    "entityList": [
        {
            "entityType": "user",
            "entityId": "12345678"
        }
    ],
    "role": "TEAM_MANAGER",
    "reason": "I need the team manager role.",
    "requestType": "UPGRADE_ROLE"
}
headers = {
    "x-api-key": "<apiKey>",
    "Content-Type": "application/json"
}

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

print(response.json())
```

```javascript Request a Role Upgrade
const url = 'https://api.getpostman.com/teams/123/access-requests';
const options = {
  method: 'POST',
  headers: {'x-api-key': '<apiKey>', 'Content-Type': 'application/json'},
  body: '{"entityList":[{"entityType":"user","entityId":"12345678"}],"role":"TEAM_MANAGER","reason":"I need the team manager role.","requestType":"UPGRADE_ROLE"}'
};

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

```go Request a Role Upgrade
package main

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

func main() {

	url := "https://api.getpostman.com/teams/123/access-requests"

	payload := strings.NewReader("{\n  \"entityList\": [\n    {\n      \"entityType\": \"user\",\n      \"entityId\": \"12345678\"\n    }\n  ],\n  \"role\": \"TEAM_MANAGER\",\n  \"reason\": \"I need the team manager role.\",\n  \"requestType\": \"UPGRADE_ROLE\"\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 Request a Role Upgrade
require 'uri'
require 'net/http'

url = URI("https://api.getpostman.com/teams/123/access-requests")

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  \"entityList\": [\n    {\n      \"entityType\": \"user\",\n      \"entityId\": \"12345678\"\n    }\n  ],\n  \"role\": \"TEAM_MANAGER\",\n  \"reason\": \"I need the team manager role.\",\n  \"requestType\": \"UPGRADE_ROLE\"\n}"

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

```java Request a Role Upgrade
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.getpostman.com/teams/123/access-requests")
  .header("x-api-key", "<apiKey>")
  .header("Content-Type", "application/json")
  .body("{\n  \"entityList\": [\n    {\n      \"entityType\": \"user\",\n      \"entityId\": \"12345678\"\n    }\n  ],\n  \"role\": \"TEAM_MANAGER\",\n  \"reason\": \"I need the team manager role.\",\n  \"requestType\": \"UPGRADE_ROLE\"\n}")
  .asString();
```

```php Request a Role Upgrade
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.getpostman.com/teams/123/access-requests', [
  'body' => '{
  "entityList": [
    {
      "entityType": "user",
      "entityId": "12345678"
    }
  ],
  "role": "TEAM_MANAGER",
  "reason": "I need the team manager role.",
  "requestType": "UPGRADE_ROLE"
}',
  'headers' => [
    'Content-Type' => 'application/json',
    'x-api-key' => '<apiKey>',
  ],
]);

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

```csharp Request a Role Upgrade
using RestSharp;

var client = new RestClient("https://api.getpostman.com/teams/123/access-requests");
var request = new RestRequest(Method.POST);
request.AddHeader("x-api-key", "<apiKey>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"entityList\": [\n    {\n      \"entityType\": \"user\",\n      \"entityId\": \"12345678\"\n    }\n  ],\n  \"role\": \"TEAM_MANAGER\",\n  \"reason\": \"I need the team manager role.\",\n  \"requestType\": \"UPGRADE_ROLE\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Request a Role Upgrade
import Foundation

let headers = [
  "x-api-key": "<apiKey>",
  "Content-Type": "application/json"
]
let parameters = [
  "entityList": [
    [
      "entityType": "user",
      "entityId": "12345678"
    ]
  ],
  "role": "TEAM_MANAGER",
  "reason": "I need the team manager role.",
  "requestType": "UPGRADE_ROLE"
] as [String : Any]

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

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

### Request Team as Guest Viewer to a Team



**Request**

```json
{
  "entityList": [
    {
      "entityType": "team",
      "entityId": "432"
    }
  ],
  "role": "TEAM_GUEST_VIEWER",
  "reason": "",
  "requestType": "REQUEST_TO_ADD_MEMBERS"
}
```

**Response**

```json
{
  "result": [
    {
      "entityType": "team",
      "entityId": 432,
      "role": "TEAM_GUEST_VIEWER",
      "previousRole": null,
      "status": "Accepted"
    }
  ]
}
```

**SDK Code**

```python Request Team as Guest Viewer to a Team
import requests

url = "https://api.getpostman.com/teams/123/access-requests"

payload = {
    "entityList": [
        {
            "entityType": "team",
            "entityId": "432"
        }
    ],
    "role": "TEAM_GUEST_VIEWER",
    "reason": "",
    "requestType": "REQUEST_TO_ADD_MEMBERS"
}
headers = {
    "x-api-key": "<apiKey>",
    "Content-Type": "application/json"
}

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

print(response.json())
```

```javascript Request Team as Guest Viewer to a Team
const url = 'https://api.getpostman.com/teams/123/access-requests';
const options = {
  method: 'POST',
  headers: {'x-api-key': '<apiKey>', 'Content-Type': 'application/json'},
  body: '{"entityList":[{"entityType":"team","entityId":"432"}],"role":"TEAM_GUEST_VIEWER","reason":"","requestType":"REQUEST_TO_ADD_MEMBERS"}'
};

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

```go Request Team as Guest Viewer to a Team
package main

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

func main() {

	url := "https://api.getpostman.com/teams/123/access-requests"

	payload := strings.NewReader("{\n  \"entityList\": [\n    {\n      \"entityType\": \"team\",\n      \"entityId\": \"432\"\n    }\n  ],\n  \"role\": \"TEAM_GUEST_VIEWER\",\n  \"reason\": \"\",\n  \"requestType\": \"REQUEST_TO_ADD_MEMBERS\"\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 Request Team as Guest Viewer to a Team
require 'uri'
require 'net/http'

url = URI("https://api.getpostman.com/teams/123/access-requests")

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  \"entityList\": [\n    {\n      \"entityType\": \"team\",\n      \"entityId\": \"432\"\n    }\n  ],\n  \"role\": \"TEAM_GUEST_VIEWER\",\n  \"reason\": \"\",\n  \"requestType\": \"REQUEST_TO_ADD_MEMBERS\"\n}"

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

```java Request Team as Guest Viewer to a Team
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.getpostman.com/teams/123/access-requests")
  .header("x-api-key", "<apiKey>")
  .header("Content-Type", "application/json")
  .body("{\n  \"entityList\": [\n    {\n      \"entityType\": \"team\",\n      \"entityId\": \"432\"\n    }\n  ],\n  \"role\": \"TEAM_GUEST_VIEWER\",\n  \"reason\": \"\",\n  \"requestType\": \"REQUEST_TO_ADD_MEMBERS\"\n}")
  .asString();
```

```php Request Team as Guest Viewer to a Team
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.getpostman.com/teams/123/access-requests', [
  'body' => '{
  "entityList": [
    {
      "entityType": "team",
      "entityId": "432"
    }
  ],
  "role": "TEAM_GUEST_VIEWER",
  "reason": "",
  "requestType": "REQUEST_TO_ADD_MEMBERS"
}',
  'headers' => [
    'Content-Type' => 'application/json',
    'x-api-key' => '<apiKey>',
  ],
]);

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

```csharp Request Team as Guest Viewer to a Team
using RestSharp;

var client = new RestClient("https://api.getpostman.com/teams/123/access-requests");
var request = new RestRequest(Method.POST);
request.AddHeader("x-api-key", "<apiKey>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"entityList\": [\n    {\n      \"entityType\": \"team\",\n      \"entityId\": \"432\"\n    }\n  ],\n  \"role\": \"TEAM_GUEST_VIEWER\",\n  \"reason\": \"\",\n  \"requestType\": \"REQUEST_TO_ADD_MEMBERS\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Request Team as Guest Viewer to a Team
import Foundation

let headers = [
  "x-api-key": "<apiKey>",
  "Content-Type": "application/json"
]
let parameters = [
  "entityList": [
    [
      "entityType": "team",
      "entityId": "432"
    ]
  ],
  "role": "TEAM_GUEST_VIEWER",
  "reason": "",
  "requestType": "REQUEST_TO_ADD_MEMBERS"
] as [String : Any]

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

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

### Request to Add Organization



**Request**

```json
{
  "entityList": [
    {
      "entityType": "organization",
      "entityId": "456"
    }
  ],
  "role": "TEAM_GUEST_VIEWER",
  "reason": "",
  "requestType": "REQUEST_TO_ADD_MEMBERS"
}
```

**Response**

```json
{
  "result": [
    {
      "entityType": "organization",
      "entityId": 456,
      "role": "TEAM_GUEST_VIEWER",
      "previousRole": null,
      "status": "Accepted"
    }
  ]
}
```

**SDK Code**

```python Request to Add Organization
import requests

url = "https://api.getpostman.com/teams/123/access-requests"

payload = {
    "entityList": [
        {
            "entityType": "organization",
            "entityId": "456"
        }
    ],
    "role": "TEAM_GUEST_VIEWER",
    "reason": "",
    "requestType": "REQUEST_TO_ADD_MEMBERS"
}
headers = {
    "x-api-key": "<apiKey>",
    "Content-Type": "application/json"
}

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

print(response.json())
```

```javascript Request to Add Organization
const url = 'https://api.getpostman.com/teams/123/access-requests';
const options = {
  method: 'POST',
  headers: {'x-api-key': '<apiKey>', 'Content-Type': 'application/json'},
  body: '{"entityList":[{"entityType":"organization","entityId":"456"}],"role":"TEAM_GUEST_VIEWER","reason":"","requestType":"REQUEST_TO_ADD_MEMBERS"}'
};

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

```go Request to Add Organization
package main

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

func main() {

	url := "https://api.getpostman.com/teams/123/access-requests"

	payload := strings.NewReader("{\n  \"entityList\": [\n    {\n      \"entityType\": \"organization\",\n      \"entityId\": \"456\"\n    }\n  ],\n  \"role\": \"TEAM_GUEST_VIEWER\",\n  \"reason\": \"\",\n  \"requestType\": \"REQUEST_TO_ADD_MEMBERS\"\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 Request to Add Organization
require 'uri'
require 'net/http'

url = URI("https://api.getpostman.com/teams/123/access-requests")

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  \"entityList\": [\n    {\n      \"entityType\": \"organization\",\n      \"entityId\": \"456\"\n    }\n  ],\n  \"role\": \"TEAM_GUEST_VIEWER\",\n  \"reason\": \"\",\n  \"requestType\": \"REQUEST_TO_ADD_MEMBERS\"\n}"

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

```java Request to Add Organization
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.getpostman.com/teams/123/access-requests")
  .header("x-api-key", "<apiKey>")
  .header("Content-Type", "application/json")
  .body("{\n  \"entityList\": [\n    {\n      \"entityType\": \"organization\",\n      \"entityId\": \"456\"\n    }\n  ],\n  \"role\": \"TEAM_GUEST_VIEWER\",\n  \"reason\": \"\",\n  \"requestType\": \"REQUEST_TO_ADD_MEMBERS\"\n}")
  .asString();
```

```php Request to Add Organization
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.getpostman.com/teams/123/access-requests', [
  'body' => '{
  "entityList": [
    {
      "entityType": "organization",
      "entityId": "456"
    }
  ],
  "role": "TEAM_GUEST_VIEWER",
  "reason": "",
  "requestType": "REQUEST_TO_ADD_MEMBERS"
}',
  'headers' => [
    'Content-Type' => 'application/json',
    'x-api-key' => '<apiKey>',
  ],
]);

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

```csharp Request to Add Organization
using RestSharp;

var client = new RestClient("https://api.getpostman.com/teams/123/access-requests");
var request = new RestRequest(Method.POST);
request.AddHeader("x-api-key", "<apiKey>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"entityList\": [\n    {\n      \"entityType\": \"organization\",\n      \"entityId\": \"456\"\n    }\n  ],\n  \"role\": \"TEAM_GUEST_VIEWER\",\n  \"reason\": \"\",\n  \"requestType\": \"REQUEST_TO_ADD_MEMBERS\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Request to Add Organization
import Foundation

let headers = [
  "x-api-key": "<apiKey>",
  "Content-Type": "application/json"
]
let parameters = [
  "entityList": [
    [
      "entityType": "organization",
      "entityId": "456"
    ]
  ],
  "role": "TEAM_GUEST_VIEWER",
  "reason": "",
  "requestType": "REQUEST_TO_ADD_MEMBERS"
] as [String : Any]

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

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

### Request Organization Role Upgrade



**Request**

```json
{
  "entityList": [
    {
      "entityType": "organization",
      "entityId": "456"
    }
  ],
  "role": "TEAM_GUEST_DEVELOPER",
  "reason": "",
  "requestType": "UPGRADE_ROLE"
}
```

**Response**

```json
{
  "result": [
    {
      "entityType": "organization",
      "entityId": 456,
      "role": "TEAM_GUEST_DEVELOPER",
      "previousRole": "TEAM_GUEST_VIEWER",
      "status": "Accepted"
    }
  ]
}
```

**SDK Code**

```python Request Organization Role Upgrade
import requests

url = "https://api.getpostman.com/teams/123/access-requests"

payload = {
    "entityList": [
        {
            "entityType": "organization",
            "entityId": "456"
        }
    ],
    "role": "TEAM_GUEST_DEVELOPER",
    "reason": "",
    "requestType": "UPGRADE_ROLE"
}
headers = {
    "x-api-key": "<apiKey>",
    "Content-Type": "application/json"
}

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

print(response.json())
```

```javascript Request Organization Role Upgrade
const url = 'https://api.getpostman.com/teams/123/access-requests';
const options = {
  method: 'POST',
  headers: {'x-api-key': '<apiKey>', 'Content-Type': 'application/json'},
  body: '{"entityList":[{"entityType":"organization","entityId":"456"}],"role":"TEAM_GUEST_DEVELOPER","reason":"","requestType":"UPGRADE_ROLE"}'
};

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

```go Request Organization Role Upgrade
package main

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

func main() {

	url := "https://api.getpostman.com/teams/123/access-requests"

	payload := strings.NewReader("{\n  \"entityList\": [\n    {\n      \"entityType\": \"organization\",\n      \"entityId\": \"456\"\n    }\n  ],\n  \"role\": \"TEAM_GUEST_DEVELOPER\",\n  \"reason\": \"\",\n  \"requestType\": \"UPGRADE_ROLE\"\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 Request Organization Role Upgrade
require 'uri'
require 'net/http'

url = URI("https://api.getpostman.com/teams/123/access-requests")

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  \"entityList\": [\n    {\n      \"entityType\": \"organization\",\n      \"entityId\": \"456\"\n    }\n  ],\n  \"role\": \"TEAM_GUEST_DEVELOPER\",\n  \"reason\": \"\",\n  \"requestType\": \"UPGRADE_ROLE\"\n}"

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

```java Request Organization Role Upgrade
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.getpostman.com/teams/123/access-requests")
  .header("x-api-key", "<apiKey>")
  .header("Content-Type", "application/json")
  .body("{\n  \"entityList\": [\n    {\n      \"entityType\": \"organization\",\n      \"entityId\": \"456\"\n    }\n  ],\n  \"role\": \"TEAM_GUEST_DEVELOPER\",\n  \"reason\": \"\",\n  \"requestType\": \"UPGRADE_ROLE\"\n}")
  .asString();
```

```php Request Organization Role Upgrade
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.getpostman.com/teams/123/access-requests', [
  'body' => '{
  "entityList": [
    {
      "entityType": "organization",
      "entityId": "456"
    }
  ],
  "role": "TEAM_GUEST_DEVELOPER",
  "reason": "",
  "requestType": "UPGRADE_ROLE"
}',
  'headers' => [
    'Content-Type' => 'application/json',
    'x-api-key' => '<apiKey>',
  ],
]);

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

```csharp Request Organization Role Upgrade
using RestSharp;

var client = new RestClient("https://api.getpostman.com/teams/123/access-requests");
var request = new RestRequest(Method.POST);
request.AddHeader("x-api-key", "<apiKey>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"entityList\": [\n    {\n      \"entityType\": \"organization\",\n      \"entityId\": \"456\"\n    }\n  ],\n  \"role\": \"TEAM_GUEST_DEVELOPER\",\n  \"reason\": \"\",\n  \"requestType\": \"UPGRADE_ROLE\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Request Organization Role Upgrade
import Foundation

let headers = [
  "x-api-key": "<apiKey>",
  "Content-Type": "application/json"
]
let parameters = [
  "entityList": [
    [
      "entityType": "organization",
      "entityId": "456"
    ]
  ],
  "role": "TEAM_GUEST_DEVELOPER",
  "reason": "",
  "requestType": "UPGRADE_ROLE"
] as [String : Any]

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

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

### Request Accepted With Existing Requests



**Request**

```json
undefined
```

**Response**

```json
{
  "result": [
    {
      "entityType": "user",
      "entityId": 432,
      "role": "TEAM_DEVELOPER",
      "previousRole": null,
      "status": "Skipped",
      "reason": "RFA already exists for this entity"
    },
    {
      "entityType": "user",
      "entityId": 124,
      "role": "TEAM_DEVELOPER",
      "previousRole": null,
      "status": "Accepted"
    },
    {
      "entityType": "group",
      "entityId": 1234,
      "role": "TEAM_DEVELOPER",
      "previousRole": null,
      "status": "Accepted"
    }
  ]
}
```

**SDK Code**

```python Request Accepted With Existing Requests
import requests

url = "https://api.getpostman.com/teams/123/access-requests"

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

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

print(response.json())
```

```javascript Request Accepted With Existing Requests
const url = 'https://api.getpostman.com/teams/123/access-requests';
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 Request Accepted With Existing Requests
package main

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

func main() {

	url := "https://api.getpostman.com/teams/123/access-requests"

	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 Request Accepted With Existing Requests
require 'uri'
require 'net/http'

url = URI("https://api.getpostman.com/teams/123/access-requests")

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 Request Accepted With Existing Requests
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

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

```php Request Accepted With Existing Requests
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

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

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

```csharp Request Accepted With Existing Requests
using RestSharp;

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

```swift Request Accepted With Existing Requests
import Foundation

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

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

### User Already Has Role



**Request**

```json
undefined
```

**Response**

```json
{
  "result": [
    {
      "entityType": "team",
      "entityId": 432,
      "role": "TEAM_GUEST_DEVELOPER",
      "status": "Skipped",
      "reason": "Entity has this role"
    }
  ]
}
```

**SDK Code**

```python User Already Has Role
import requests

url = "https://api.getpostman.com/teams/123/access-requests"

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

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

print(response.json())
```

```javascript User Already Has Role
const url = 'https://api.getpostman.com/teams/123/access-requests';
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 User Already Has Role
package main

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

func main() {

	url := "https://api.getpostman.com/teams/123/access-requests"

	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 User Already Has Role
require 'uri'
require 'net/http'

url = URI("https://api.getpostman.com/teams/123/access-requests")

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 User Already Has Role
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

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

```php User Already Has Role
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

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

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

```csharp User Already Has Role
using RestSharp;

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

```swift User Already Has Role
import Foundation

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

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