Create Organization
Create an organization for the authenticated account and receive the caller’s owner membership context.
Endpoint contract
Use the exact method and path shown above. Paths are relative to the API base URL.
Authentication, permission, and scope
| Control | Required contract |
|---|---|
| Authentication | Bearer access token. |
| Permission or scope | Current authenticated account. |
| Resource scope | Creates a new organization and owner membership for the caller. |
Request fields
| Field | Type | Contract |
|---|---|---|
name | string | Required organization name. |
domain | string | Optional organization domain. |
Code examples
import osfrom memorysync import ControlPlaneClientclient = ControlPlaneClient(base_url="https://api.memorysync.io",access_token=os.environ["MEMORYSYNC_ACCESS_TOKEN"],)membership = client.create_organization("Example Organization",domain="example.com",)
Response shape
{"user_id":42,"organization_id":7,"role":"owner"}
- The response is membership session information, not a complete organization object.
- Use the returned organization ID only through authorized application state.
Status outcomes
Read the operation-specific response and persist only fields needed by the task.
Fix invalid path, query, or body fields before trying again.
Refresh authentication or verify the required organization permission and scope.
Treat the resource as unavailable without revealing whether it exists elsewhere.
Use returned retry metadata when present and reconcile uncertain mutations before repeating them.
Production handling
- 01
Authorize
APPConfirm the signed-in principal may perform this product action.
- 02
Validate
INPUTValidate identifiers and body fields before sending the request.
- 03
Call
SDKUse the named ControlPlaneClient method or equivalent HTTPS request from a trusted application context.
- 04
Inspect
RESULTRecord the returned membership context after 201.
- 05
Reconcile
SAFEIf creation is uncertain, list organizations before trying again to avoid duplicate names or memberships.
Security notes
Required
Keep organization controls inside trusted boundaries.
- Create organizations only from authenticated product flows.
- Validate and normalize names and domains before sending.
- Do not let a client assert a different owner user ID.
Avoid
Do not weaken the route contract in client code.
- Do not expose bearer or refresh tokens in URLs, logs, or public clients.
- Do not accept organization, member, project, or resource IDs without application authorization.
- Do not treat returned data as trusted HTML, prompt instructions, or proof of application authorization.