|
1
|
import { Table, Note, CodeTabs, CodeTab } from "docs-ui" |
|
2
|
|
|
3
|
export const metadata = { |
|
4
|
title: `organizations Command - Medusa Cloud CLI Reference`, |
|
5
|
} |
|
6
|
|
|
7
|
# {metadata.title} |
|
8
|
|
|
9
|
In this guide, you'll learn how to manage your Cloud organizations using the CLI. |
|
10
|
|
|
11
|
## organizations list |
|
12
|
|
|
13
|
List all organizations your account has access to. |
|
14
|
|
|
15
|
<Note> |
|
16
|
|
|
17
|
If you're authenticated with an access key, you must be using |
|
18
|
a personal access key to use this command. Organization access keys do not have |
|
19
|
permissions to list organizations for a user. |
|
20
|
|
|
21
|
</Note> |
|
22
|
|
|
23
|
```bash |
|
24
|
mcloud organizations list |
|
25
|
``` |
|
26
|
|
|
27
|
### Options |
|
28
|
|
|
29
|
<Table> |
|
30
|
<Table.Header> |
|
31
|
<Table.Row> |
|
32
|
<Table.HeaderCell> |
|
33
|
Option |
|
34
|
</Table.HeaderCell> |
|
35
|
<Table.HeaderCell> |
|
36
|
Description |
|
37
|
</Table.HeaderCell> |
|
38
|
<Table.HeaderCell> |
|
39
|
Default |
|
40
|
</Table.HeaderCell> |
|
41
|
</Table.Row> |
|
42
|
</Table.Header> |
|
43
|
<Table.Body> |
|
44
|
<Table.Row> |
|
45
|
<Table.Cell> |
|
46
|
|
|
47
|
`--json` |
|
48
|
|
|
49
|
</Table.Cell> |
|
50
|
<Table.Cell> |
|
51
|
|
|
52
|
Print the result as JSON instead of formatted text. |
|
53
|
|
|
54
|
</Table.Cell> |
|
55
|
<Table.Cell> |
|
56
|
|
|
57
|
`false` |
|
58
|
|
|
59
|
</Table.Cell> |
|
60
|
</Table.Row> |
|
61
|
</Table.Body> |
|
62
|
</Table> |
|
63
|
|
|
64
|
--- |
|
65
|
|
|
66
|
## organizations get |
|
67
|
|
|
68
|
Retrieve a single organization by its ID, handle, or name. Returns the organization's metadata, subscription details, and members. |
|
69
|
|
|
70
|
```bash |
|
71
|
mcloud organizations get <organization> |
|
72
|
``` |
|
73
|
|
|
74
|
Returns the following information: |
|
75
|
|
|
76
|
<CodeTabs group="cli-output"> |
|
77
|
<CodeTab label="Plaintext" value="plaintext"> |
|
78
|
|
|
79
|
```bash |
|
80
|
ID: <organization-id> |
|
81
|
Name: My Organization |
|
82
|
Legal name: My Organization, Inc. |
|
83
|
Billing email: billing@example.com |
|
84
|
VAT number: DE123456789 |
|
85
|
Status: active |
|
86
|
Account holder: owner@example.com |
|
87
|
Created at: 2024-10-10T08:24:32.382Z |
|
88
|
|
|
89
|
Subscription: |
|
90
|
Plan: Pro (plan_01ABC) |
|
91
|
Status: active |
|
92
|
Current period: Apr 22, 2026, 5:10 PM GMT+3 → May 22, 2026, 5:10 PM GMT+3 |
|
93
|
|
|
94
|
Members (3): |
|
95
|
EMAIL NAME ID CREATED |
|
96
|
alice@example.com Alice Example mem_01ABC Aug 30, 2024, 12:07 PM GMT+3 |
|
97
|
bob@example.com Bob Example mem_01DEF Aug 30, 2024, 12:10 PM GMT+3 |
|
98
|
carol@example.com Carol Example mem_01GHI Aug 30, 2024, 12:15 PM GMT+3 |
|
99
|
``` |
|
100
|
|
|
101
|
</CodeTab> |
|
102
|
<CodeTab label="JSON (--json)" value="json"> |
|
103
|
|
|
104
|
```json |
|
105
|
{ |
|
106
|
"id": "<organization-id>", |
|
107
|
"name": "My Organization", |
|
108
|
"billing_email": "billing@example.com", |
|
109
|
"status": "active", |
|
110
|
"created_by": "<user-id>", |
|
111
|
"created_at": "2024-10-10T08:24:32.382Z", |
|
112
|
"metadata": { |
|
113
|
"notification_preferences": { |
|
114
|
"email": false |
|
115
|
} |
|
116
|
}, |
|
117
|
"members": [ |
|
118
|
{ |
|
119
|
"id": "mem_01ABC", |
|
120
|
"user_id": "<user-id>", |
|
121
|
"organization_id": "<organization-id>", |
|
122
|
"created_at": "2024-08-30T09:07:00.000Z", |
|
123
|
"metadata": null, |
|
124
|
"user": { |
|
125
|
"id": "<user-id>", |
|
126
|
"first_name": "Alice", |
|
127
|
"last_name": "Example", |
|
128
|
"email": "alice@example.com", |
|
129
|
"memberships": [], |
|
130
|
"created_at": "2024-08-30T09:07:00.000Z", |
|
131
|
"updated_at": "2024-08-30T09:07:00.000Z", |
|
132
|
"metadata": null |
|
133
|
}, |
|
134
|
"role": "admin" |
|
135
|
} |
|
136
|
], |
|
137
|
"invites": [ |
|
138
|
{ |
|
139
|
"id": "meminv_01ABC", |
|
140
|
"email": "invited@example.com", |
|
141
|
"organization_id": "<organization-id>", |
|
142
|
"expires_at": "2026-02-20T10:44:39.965Z", |
|
143
|
"created_at": "2026-02-13T10:44:39.972Z", |
|
144
|
"updated_at": "2026-02-13T10:44:39.972Z", |
|
145
|
"deleted_at": null, |
|
146
|
"role": "admin" |
|
147
|
} |
|
148
|
], |
|
149
|
"orders": [], |
|
150
|
"subscription": { |
|
151
|
"id": "sub_01ABC", |
|
152
|
"organization_id": "<organization-id>", |
|
153
|
"is_active": true, |
|
154
|
"current_period_start": "2026-04-22T14:10:18.508Z", |
|
155
|
"current_period_end": "2026-05-22T14:10:18.508Z", |
|
156
|
"plan": { |
|
157
|
"id": "plan_01ABC", |
|
158
|
"name": "Pro", |
|
159
|
"handle": "pro", |
|
160
|
"type": "default", |
|
161
|
"price": { |
|
162
|
"amount": 0, |
|
163
|
"currency_code": "USD" |
|
164
|
}, |
|
165
|
"features": [ |
|
166
|
{ |
|
167
|
"id": "pfeat_01ABC", |
|
168
|
"value": 500, |
|
169
|
"price": { |
|
170
|
"amount": 0, |
|
171
|
"currency_code": "USD" |
|
172
|
}, |
|
173
|
"supports_addons": true, |
|
174
|
"plan_id": "plan_01ABC", |
|
175
|
"feature_id": "feat_01ABC", |
|
176
|
"scope": "organization", |
|
177
|
"handle": "projects", |
|
178
|
"type": "feature" |
|
179
|
} |
|
180
|
], |
|
181
|
"trials": [], |
|
182
|
"metadata": {} |
|
183
|
}, |
|
184
|
"plan_id": "plan_01ABC", |
|
185
|
"started_at": "2024-10-10T08:24:32.382Z", |
|
186
|
"canceled_at": null, |
|
187
|
"grace_period_days": 14, |
|
188
|
"created_at": "2024-10-10T08:24:32.382Z", |
|
189
|
"updated_at": "2026-04-22T14:17:51.544Z", |
|
190
|
"metadata": null |
|
191
|
}, |
|
192
|
"account_holder": { |
|
193
|
"id": "acchld_01ABC", |
|
194
|
"provider_id": "pp_stripe_stripe", |
|
195
|
"external_id": "<stripe-customer-id>", |
|
196
|
"email": "owner@example.com", |
|
197
|
"data": { |
|
198
|
"id": "<stripe-customer-id>", |
|
199
|
"name": "My Organization", |
|
200
|
"email": "owner@example.com", |
|
201
|
"phone": null, |
|
202
|
"object": "customer", |
|
203
|
"address": null, |
|
204
|
"balance": 0, |
|
205
|
"created": 1749634671, |
|
206
|
"currency": null, |
|
207
|
"discount": null, |
|
208
|
"livemode": true, |
|
209
|
"metadata": {}, |
|
210
|
"shipping": null, |
|
211
|
"delinquent": false, |
|
212
|
"tax_exempt": "none", |
|
213
|
"test_clock": null, |
|
214
|
"description": null, |
|
215
|
"default_source": null, |
|
216
|
"invoice_prefix": "<invoice-prefix>", |
|
217
|
"invoice_settings": { |
|
218
|
"footer": null, |
|
219
|
"custom_fields": null, |
|
220
|
"rendering_options": null, |
|
221
|
"default_payment_method": null |
|
222
|
}, |
|
223
|
"preferred_locales": [], |
|
224
|
"next_invoice_sequence": 1 |
|
225
|
}, |
|
226
|
"metadata": null, |
|
227
|
"created_at": "2024-10-10T08:24:32.382Z", |
|
228
|
"updated_at": "2024-10-10T08:24:32.382Z", |
|
229
|
"deleted_at": null |
|
230
|
}, |
|
231
|
"payment_accounts": [] |
|
232
|
} |
|
233
|
``` |
|
234
|
|
|
235
|
</CodeTab> |
|
236
|
</CodeTabs> |
|
237
|
|
|
238
|
### Arguments |
|
239
|
|
|
240
|
<Table> |
|
241
|
<Table.Header> |
|
242
|
<Table.Row> |
|
243
|
<Table.HeaderCell> |
|
244
|
Option |
|
245
|
</Table.HeaderCell> |
|
246
|
<Table.HeaderCell> |
|
247
|
Description |
|
248
|
</Table.HeaderCell> |
|
249
|
<Table.HeaderCell> |
|
250
|
Required |
|
251
|
</Table.HeaderCell> |
|
252
|
<Table.HeaderCell> |
|
253
|
Default |
|
254
|
</Table.HeaderCell> |
|
255
|
</Table.Row> |
|
256
|
</Table.Header> |
|
257
|
<Table.Body> |
|
258
|
<Table.Row> |
|
259
|
<Table.Cell> |
|
260
|
|
|
261
|
`organization` |
|
262
|
|
|
263
|
</Table.Cell> |
|
264
|
<Table.Cell> |
|
265
|
|
|
266
|
The ID, handle, or name of the organization to retrieve. |
|
267
|
|
|
268
|
</Table.Cell> |
|
269
|
<Table.Cell> |
|
270
|
|
|
271
|
No |
|
272
|
|
|
273
|
</Table.Cell> |
|
274
|
<Table.Cell> |
|
275
|
|
|
276
|
Falls back to the organization in the [active context](../use/page.mdx#set-the-active-context), if set. |
|
277
|
|
|
278
|
</Table.Cell> |
|
279
|
</Table.Row> |
|
280
|
</Table.Body> |
|
281
|
</Table> |
|
282
|
|
|
283
|
### Options |
|
284
|
|
|
285
|
<Table> |
|
286
|
<Table.Header> |
|
287
|
<Table.Row> |
|
288
|
<Table.HeaderCell> |
|
289
|
Option |
|
290
|
</Table.HeaderCell> |
|
291
|
<Table.HeaderCell> |
|
292
|
Description |
|
293
|
</Table.HeaderCell> |
|
294
|
<Table.HeaderCell> |
|
295
|
Required |
|
296
|
</Table.HeaderCell> |
|
297
|
<Table.HeaderCell> |
|
298
|
Default |
|
299
|
</Table.HeaderCell> |
|
300
|
</Table.Row> |
|
301
|
</Table.Header> |
|
302
|
<Table.Body> |
|
303
|
<Table.Row> |
|
304
|
<Table.Cell> |
|
305
|
|
|
306
|
`-o <id-handle-or-name>`, `--organization <id-handle-or-name>` |
|
307
|
|
|
308
|
</Table.Cell> |
|
309
|
<Table.Cell> |
|
310
|
|
|
311
|
The ID, handle, or name of the organization to retrieve. Interchangeable with the positional argument. |
|
312
|
|
|
313
|
</Table.Cell> |
|
314
|
<Table.Cell> |
|
315
|
|
|
316
|
No |
|
317
|
|
|
318
|
</Table.Cell> |
|
319
|
<Table.Cell> |
|
320
|
|
|
321
|
Falls back to the organization in the [active context](../use/page.mdx#set-the-active-context), if set. |
|
322
|
|
|
323
|
</Table.Cell> |
|
324
|
</Table.Row> |
|
325
|
<Table.Row> |
|
326
|
<Table.Cell> |
|
327
|
|
|
328
|
`--json` |
|
329
|
|
|
330
|
</Table.Cell> |
|
331
|
<Table.Cell> |
|
332
|
|
|
333
|
Print the result as JSON instead of formatted text. |
|
334
|
|
|
335
|
</Table.Cell> |
|
336
|
<Table.Cell> |
|
337
|
|
|
338
|
No |
|
339
|
|
|
340
|
</Table.Cell> |
|
341
|
<Table.Cell> |
|
342
|
|
|
343
|
`false` |
|
344
|
|
|
345
|
</Table.Cell> |
|
346
|
</Table.Row> |
|
347
|
</Table.Body> |
|
348
|
</Table> |
|
349
|
|
|
350
|
--- |
|
351
|
|
|
352
|
## Find Organization ID |
|
353
|
|
|
354
|
Commands that operate on organizations require an organization ID. You can either: |
|
355
|
|
|
356
|
- Use the interactive selector in [mcloud use](../use/page.mdx#set-the-active-context) to set an active organization for the current context. Once set, you can omit the `--organization` flag from all subsequent commands; |
|
357
|
- Or use `organizations list --json` to get machine-readable organization data. Pipe the output to `jq` to extract IDs for use in subsequent commands. This is useful if you want to set the active organization through an AI agent, script, or CI/CD pipeline. |
|
358
|
|
|
359
|
For example, to set the first organization in the list as the active organization: |
|
360
|
|
|
361
|
<CodeTabs group="os"> |
|
362
|
<CodeTab label="macOS / Linux" value="unix"> |
|
363
|
|
|
364
|
```bash |
|
365
|
ORGANIZATION_ID=$( |
|
366
|
mcloud organizations list --json \ |
|
367
|
| jq -r '.[0].id' |
|
368
|
) |
|
369
|
mcloud use --organization "$ORGANIZATION_ID" |
|
370
|
``` |
|
371
|
|
|
372
|
</CodeTab> |
|
373
|
<CodeTab label="Windows (PowerShell)" value="powershell"> |
|
374
|
|
|
375
|
```powershell |
|
376
|
$ORGANIZATION_ID = ( |
|
377
|
mcloud organizations list --json | |
|
378
|
jq -r '.[0].id' |
|
379
|
) |
|
380
|
mcloud use --organization $ORGANIZATION_ID |
|
381
|
``` |
|
382
|
|
|
383
|
</CodeTab> |
|
384
|
</CodeTabs> |
|
385
|
|
|
386
|
To set the active organization to the ID of an organization by its name: |
|
387
|
|
|
388
|
<CodeTabs group="os"> |
|
389
|
<CodeTab label="macOS / Linux" value="unix"> |
|
390
|
|
|
391
|
```bash |
|
392
|
ORGANIZATION_ID=$( |
|
393
|
mcloud organizations list --json \ |
|
394
|
| jq -r '.[] | select(.name == "My Organization") | .id' |
|
395
|
) |
|
396
|
mcloud use --organization "$ORGANIZATION_ID" |
|
397
|
``` |
|
398
|
|
|
399
|
</CodeTab> |
|
400
|
<CodeTab label="Windows (PowerShell)" value="powershell"> |
|
401
|
|
|
402
|
```powershell |
|
403
|
$ORGANIZATION_ID = ( |
|
404
|
mcloud organizations list --json | |
|
405
|
jq -r '.[] | select(.name == "My Organization") | .id' |
|
406
|
) |
|
407
|
mcloud use --organization $ORGANIZATION_ID |
|
408
|
``` |
|
409
|
|
|
410
|
</CodeTab> |
|
411
|
</CodeTabs> |
|
412
|
|
|
413
|
Once set, you can omit the `--organization` flag from all subsequent commands. |