# Connections API

## GET /connections

> Retrieve a list of connections or a specific connection by ID.

```json
{"openapi":"3.0.3","info":{"title":"Connections API","version":"2.0"},"servers":[{"url":"https://api.gospace.app/connections/v1"}],"security":[{"ApiKeyAuth":[]}],"components":{"securitySchemes":{"ApiKeyAuth":{"type":"apiKey","in":"header","name":"x-api-key"}},"schemas":{"ConnectionApiDTO":{"type":"object","properties":{"_id":{"type":"string"},"connection_from_entity":{"$ref":"#/components/schemas/ConnectionEntity"},"connection_to_entity":{"$ref":"#/components/schemas/ConnectionEntity"},"strength":{"type":"number"},"priority":{"type":"number"},"status":{"type":"string"},"configuration_id":{"type":"string"}},"additionalProperties":true},"ConnectionEntity":{"type":"object","properties":{"connection_entity_id":{"type":"string"},"connection_entity_type":{"type":"string","enum":["PERSON","TEAM","LABEL","ZONE","ROOM","SPACE","LOCATION","LAYER"]},"connection_entity_data":{"type":"object","additionalProperties":true}},"required":["connection_entity_id","connection_entity_type"],"additionalProperties":true},"Pagination":{"type":"object","properties":{"current_results":{"type":"object","properties":{"from":{"type":"integer"},"to":{"type":"integer"}}},"total_results":{"type":"integer"}},"additionalProperties":true}}},"paths":{"/connections":{"get":{"operationId":"getConnections","description":"Retrieve a list of connections or a specific connection by ID.","parameters":[{"name":"connection_id","in":"query","required":false,"schema":{"type":"string"}},{"name":"skip","in":"query","required":false,"schema":{"type":"integer","default":0}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","default":25}},{"name":"sort","in":"query","required":false,"schema":{"type":"string"}},{"name":"order","in":"query","required":false,"schema":{"type":"string","enum":["asc","desc"],"default":"asc"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"data":{"type":"object","properties":{"connections":{"type":"array","items":{"$ref":"#/components/schemas/ConnectionApiDTO"}}}},"pagination":{"$ref":"#/components/schemas/Pagination"},"identifier":{"type":"string"}},"required":["success","data","pagination","identifier"]}}}},"500":{"description":"Internal Server Error"}}}}}}
```

## POST /connections

> Create multiple connections in a single request.

```json
{"openapi":"3.0.3","info":{"title":"Connections API","version":"2.0"},"servers":[{"url":"https://api.gospace.app/connections/v1"}],"security":[{"ApiKeyAuth":[]}],"components":{"securitySchemes":{"ApiKeyAuth":{"type":"apiKey","in":"header","name":"x-api-key"}},"schemas":{"ConnectionApiDTO":{"type":"object","properties":{"_id":{"type":"string"},"connection_from_entity":{"$ref":"#/components/schemas/ConnectionEntity"},"connection_to_entity":{"$ref":"#/components/schemas/ConnectionEntity"},"strength":{"type":"number"},"priority":{"type":"number"},"status":{"type":"string"},"configuration_id":{"type":"string"}},"additionalProperties":true},"ConnectionEntity":{"type":"object","properties":{"connection_entity_id":{"type":"string"},"connection_entity_type":{"type":"string","enum":["PERSON","TEAM","LABEL","ZONE","ROOM","SPACE","LOCATION","LAYER"]},"connection_entity_data":{"type":"object","additionalProperties":true}},"required":["connection_entity_id","connection_entity_type"],"additionalProperties":true}}},"paths":{"/connections":{"post":{"operationId":"createConnections","description":"Create multiple connections in a single request.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["connections"],"properties":{"connections":{"type":"array","items":{"type":"object","required":["connection_from_entity_id","connection_to_entity_id","strength"],"properties":{"connection_from_entity_id":{"type":"string"},"connection_to_entity_id":{"type":"string"},"strength":{"type":"number"},"priority":{"type":"number","default":1},"starts_at":{"type":"string","format":"date-time"},"ends_at":{"type":"string","format":"date-time"},"notes":{"type":"string"},"location_id":{"type":"string","nullable":true}}}}}}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"data":{"type":"array","items":{"$ref":"#/components/schemas/ConnectionApiDTO"}},"identifier":{"type":"string"}},"required":["success","data","identifier"]}}}},"500":{"description":"Internal Server Error"}}}}}}
```

## PUT /connections

> Edit multiple connections in a single request.

