# Super Admin API Key

## Create organization via admin API key

> Creates an organization by admin API key. The response includes organization details.

```json
{"openapi":"3.0.0","info":{"title":"AI Agent API","version":"1.0.0"},"servers":[{"url":"https://api.raia2.com","description":"Production server"}],"security":[{"Super-Admin-Secret-Key":[]}],"components":{"securitySchemes":{"Super-Admin-Secret-Key":{"type":"apiKey","in":"header","name":"Super-Admin-Secret-Key","description":"Custom authentication header"}},"schemas":{"ExternalApiCreateOrganizationByApiKeyBodyDTO":{"type":"object","properties":{"name":{"type":"string","description":"Organization name.","maxLength":255},"users":{"description":"List of invited users.","type":"array","items":{"$ref":"#/components/schemas/ExternalApiInviteUserBodyDTO"}},"licenseKey":{"type":"string","description":"Organization license key."},"endedAt":{"format":"date-time","type":"string","description":"Subscription end date. Applies if \"subscriptionId\" is specified and this subscription is not a trial."}},"required":["name","users","licenseKey"]},"ExternalApiInviteUserBodyDTO":{"type":"object","properties":{"email":{"type":"string","description":"Invited user email.","minLength":4,"maxLength":255},"role":{"type":"string","enum":["owner","admin","user","copilot_user","copilot_agent_user","copilot_admin"],"description":"Invited user role."}},"required":["email","role"]},"ExternalApiGetOrganizationResponseDTO":{"type":"object","properties":{"id":{"type":"string","description":"Organization ID.","format":"uuid"},"name":{"type":"string","description":"Organization name."},"status":{"type":"string","enum":["active","pending","archived","blocked"],"description":"Organization status."},"createdAt":{"format":"date-time","type":"string","description":"Creation timestamp"},"updatedAt":{"format":"date-time","type":"string","description":"Last update timestamp"},"createdBy":{"description":"Created by.","allOf":[{"$ref":"#/components/schemas/ExternalApiCreatedByDTO"}]},"subscription":{"description":"Organization subscription.","allOf":[{"$ref":"#/components/schemas/ExternalApiSubscriptionResponseDTO"}]}},"required":["id","name","status","createdAt","updatedAt","createdBy","subscription"]},"ExternalApiCreatedByDTO":{"type":"object","properties":{"id":{"type":"string","description":"ID of the creator.","format":"uuid"},"email":{"type":"string","description":"Email of the creator."},"firstName":{"type":"string","description":"First name of the creator."},"lastName":{"type":"string","description":"Last name of the creator."}},"required":["id","email","firstName","lastName"]},"ExternalApiSubscriptionResponseDTO":{"type":"object","properties":{"id":{"type":"string","description":"Subscription ID.","format":"uuid"},"title":{"type":"string","description":"Subscription title."},"description":{"type":"string","description":"Subscription description."},"agentsAmount":{"type":"number","description":"Number of agents in the subscription."},"tokensAmountPerMonth":{"type":"number","description":"OpenAI tokens amount in the subscription."},"secondsAmountPerMonth":{"type":"number","description":"Vapi seconds amount in the subscription."},"smsAmountPerMonth":{"type":"number","description":"Number of SMS in the subscription."},"emailsAmountPerMonth":{"type":"number","description":"Number of Emails in the subscription."},"usersWithAccessAmount":{"type":"number","description":"Number of users in organizations."},"status":{"type":"string","enum":["active","inactive"],"description":"Subscription status."},"visibility":{"type":"string","enum":["public","private"],"description":"Subscription visibility."},"isTrial":{"type":"boolean","description":"True if subscription is trial."},"createdBy":{"description":"Created by.","allOf":[{"$ref":"#/components/schemas/ExternalApiCreatedByDTO"}]},"createdAt":{"format":"date-time","type":"string","description":"Creation timestamp"},"updatedAt":{"format":"date-time","type":"string","description":"Last update timestamp"},"organizationsCount":{"type":"number","description":"Number of organizations with current subscription."},"price":{"type":"number","description":"Subscription in cent."}},"required":["id","title","description","agentsAmount","tokensAmountPerMonth","secondsAmountPerMonth","smsAmountPerMonth","emailsAmountPerMonth","usersWithAccessAmount","status","visibility","isTrial","createdBy","createdAt","updatedAt","organizationsCount","price"]},"ForbiddenErrorDTO":{"type":"object","properties":{"status":{"type":"number","default":403},"name":{"type":"object","default":"FORBIDDEN_ERROR"},"message":{"type":"string","default":"INVALID_CREDENTIALS"},"details":{"type":"array","items":{"type":"object"}}},"required":["status","name","message","details"]},"EntityNotFoundErrorDTO":{"type":"object","properties":{"status":{"type":"number","default":404},"name":{"type":"object","default":"ENTITY_NOT_FOUND_ERROR"},"message":{"type":"string","default":"ENTITY_NOT_FOUND"},"details":{"type":"array","items":{"type":"object"}}},"required":["status","name","message","details"]},"InternalServerErrorDTO":{"type":"object","properties":{"status":{"type":"number","default":500},"message":{"type":"string","default":"Internal Server Error"}},"required":["status","message"]}}},"paths":{"/external/organizations":{"post":{"description":"Creates an organization by admin API key. The response includes organization details.","operationId":"ExternalApiOrganizationsController_createOrganizationByApiKey","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ExternalApiCreateOrganizationByApiKeyBodyDTO"}}}},"responses":{"201":{"description":"Successfully created the organization.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ExternalApiGetOrganizationResponseDTO"}}}},"403":{"description":"Invalid API key or secret key. Ensure that you are using a valid authentication key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorDTO"}}}},"404":{"description":"Subscription not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EntityNotFoundErrorDTO"}}}},"500":{"description":"Unexpected error occurred while processing the request. Please try again later.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalServerErrorDTO"}}}}},"summary":"Create organization via admin API key","tags":["Super Admin API Key","Organizations"]}}}}
```

