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

# Environment

## GET /api/public/v1/environment

> Export the full environment configuration including models, relationships, metrics, glossary terms, and AI analysts. Supports filtering by entity type and output format.

```json
{"openapi":"3.1.0","info":{"title":"Actian AI Analyst","version":"0.1.0"},"servers":[{"url":"https://app.wobby.ai","variables":{}}],"security":[{"BearerAuth":[]}],"components":{"securitySchemes":{"BearerAuth":{"type":"http","scheme":"bearer","description":"API key obtained from Settings > API Keys. Pass as: Authorization: Bearer <your-api-key>"}}},"paths":{"/api/public/v1/environment":{"get":{"parameters":[{"in":"query","name":"entities","description":"Comma-separated list of entity types to include. Valid values: models, relationships, metrics, glossary, ai_analysts. Defaults to all.","schema":{"type":"string"}},{"in":"query","name":"format","description":"Output format. Defaults to json.","schema":{"type":"string","enum":["json","yaml"],"default":"json"}}],"responses":{"200":{"description":"Environment export","content":{"application/json":{"schema":{"type":"object","properties":{"version":{"type":"string"},"exported_at":{"type":"string","format":"date-time"},"models":{"type":"array","items":{"type":"object"},"description":"Models with dimensions, measures, filters, and grain"},"relationships":{"type":"array","items":{"type":"object"},"description":"Relationships between models"},"metrics":{"type":"array","items":{"type":"object"},"description":"Defined metrics with expressions and joins"},"glossary":{"type":"array","items":{"type":"object"},"description":"Glossary terms with definitions and mappings"},"ai_analysts":{"type":"array","items":{"type":"object"},"description":"AI analysts with semantic layer access configuration"}}}}}},"400":{"description":"No environment context available"},"401":{"description":"Unauthorized — missing or invalid API key"}},"tags":["Environment"],"description":"Export the full environment configuration including models, relationships, metrics, glossary terms, and AI analysts. Supports filtering by entity type and output format."}}}}
```

## PUT /api/public/v1/environment

> Sync (upsert) the environment configuration from a JSON payload. Supports models, relationships, metrics, glossary terms, and AI analysts. Only include the entity types you want to sync — omitted types are left untouched. Blocks if any referenced data source does not exist.

```json
{"openapi":"3.1.0","info":{"title":"Actian AI Analyst","version":"0.1.0"},"servers":[{"url":"https://app.wobby.ai","variables":{}}],"security":[{"BearerAuth":[]}],"components":{"securitySchemes":{"BearerAuth":{"type":"http","scheme":"bearer","description":"API key obtained from Settings > API Keys. Pass as: Authorization: Bearer <your-api-key>"}}},"paths":{"/api/public/v1/environment":{"put":{"parameters":[],"responses":{"200":{"description":"Sync summary","content":{"application/json":{"schema":{"type":"object","properties":{"created":{"type":"integer","description":"Number of entities created"},"updated":{"type":"integer","description":"Number of entities updated"},"deleted":{"type":"integer","description":"Number of orphaned entities deleted (0 if orphaned=keep)"},"unchanged":{"type":"integer","description":"Number of entities that were already up to date"}}}}}},"400":{"description":"No environment context available"},"401":{"description":"Unauthorized — missing or invalid API key"},"422":{"description":"Validation error — one or more referenced data sources do not exist"}},"tags":["Environment"],"description":"Sync (upsert) the environment configuration from a JSON payload. Supports models, relationships, metrics, glossary terms, and AI analysts. Only include the entity types you want to sync — omitted types are left untouched. Blocks if any referenced data source does not exist.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"models":{"type":"array","items":{"type":"object"},"description":"Models to create or update (matched by name)"},"relationships":{"type":"array","items":{"type":"object"},"description":"Relationships between models"},"metrics":{"type":"array","items":{"type":"object"},"description":"Metrics to create or update (matched by name)"},"glossary":{"type":"array","items":{"type":"object"},"description":"Glossary terms to create or update (matched by term)"},"ai_analysts":{"type":"array","items":{"type":"object"},"description":"AI analysts to create or update (matched by name)"},"orphaned":{"type":"string","enum":["keep","delete"],"default":"keep","description":"What to do with existing entities not present in the payload. \"delete\" removes them, \"keep\" (default) leaves them."}}}}}}}}}}
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://docs.wobby.ai/api-reference/environment.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
