> For the complete documentation index, see [llms.txt](https://support.turngate.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://support.turngate.io/api-documentation/api.md).

# Api

## GET /api/datasource/

> Internal only view for listing datasources. Used by ETL/Airflow.

```json
{"openapi":"3.1.1","info":{"title":"Turngate API","version":"v1"},"servers":[{"url":"https://api.turngate.io/"}],"security":[{"Bearer":[]}],"components":{"securitySchemes":{"Bearer":{"type":"apiKey","name":"Authorization","in":"header"}},"schemas":{"DataSourceList":{"required":["name","organization"],"type":"object","properties":{"uuid":{"title":"Uuid","type":"string","format":"uuid","readOnly":true},"type__history_hours":{"title":"Type  history hours","type":"integer","readOnly":true},"type__slug":{"title":"Type  slug","type":"string","readOnly":true,"minLength":1},"name":{"title":"Name","type":"string","maxLength":255,"minLength":1},"expiry":{"title":"Expiry","type":"string","format":"date-time"},"created_at":{"title":"Created at","type":"string","format":"date-time","readOnly":true},"enabled":{"title":"Enabled","type":"boolean"},"secret_name":{"title":"Secret name","type":"string","readOnly":true,"minLength":1},"organization":{"$ref":"#/components/schemas/Organization"}}},"Organization":{"required":["name","slug"],"type":"object","properties":{"uuid":{"title":"Uuid","type":"string","format":"uuid","readOnly":true},"name":{"title":"Name","description":"The name of the organization","type":"string","maxLength":200,"minLength":1},"slug":{"title":"Slug","description":"The name in all lowercase, suitable for URL identification","type":"string","format":"slug","pattern":"^[-a-zA-Z0-9_]+$","maxLength":200,"minLength":1},"account_portal_url":{"title":"Account portal url","type":"string","readOnly":true},"rate_limit":{"$ref":"#/components/schemas/RateLimit"}}},"RateLimit":{"type":"object","properties":{"limit":{"title":"Limit","type":"integer","readOnly":true},"usage":{"title":"Usage","type":"integer","readOnly":true},"remaining":{"title":"Remaining","type":"integer","readOnly":true},"overriden":{"title":"Overriden","type":"boolean","readOnly":true}}}}},"paths":{"/api/datasource/":{"get":{"operationId":"api_datasource_list","description":"Internal only view for listing datasources. Used by ETL/Airflow.","parameters":[{"name":"type__slug","in":"query","description":"type__slug","required":false,"type":"string"},{"name":"search","in":"query","description":"A search term.","required":false,"type":"string"},{"name":"page","in":"query","description":"A page number within the paginated result set.","required":false,"type":"integer"},{"name":"page_size","in":"query","description":"Number of results to return per page.","required":false,"type":"integer"}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"required":["count","results"],"type":"object","properties":{"count":{"type":"integer"},"next":{"type":"string","format":"uri"},"previous":{"type":"string","format":"uri"},"results":{"type":"array","items":{"$ref":"#/components/schemas/DataSourceList"}}}}}}}},"tags":["api"]}}}}
```

## GET /api/eventtype-count/

> View for providing statistics on global # of activities by event\_type

```json
{"openapi":"3.1.1","info":{"title":"Turngate API","version":"v1"},"servers":[{"url":"https://api.turngate.io/"}],"security":[{"Bearer":[]}],"components":{"securitySchemes":{"Bearer":{"type":"apiKey","name":"Authorization","in":"header"}},"schemas":{"ActivityCountByEventType":{"required":["event_type","slug","count"],"type":"object","properties":{"event_type":{"title":"Event type","type":"string","format":"uuid"},"slug":{"title":"Slug","type":"string","minLength":1},"count":{"title":"Count","type":"integer"}}}}},"paths":{"/api/eventtype-count/":{"get":{"operationId":"api_eventtype-count_list","description":"View for providing statistics on global # of activities by event_type","parameters":[{"name":"search","in":"query","description":"A search term.","required":false,"type":"string"},{"name":"page","in":"query","description":"A page number within the paginated result set.","required":false,"type":"integer"},{"name":"page_size","in":"query","description":"Number of results to return per page.","required":false,"type":"integer"}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"required":["count","results"],"type":"object","properties":{"count":{"type":"integer"},"next":{"type":"string","format":"uri"},"previous":{"type":"string","format":"uri"},"results":{"type":"array","items":{"$ref":"#/components/schemas/ActivityCountByEventType"}}}}}}}},"tags":["api"]}}}}
```

## POST /api/sync\_labels/

> Upload a Labelmaker CSV file for asynchronous processing.

```json
{"openapi":"3.1.1","info":{"title":"Turngate API","version":"v1"},"servers":[{"url":"https://api.turngate.io/"}],"security":[{"Bearer":[]}],"components":{"securitySchemes":{"Bearer":{"type":"apiKey","name":"Authorization","in":"header"}}},"paths":{"/api/sync_labels/":{"post":{"operationId":"api_sync_labels_create","description":"Upload a Labelmaker CSV file for asynchronous processing.","responses":{"202":{"description":"CSV is being processed asynchronously, and the task ID is returned.","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"string"},"task_id":{"type":"string"}}}}}},"400":{"description":"No file provided"},"500":{"description":"Server error"}},"tags":["api"],"requestBody":{"content":{"application/x-www-form-urlencoded":{"schema":{"type":"object","properties":{"file":{"type":"file","description":"CSV file to upload"}},"required":["file"]}}}}}}}}
```

## GET /api/tagged-eventtype/

>

```json
{"openapi":"3.1.1","info":{"title":"Turngate API","version":"v1"},"servers":[{"url":"https://api.turngate.io/"}],"security":[{"Bearer":[]}],"components":{"securitySchemes":{"Bearer":{"type":"apiKey","name":"Authorization","in":"header"}},"schemas":{"TaggedItem":{"type":"object","properties":{"uuid":{"title":"Uuid","type":"string","format":"uuid","readOnly":true},"integration_type_slug":{"title":"Integration type slug","type":"string","readOnly":true},"eventtype_slug":{"title":"Eventtype slug","type":"string","readOnly":true},"tag_slug":{"title":"Tag slug","type":"string","readOnly":true}}}}},"paths":{"/api/tagged-eventtype/":{"get":{"operationId":"api_tagged-eventtype_list","description":"","parameters":[{"name":"search","in":"query","description":"A search term.","required":false,"type":"string"},{"name":"page","in":"query","description":"A page number within the paginated result set.","required":false,"type":"integer"},{"name":"page_size","in":"query","description":"Number of results to return per page.","required":false,"type":"integer"}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"required":["count","results"],"type":"object","properties":{"count":{"type":"integer"},"next":{"type":"string","format":"uri"},"previous":{"type":"string","format":"uri"},"results":{"type":"array","items":{"$ref":"#/components/schemas/TaggedItem"}}}}}}}},"tags":["api"]}}}}
```

## POST /api/tagged-eventtype/

>

```json
{"openapi":"3.1.1","info":{"title":"Turngate API","version":"v1"},"servers":[{"url":"https://api.turngate.io/"}],"security":[{"Bearer":[]}],"components":{"securitySchemes":{"Bearer":{"type":"apiKey","name":"Authorization","in":"header"}},"schemas":{"TaggedItemCreate":{"required":["integration_type_slug","eventtype_slug","tag_slug","uuid"],"type":"object","properties":{"integration_type_slug":{"title":"Integration type slug","type":"string","format":"slug","pattern":"^[-a-zA-Z0-9_]+$","minLength":1},"eventtype_slug":{"title":"Eventtype slug","type":"string","minLength":1},"tag_slug":{"title":"Tag slug","type":"string","minLength":1},"uuid":{"title":"Uuid","type":"string","format":"uuid"}}}}},"paths":{"/api/tagged-eventtype/":{"post":{"operationId":"api_tagged-eventtype_create","description":"","responses":{"201":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TaggedItemCreate"}}}}},"tags":["api"],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TaggedItemCreate"}}},"required":true}}}}}
```

## GET /api/tags-by-integration/

> View viewing tags grouped by integration type

```json
{"openapi":"3.1.1","info":{"title":"Turngate API","version":"v1"},"servers":[{"url":"https://api.turngate.io/"}],"security":[{"Bearer":[]}],"components":{"securitySchemes":{"Bearer":{"type":"apiKey","name":"Authorization","in":"header"}},"schemas":{"TagsByIntegration":{"required":["Access","Context","Application"],"type":"object","properties":{"Access":{"type":"array","items":{"$ref":"#/components/schemas/TagsDatasource"}},"Context":{"type":"array","items":{"$ref":"#/components/schemas/TagsDatasource"}},"Application":{"type":"array","items":{"$ref":"#/components/schemas/TagsDatasource"}}}},"TagsDatasource":{"required":["label","uuid","dataSources"],"type":"object","properties":{"label":{"title":"Label","type":"string","minLength":1},"uuid":{"title":"Uuid","type":"string","format":"uuid"},"dataSources":{"type":"array","items":{"type":"string","format":"uuid"}}}}}},"paths":{"/api/tags-by-integration/":{"get":{"operationId":"api_tags-by-integration_list","description":"View viewing tags grouped by integration type","responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TagsByIntegration"}}}}},"tags":["api"]}}}}
```

## GET /api/tags/

> View to list and create tags.

```json
{"openapi":"3.1.1","info":{"title":"Turngate API","version":"v1"},"servers":[{"url":"https://api.turngate.io/"}],"security":[{"Bearer":[]}],"components":{"securitySchemes":{"Bearer":{"type":"apiKey","name":"Authorization","in":"header"}},"schemas":{"Tag":{"required":["label","scope"],"type":"object","properties":{"label":{"title":"Label","type":"string","maxLength":255,"minLength":1},"scope":{"title":"Scope","type":"string","minLength":1},"uuid":{"title":"Uuid","type":"string","format":"uuid","readOnly":true},"id":{"title":"ID","type":"integer","readOnly":true}}}}},"paths":{"/api/tags/":{"get":{"operationId":"api_tags_list","description":"View to list and create tags.","parameters":[{"name":"search","in":"query","description":"A search term.","required":false,"type":"string"},{"name":"page","in":"query","description":"A page number within the paginated result set.","required":false,"type":"integer"},{"name":"page_size","in":"query","description":"Number of results to return per page.","required":false,"type":"integer"}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"required":["count","results"],"type":"object","properties":{"count":{"type":"integer"},"next":{"type":"string","format":"uri"},"previous":{"type":"string","format":"uri"},"results":{"type":"array","items":{"$ref":"#/components/schemas/Tag"}}}}}}}},"tags":["api"]}}}}
```

## POST /api/tags/

> View to list and create tags.

```json
{"openapi":"3.1.1","info":{"title":"Turngate API","version":"v1"},"servers":[{"url":"https://api.turngate.io/"}],"security":[{"Bearer":[]}],"components":{"securitySchemes":{"Bearer":{"type":"apiKey","name":"Authorization","in":"header"}},"schemas":{"TagCreate":{"required":["label","scope"],"type":"object","properties":{"label":{"title":"Label","type":"string","minLength":1},"scope":{"title":"Scope","type":"string"}}}}},"paths":{"/api/tags/":{"post":{"operationId":"api_tags_create","description":"View to list and create tags.","responses":{"201":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TagCreate"}}}}},"tags":["api"],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TagCreate"}}},"required":true}}}}}
```

## GET /api/tags/{uuid}/

> View to get tag by id.

```json
{"openapi":"3.1.1","info":{"title":"Turngate API","version":"v1"},"servers":[{"url":"https://api.turngate.io/"}],"security":[{"Bearer":[]}],"components":{"securitySchemes":{"Bearer":{"type":"apiKey","name":"Authorization","in":"header"}},"schemas":{"Tag":{"required":["label","scope"],"type":"object","properties":{"label":{"title":"Label","type":"string","maxLength":255,"minLength":1},"scope":{"title":"Scope","type":"string","minLength":1},"uuid":{"title":"Uuid","type":"string","format":"uuid","readOnly":true},"id":{"title":"ID","type":"integer","readOnly":true}}}}},"paths":{"/api/tags/{uuid}/":{"get":{"operationId":"api_tags_read","description":"View to get tag by id.","responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Tag"}}}}},"tags":["api"]}}}}
```

## DELETE /api/tags/{uuid}/

> View to get tag by id.

```json
{"openapi":"3.1.1","info":{"title":"Turngate API","version":"v1"},"servers":[{"url":"https://api.turngate.io/"}],"security":[{"Bearer":[]}],"components":{"securitySchemes":{"Bearer":{"type":"apiKey","name":"Authorization","in":"header"}}},"paths":{"/api/tags/{uuid}/":{"delete":{"operationId":"api_tags_delete","description":"View to get tag by id.","responses":{"204":{"description":""}},"tags":["api"]}}}}
```