## Get subscriptions by admin API key

> Fetches subscriptions by admin API key. The response includes the subscriptions details.

```json
{"openapi":"3.0.0","info":{"title":"AI Agent API","version":"1.0.0"},"servers":[{"url":"https://api.raia2.com","description":"Production server"}],"security":[{"Super-Admin-Secret-Key":[]}],"components":{"securitySchemes":{"Super-Admin-Secret-Key":{"type":"apiKey","in":"header","name":"Super-Admin-Secret-Key","description":"Custom authentication header"}},"schemas":{"ExternalApiSubscriptionResponseDTO":{"type":"object","properties":{"id":{"type":"string","description":"Subscription ID.","format":"uuid"},"title":{"type":"string","description":"Subscription title."},"description":{"type":"string","description":"Subscription description."},"agentsAmount":{"type":"number","description":"Number of agents in the subscription."},"tokensAmountPerMonth":{"type":"number","description":"OpenAI tokens amount in the subscription."},"secondsAmountPerMonth":{"type":"number","description":"Vapi seconds amount in the subscription."},"smsAmountPerMonth":{"type":"number","description":"Number of SMS in the subscription."},"emailsAmountPerMonth":{"type":"number","description":"Number of Emails in the subscription."},"usersWithAccessAmount":{"type":"number","description":"Number of users in organizations."},"status":{"type":"string","enum":["active","inactive"],"description":"Subscription status."},"visibility":{"type":"string","enum":["public","private"],"description":"Subscription visibility."},"isTrial":{"type":"boolean","description":"True if subscription is trial."},"createdBy":{"description":"Created by.","allOf":[{"$ref":"#/components/schemas/ExternalApiCreatedByDTO"}]},"createdAt":{"format":"date-time","type":"string","description":"Creation timestamp"},"updatedAt":{"format":"date-time","type":"string","description":"Last update timestamp"},"organizationsCount":{"type":"number","description":"Number of organizations with current subscription."},"price":{"type":"number","description":"Subscription in cent."}},"required":["id","title","description","agentsAmount","tokensAmountPerMonth","secondsAmountPerMonth","smsAmountPerMonth","emailsAmountPerMonth","usersWithAccessAmount","status","visibility","isTrial","createdBy","createdAt","updatedAt","organizationsCount","price"]},"ExternalApiCreatedByDTO":{"type":"object","properties":{"id":{"type":"string","description":"ID of the creator.","format":"uuid"},"email":{"type":"string","description":"Email of the creator."},"firstName":{"type":"string","description":"First name of the creator."},"lastName":{"type":"string","description":"Last name of the creator."}},"required":["id","email","firstName","lastName"]},"ForbiddenErrorDTO":{"type":"object","properties":{"status":{"type":"number","default":403},"name":{"type":"object","default":"FORBIDDEN_ERROR"},"message":{"type":"string","default":"INVALID_CREDENTIALS"},"details":{"type":"array","items":{"type":"object"}}},"required":["status","name","message","details"]},"InternalServerErrorDTO":{"type":"object","properties":{"status":{"type":"number","default":500},"message":{"type":"string","default":"Internal Server Error"}},"required":["status","message"]}}},"paths":{"/external/subscriptions":{"get":{"description":"Fetches subscriptions by admin API key. The response includes the subscriptions details.","operationId":"ExternalApiSubscriptionsController_findAllPaginated","parameters":[{"name":"visibility","required":false,"in":"query","description":"Subscription visibility.","schema":{"type":"string","enum":["public","private"]}},{"name":"status","required":false,"in":"query","description":"Subscription status.","schema":{"type":"string","enum":["active","inactive"]}}],"responses":{"200":{"description":"Successfully retrieved subscriptions.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ExternalApiSubscriptionResponseDTO"}}}},"403":{"description":"Invalid API key or secret key. Ensure that you are using a valid authentication key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForbiddenErrorDTO"}}}},"500":{"description":"Unexpected error occurred while processing the request. Please try again later.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InternalServerErrorDTO"}}}}},"summary":"Get subscriptions by admin API key","tags":["Super Admin API Key","Subscriptions"]}}}}
```
