createWorkspace
Creates a new Postman workspace with specified name, type, and description. Supports private, partner, and public types; private/partner require team or enterprise plan. Optionally include team ID for organizations.
Instructions
Creates a new workspace. Private/Partner workspaces require Team/Enterprise. Public names must be unique. Pass teamId if Organizations is enabled.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| workspace | No | Workspace object with name, type, description |
Implementation Reference
- tools/postman_tools.py:1501-1525 (handler)Handler class for createWorkspace tool. Sends POST request to /workspaces with workspace object payload containing name, type, description.
class CreateWorkspaceTool(ToolHandler): """Create workspace""" def __init__(self): super().__init__("createWorkspace") def get_tool_description(self) -> Tool: return Tool( name=self.name, description="Creates a new workspace. Private/Partner workspaces require Team/Enterprise. Public names must be unique. Pass teamId if Organizations is enabled.", inputSchema={ "type": "object", "properties": { "workspace": { "type": "object", "description": "Workspace object with name, type, description" } }, }, ) async def run_tool(self, args: dict) -> list[TextContent]: body = {"workspace": args.get("workspace", {})} result = await postman_api_call("POST", "/workspaces", body=body) return [TextContent(type="text", text=json.dumps(result, indent=2))] - tools/postman_tools.py:1507-1519 (schema)Input schema for createWorkspace tool. Accepts an optional workspace object with name, type, and description properties.
def get_tool_description(self) -> Tool: return Tool( name=self.name, description="Creates a new workspace. Private/Partner workspaces require Team/Enterprise. Public names must be unique. Pass teamId if Organizations is enabled.", inputSchema={ "type": "object", "properties": { "workspace": { "type": "object", "description": "Workspace object with name, type, description" } }, }, - tools/postman_tools.py:1884-1884 (registration)Registration of CreateWorkspaceTool in the register_all_tools() function's returned list.
CreateWorkspaceTool(), - tools/postman_tools.py:21-67 (helper)Helper function postman_api_call used by createWorkspace (and all other tools) to make HTTP requests to the Postman API.
async def postman_api_call( method: str, endpoint: str, body: dict | None = None, params: dict | None = None, headers: dict | None = None ) -> dict: """Make an API call to Postman API""" if not POSTMAN_API_KEY: raise RuntimeError("POSTMAN_API_KEY environment variable is not set") url = f"{POSTMAN_BASE_URL}{endpoint}" # Prepare headers request_headers = { "X-Api-Key": POSTMAN_API_KEY, "Content-Type": "application/json", } if headers: request_headers.update(headers) async with httpx.AsyncClient(timeout=30.0) as client: try: response = await client.request( method=method, url=url, json=body, params=params, headers=request_headers ) response.raise_for_status() if response.status_code == 204: return {"success": True, "message": "Operation completed successfully"} return response.json() if response.content else {"success": True} except httpx.HTTPStatusError as e: error_detail = e.response.text try: error_json = e.response.json() error_detail = json.dumps(error_json, indent=2) except: pass raise RuntimeError(f"Postman API error ({e.response.status_code}): {error_detail}") except Exception as e: raise RuntimeError(f"Request failed: {str(e)}")