```json
{"openapi":"3.0.3","info":{"title":"Connections API","version":"2.0"},"servers":[{"url":"https://api.gospace.app/connections/v1"}],"security":[{"ApiKeyAuth":[]}],"components":{"securitySchemes":{"ApiKeyAuth":{"type":"apiKey","in":"header","name":"x-api-key"}},"schemas":{"ConnectionApiDTO":{"type":"object","properties":{"_id":{"type":"string"},"connection_from_entity":{"$ref":"#/components/schemas/ConnectionEntity"},"connection_to_entity":{"$ref":"#/components/schemas/ConnectionEntity"},"strength":{"type":"number"},"priority":{"type":"number"},"status":{"type":"string"},"configuration_id":{"type":"string"}},"additionalProperties":true},"ConnectionEntity":{"type":"object","properties":{"connection_entity_id":{"type":"string"},"connection_entity_type":{"type":"string","enum":["PERSON","TEAM","LABEL","ZONE","ROOM","SPACE","LOCATION","LAYER"]},"connection_entity_data":{"type":"object","additionalProperties":true}},"required":["connection_entity_id","connection_entity_type"],"additionalProperties":true}}},"paths":{"/connections":{"put":{"operationId":"editConnections","description":"Edit multiple connections in a single request.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["connections"],"properties":{"connections":{"type":"array","items":{"type":"object","required":["connection_id"],"properties":{"connection_id":{"type":"string"},"strength":{"type":"number"},"priority":{"type":"number"},"starts_at":{"type":"string","format":"date-time"},"ends_at":{"type":"string","format":"date-time"},"notes":{"type":"string"}}}}}}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"data":{"type":"array","items":{"$ref":"#/components/schemas/ConnectionApiDTO"}},"identifier":{"type":"string"}},"required":["success","data","identifier"]}}}},"500":{"description":"Internal Server Error"}}}}}}
```

## GET /labels

> Retrieve label definitions.

```json
{"openapi":"3.0.3","info":{"title":"Connections API","version":"2.0"},"servers":[{"url":"https://api.gospace.app/connections/v1"}],"security":[{"ApiKeyAuth":[]}],"components":{"securitySchemes":{"ApiKeyAuth":{"type":"apiKey","in":"header","name":"x-api-key"}},"schemas":{"LabelApiDTO":{"type":"object","properties":{"connection_entity_id":{"type":"string"},"connection_entity_type":{"type":"string","enum":["PERSON","TEAM","LABEL","ZONE","ROOM","SPACE","LOCATION","LAYER"]},"entity_data":{"type":"object","additionalProperties":true},"flags":{"type":"object","properties":{"connectable":{"type":"boolean"}},"additionalProperties":true},"location_id":{"type":"string"},"configuration_id":{"type":"string"},"status":{"type":"string"}},"additionalProperties":true},"Pagination":{"type":"object","properties":{"current_results":{"type":"object","properties":{"from":{"type":"integer"},"to":{"type":"integer"}}},"total_results":{"type":"integer"}},"additionalProperties":true}}},"paths":{"/labels":{"get":{"operationId":"getLabels","description":"Retrieve label definitions.","parameters":[{"name":"label_id","in":"query","required":false,"schema":{"type":"string"}},{"name":"skip","in":"query","required":false,"schema":{"type":"integer","default":0}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","default":25}},{"name":"sort","in":"query","required":false,"schema":{"type":"string"}},{"name":"order","in":"query","required":false,"schema":{"type":"string","enum":["asc","desc"],"default":"asc"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"data":{"type":"object","properties":{"labels":{"type":"array","items":{"$ref":"#/components/schemas/LabelApiDTO"}}}},"pagination":{"$ref":"#/components/schemas/Pagination"},"identifier":{"type":"string"}},"required":["success","data","pagination","identifier"]}}}},"500":{"description":"Internal Server Error"}}}}}}
```

## GET /labels/mapping

> Retrieve label mappings.

```json
{"openapi":"3.0.3","info":{"title":"Connections API","version":"2.0"},"servers":[{"url":"https://api.gospace.app/connections/v1"}],"security":[{"ApiKeyAuth":[]}],"components":{"securitySchemes":{"ApiKeyAuth":{"type":"apiKey","in":"header","name":"x-api-key"}},"schemas":{"LabelMappingApiDTO":{"type":"object","properties":{"connection_entity_id":{"type":"string"},"label_definition_entity_id":{"type":"string"},"value":{"type":"string"},"entity_type":{"type":"string"},"visibility":{"type":"string"},"location_id":{"type":"string"},"configuration_id":{"type":"string"},"status":{"type":"string"}},"additionalProperties":true},"Pagination":{"type":"object","properties":{"current_results":{"type":"object","properties":{"from":{"type":"integer"},"to":{"type":"integer"}}},"total_results":{"type":"integer"}},"additionalProperties":true}}},"paths":{"/labels/mapping":{"get":{"operationId":"getLabelMappings","description":"Retrieve label mappings.","parameters":[{"name":"label_mapping_id","in":"query","required":false,"schema":{"type":"string"}},{"name":"label_id","in":"query","required":false,"schema":{"type":"string"}},{"name":"skip","in":"query","required":false,"schema":{"type":"integer","default":0}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","default":25}},{"name":"sort","in":"query","required":false,"schema":{"type":"string"}},{"name":"order","in":"query","required":false,"schema":{"type":"string","enum":["asc","desc"],"default":"asc"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"data":{"type":"object","properties":{"label_mappings":{"type":"array","items":{"$ref":"#/components/schemas/LabelMappingApiDTO"}}}},"pagination":{"$ref":"#/components/schemas/Pagination"},"identifier":{"type":"string"}},"required":["success","data","pagination","identifier"]}}}},"500":{"description":"Internal Server Error"}}}}}}
```
