# Import/Export

Import & Export Agents

## Exporting agents

> Exports the agents by IDs.

```json
{"openapi":"3.0.0","info":{"title":"AI Service","version":"0.0.1"},"tags":[{"name":"Import/Export","description":"Import & Export Agents"}],"servers":[{"url":"https://api.emporix.io"}],"security":[{"OAuth2":["ai.agent_read"]}],"components":{"securitySchemes":{"OAuth2":{"type":"oauth2","flows":{"clientCredentials":{"scopes":{"ai.text_manage":"Needed to execute actions related to the text generation.","ai.completion_manage":"Needed to execute actions related to the AI completions.","ai.agent_read":"Needed to read AI agents.","ai.agent_manage":"Needed to manage AI agents."},"tokenUrl":"https://api.emporix.io/oauth/token"}}}},"requestBodies":{"exportRequestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ExportRequest"}}}}},"schemas":{"ExportRequest":{"type":"object","required":["agentIds"],"properties":{"agentIds":{"description":"List of the agents IDs.","type":"array","minimum":0,"maximum":100,"items":{"type":"string"}}}},"ExportResponse":{"allOf":[{"$ref":"#/components/schemas/DataWithChecksum"},{"type":"object","properties":{"exportedAt":{"description":"Date of the export process.","type":"string","format":"date-time"},"jobId":{"description":"ID of the job.","type":"string"}}}]},"DataWithChecksum":{"type":"object","properties":{"data":{"description":"The base64 encoded JSON value of the exported agents with related tools and MCP servers.","type":"string"},"checksum":{"description":"Checksum calculated based on decoded `data` value. Validates if importing JSON is exactly the same as the exported one.","type":"string"}}},"ErrorMessage":{"type":"object","properties":{"code":{"type":"integer"},"type":{"type":"string"},"message":{"type":"string"},"moreInfo":{"type":"string"},"details":{"type":"array","items":{"type":"object","properties":{"field":{"type":"string"},"type":{"type":"string"},"message":{"type":"string"},"moreInfo":{"type":"string"}}}}},"description":""},"ErrorMessageFault":{"type":"object","properties":{"fault":{"type":"object","properties":{"faultstring":{"type":"string"},"detail":{"type":"object","properties":{"errorcode":{"type":"string"}}}}}}}},"responses":{"400_resp_common":{"description":"The request was syntactically incorrect.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorMessage"}}}},"401_resp_common":{"description":"The authorization token is invalid or has expired.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorMessageFault"}}}},"403_resp_common":{"description":"Authorization scopes of the access token are not sufficient and do not match the scopes required by the endpoint.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorMessage"}}}}}},"paths":{"/ai-service/{tenant}/agentic/agents/export":{"post":{"summary":"Exporting agents","operationId":"POST-ai-export-agents","requestBody":{"$ref":"#/components/requestBodies/exportRequestBody"},"responses":{"200":{"description":"The exported agents with components.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ExportResponse"}}}},"400":{"$ref":"#/components/responses/400_resp_common"},"401":{"$ref":"#/components/responses/401_resp_common"},"403":{"$ref":"#/components/responses/403_resp_common"}},"description":"Exports the agents by IDs.","tags":["Import/Export"]}}}}
```

## Importing agents

> Imports the agents from the base64 encoded data.

```json
{"openapi":"3.0.0","info":{"title":"AI Service","version":"0.0.1"},"tags":[{"name":"Import/Export","description":"Import & Export Agents"}],"servers":[{"url":"https://api.emporix.io"}],"security":[{"OAuth2":["ai.agent_manage"]}],"components":{"securitySchemes":{"OAuth2":{"type":"oauth2","flows":{"clientCredentials":{"scopes":{"ai.text_manage":"Needed to execute actions related to the text generation.","ai.completion_manage":"Needed to execute actions related to the AI completions.","ai.agent_read":"Needed to read AI agents.","ai.agent_manage":"Needed to manage AI agents."},"tokenUrl":"https://api.emporix.io/oauth/token"}}}},"requestBodies":{"importRequestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ImportRequest"}}}}},"schemas":{"ImportRequest":{"allOf":[{"$ref":"#/components/schemas/DataWithChecksum"}],"required":["data","checksum"]},"DataWithChecksum":{"type":"object","properties":{"data":{"description":"The base64 encoded JSON value of the exported agents with related tools and MCP servers.","type":"string"},"checksum":{"description":"Checksum calculated based on decoded `data` value. Validates if importing JSON is exactly the same as the exported one.","type":"string"}}},"ImportResponse":{"allOf":[{"$ref":"#/components/schemas/ImportResult"},{"type":"object","properties":{"importedAt":{"description":"Date of the import process.","type":"string","format":"date-time"},"jobId":{"description":"ID of the job.","type":"string"}}}]},"ImportResult":{"type":"object","properties":{"message":{"type":"string","description":"Short summary of the import."},"summary":{"type":"object","description":"Summary of the import.","properties":{"agents":{"type":"array","items":{"$ref":"#/components/schemas/ImportedEntity"}},"tools":{"type":"array","items":{"$ref":"#/components/schemas/ImportedEntity"}},"mcpServers":{"type":"array","items":{"$ref":"#/components/schemas/ImportedEntity"}}}}}},"ImportedEntity":{"type":"object","properties":{"id":{"type":"string","description":"ID of the imported entity."},"name":{"type":"string","description":"Name of the imported entity."},"state":{"type":"string","description":"State of the imported entity.","enum":["TO_CREATE","ENABLED","DISABLED","EXISTS"]}}},"ErrorMessage":{"type":"object","properties":{"code":{"type":"integer"},"type":{"type":"string"},"message":{"type":"string"},"moreInfo":{"type":"string"},"details":{"type":"array","items":{"type":"object","properties":{"field":{"type":"string"},"type":{"type":"string"},"message":{"type":"string"},"moreInfo":{"type":"string"}}}}},"description":""},"ErrorMessageFault":{"type":"object","properties":{"fault":{"type":"object","properties":{"faultstring":{"type":"string"},"detail":{"type":"object","properties":{"errorcode":{"type":"string"}}}}}}}},"responses":{"400_resp_common":{"description":"The request was syntactically incorrect.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorMessage"}}}},"401_resp_common":{"description":"The authorization token is invalid or has expired.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorMessageFault"}}}},"403_resp_common":{"description":"Authorization scopes of the access token are not sufficient and do not match the scopes required by the endpoint.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorMessage"}}}}}},"paths":{"/ai-service/{tenant}/agentic/agents/import":{"post":{"summary":"Importing agents","operationId":"POST-ai-import-agents","requestBody":{"$ref":"#/components/requestBodies/importRequestBody"},"responses":{"200":{"description":"A single agent.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ImportResponse"}}}},"400":{"$ref":"#/components/responses/400_resp_common"},"401":{"$ref":"#/components/responses/401_resp_common"},"403":{"$ref":"#/components/responses/403_resp_common"}},"description":"Imports the agents from the base64 encoded data.","tags":["Import/Export"]}}}}
```
