# Globals

## Overview

Use these API operations to interact with [global helper functions](https://docs.panther.com/detections/rules/python/globals) (also called "global helpers" and simply "globals") in Panther.

To call the API, see the [How to use the Panther REST API](https://docs.panther.com/panther-developer-workflows/api/rest/..#how-to-use-the-panther-rest-api) instructions—including [directions for how to invoke it directly from this documentation page](https://docs.panther.com/panther-developer-workflows/api/rest/..#step-3-invoke-the-panther-rest-api).

## Required permissions

* For `GET` operations, your API token must have the `View Rules` or `View Policies` permission.
* For `POST`, `PUT`, and `DELETE` operations, your API token must have the `Manage Rules` or `Manage Policies` permission.

## Operations

## POST /globals

> create global

```json
{"openapi":"3.0.3","info":{"title":"Panther REST API","version":"1.0"},"tags":[{"name":"global","description":"The global api handles all operations for globals"}],"servers":[{"url":"https://{api_host}","variables":{"api_host":{"default":"your-api-host"}}}],"security":[{"ApiKeyAuth":[]}],"components":{"securitySchemes":{"ApiKeyAuth":{"type":"apiKey","name":"X-API-Key","in":"header"}},"schemas":{"GlobalAPI.ModifyGlobal":{"type":"object","properties":{"body":{"type":"string","description":"The python body of the global"},"description":{"type":"string","description":"The description of the global"},"id":{"type":"string","description":"The id of the global"},"tags":{"type":"array","items":{"type":"string"},"description":"The tags for the global"}},"required":["id","body"]},"GlobalAPI.Global":{"type":"object","properties":{"body":{"type":"string","description":"The python body of the global"},"createdAt":{"type":"string"},"description":{"type":"string","description":"The description of the global"},"id":{"type":"string","description":"The id of the global"},"lastModified":{"type":"string"},"tags":{"type":"array","items":{"type":"string"},"description":"The tags for the global"}}},"GlobalAPI.BadRequestError":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]},"GlobalAPI.ExistsError":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]}}},"paths":{"/globals":{"post":{"tags":["global"],"summary":"create global","operationId":"global#create","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/GlobalAPI.ModifyGlobal"}}}},"responses":{"200":{"description":"OK response.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GlobalAPI.Global"}}}},"400":{"description":"bad_request: Bad Request response.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GlobalAPI.BadRequestError"}}}},"409":{"description":"exists: Conflict response.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GlobalAPI.ExistsError"}}}}}}}}}
```

## GET /globals/{id}

> get global

```json
{"openapi":"3.0.3","info":{"title":"Panther REST API","version":"1.0"},"tags":[{"name":"global","description":"The global api handles all operations for globals"}],"servers":[{"url":"https://{api_host}","variables":{"api_host":{"default":"your-api-host"}}}],"security":[{"ApiKeyAuth":[]}],"components":{"securitySchemes":{"ApiKeyAuth":{"type":"apiKey","name":"X-API-Key","in":"header"}},"schemas":{"GlobalAPI.Global":{"type":"object","properties":{"body":{"type":"string","description":"The python body of the global"},"createdAt":{"type":"string"},"description":{"type":"string","description":"The description of the global"},"id":{"type":"string","description":"The id of the global"},"lastModified":{"type":"string"},"tags":{"type":"array","items":{"type":"string"},"description":"The tags for the global"}}},"GlobalAPI.NotFoundError":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]}}},"paths":{"/globals/{id}":{"get":{"tags":["global"],"summary":"get global","operationId":"global#get","parameters":[{"name":"id","in":"path","description":"ID of the global to fetch","required":true,"schema":{"type":"string","description":"ID of the global to fetch"}}],"responses":{"200":{"description":"OK response.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GlobalAPI.Global"}}}},"404":{"description":"not_found: Not Found response.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GlobalAPI.NotFoundError"}}}}}}}}}
```

## put global

> put creates or updates a global

```json
{"openapi":"3.0.3","info":{"title":"Panther REST API","version":"1.0"},"tags":[{"name":"global","description":"The global api handles all operations for globals"}],"servers":[{"url":"https://{api_host}","variables":{"api_host":{"default":"your-api-host"}}}],"security":[{"ApiKeyAuth":[]}],"components":{"securitySchemes":{"ApiKeyAuth":{"type":"apiKey","name":"X-API-Key","in":"header"}},"schemas":{"GlobalAPI.ModifyGlobal2":{"type":"object","properties":{"body":{"type":"string","description":"The python body of the global"},"description":{"type":"string","description":"The description of the global"},"tags":{"type":"array","items":{"type":"string"},"description":"The tags for the global"}},"required":["body"]},"GlobalAPI.PutGlobalResp":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/GlobalAPI.Global"}}},"GlobalAPI.Global":{"type":"object","properties":{"body":{"type":"string","description":"The python body of the global"},"createdAt":{"type":"string"},"description":{"type":"string","description":"The description of the global"},"id":{"type":"string","description":"The id of the global"},"lastModified":{"type":"string"},"tags":{"type":"array","items":{"type":"string"},"description":"The tags for the global"}}},"GlobalAPI.BadRequestError":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]}}},"paths":{"/globals/{id}":{"put":{"tags":["global"],"summary":"put global","description":"put creates or updates a global","operationId":"global#put","parameters":[{"name":"id","in":"path","description":"The id of the global","required":true,"schema":{"type":"string","description":"The id of the global"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/GlobalAPI.ModifyGlobal2"}}}},"responses":{"200":{"description":"200 returned if the item already existed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GlobalAPI.PutGlobalResp"}}}},"201":{"description":"201 returned if the item was created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GlobalAPI.PutGlobalResp"}}}},"400":{"description":"bad_request: Bad Request response.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GlobalAPI.BadRequestError"}}}}}}}}}
```

## DELETE /globals/{id}

> delete global

```json
{"openapi":"3.0.3","info":{"title":"Panther REST API","version":"1.0"},"tags":[{"name":"global","description":"The global api handles all operations for globals"}],"servers":[{"url":"https://{api_host}","variables":{"api_host":{"default":"your-api-host"}}}],"security":[{"ApiKeyAuth":[]}],"components":{"securitySchemes":{"ApiKeyAuth":{"type":"apiKey","name":"X-API-Key","in":"header"}},"schemas":{"GlobalAPI.BadRequestError":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]},"GlobalAPI.NotFoundError":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"]}}},"paths":{"/globals/{id}":{"delete":{"tags":["global"],"summary":"delete global","operationId":"global#delete","parameters":[{"name":"id","in":"path","description":"ID of the global to delete","required":true,"schema":{"type":"string","description":"ID of the global to delete"}}],"responses":{"204":{"description":"No Content response."},"400":{"description":"bad_request: Bad Request response.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GlobalAPI.BadRequestError"}}}},"404":{"description":"not_found: Not Found response.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GlobalAPI.NotFoundError"}}}}}}}}}
```

## GET /globals

> list globals

```json
{"openapi":"3.0.3","info":{"title":"Panther REST API","version":"1.0"},"tags":[{"name":"global","description":"The global api handles all operations for globals"}],"servers":[{"url":"https://{api_host}","variables":{"api_host":{"default":"your-api-host"}}}],"security":[{"ApiKeyAuth":[]}],"components":{"securitySchemes":{"ApiKeyAuth":{"type":"apiKey","name":"X-API-Key","in":"header"}},"schemas":{"GlobalAPI.ListResp":{"type":"object","properties":{"next":{"type":"string","description":"pagination token for the next page of results"},"results":{"type":"array","items":{"$ref":"#/components/schemas/GlobalAPI.Global"}}}},"GlobalAPI.Global":{"type":"object","properties":{"body":{"type":"string","description":"The python body of the global"},"createdAt":{"type":"string"},"description":{"type":"string","description":"The description of the global"},"id":{"type":"string","description":"The id of the global"},"lastModified":{"type":"string"},"tags":{"type":"array","items":{"type":"string"},"description":"The tags for the global"}}}}},"paths":{"/globals":{"get":{"tags":["global"],"summary":"list globals","operationId":"global#list","parameters":[{"name":"cursor","in":"query","description":"the pagination token","allowEmptyValue":true,"schema":{"type":"string","description":"the pagination token"}},{"name":"limit","in":"query","description":"the maximum results to return","allowEmptyValue":true,"schema":{"type":"integer","description":"the maximum results to return","default":100,"format":"int64"}},{"name":"name-contains","in":"query","description":"Substring search by name (case-insensitive)","allowEmptyValue":true,"schema":{"type":"string","description":"Substring search by name (case-insensitive)"}},{"name":"created-by","in":"query","description":"Only include rules whose creator matches this user ID or actor ID","allowEmptyValue":true,"schema":{"type":"string","description":"Only include rules whose creator matches this user ID or actor ID"}},{"name":"last-modified-by","in":"query","description":"Only include rules last modified by this user ID or actor ID","allowEmptyValue":true,"schema":{"type":"string","description":"Only include rules last modified by this user ID or actor ID"}}],"responses":{"200":{"description":"OK response.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GlobalAPI.ListResp"}}}}}}}}}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.panther.com/panther-developer-workflows/api/rest/globals.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
