├── README.md
├── images
└── box-dev-logo-clip.png
├── node_modules
└── .yarn-integrity
└── yarn.lock
/README.md:
--------------------------------------------------------------------------------
1 |
5 |
6 | # Box cURL samples
7 |
8 | ## Authorize a user
9 |
10 | Authorize a user by sending them through the [Box](https://box.com)
11 | website and request their permission to act on their behalf.
12 |
13 | This is the first step when authenticating a user using
14 | OAuth 2.0. To request a user's authorization to use the Box APIs
15 | on their behalf you will need to send a user to the URL with this
16 | format.
17 |
18 |
19 |
20 | ```bash
21 | curl -i -X GET "https://account.box.com/api/oauth2/authorize?response_type=code&client_id=ly1nj6n11vionaie65emwzk575hnnmrk&redirect_uri=http://example.com/auth/callback"
22 | ```
23 |
24 | ## Request an access token
25 |
26 | Request an Access Token using either a client-side obtained OAuth2
27 | authorization code or a server-side JWT assertion.
28 |
29 | An Access Token is a string that enables Box to verify that a
30 | request belongs to an authorized session. In the normal order of
31 | operations you will begin by requesting authentication from the
32 | [authorize](#get-authorize) endpoint and Box will send you an
33 | authorization code.
34 |
35 | You will then send this code to this endpoint to exchange it for
36 | an Access Token. The returned Access Token can then be used to to make
37 | Box API calls.
38 |
39 |
40 |
41 | ```bash
42 | curl -i -X POST "https://api.box.com/oauth2/token" \
43 | -H "content-type: application/x-www-form-urlencoded" \
44 | -d "client_id=[CLIENT_ID]" \
45 | -d "client_secret=[CLIENT_SECRET]" \
46 | -d "code=[CODE]" \
47 | -d "grant_type=authorization_code"
48 | ```
49 |
50 | ## Refresh an access token
51 |
52 |
53 |
54 | ```bash
55 | curl -i -X POST "https://api.box.com/oauth2/token" \
56 | -H "content-type: application/x-www-form-urlencoded" \
57 | -d "client_id=[CLIENT_ID]" \
58 | -d "client_secret=[CLIENT_SECRET]" \
59 | -d "refresh_token=[REFRESH_TOKEN]" \
60 | -d "grant_type=refresh_token"
61 | ```
62 |
63 | ## Downscope a token
64 |
65 |
66 |
67 | ```bash
68 | curl -i -X POST "https://api.box.com/oauth2/token" \
69 | -H "content-type: application/x-www-form-urlencoded" \
70 | -d "subject_token=[ACCESS_TOKEN]" \
71 | -d "subject_token_type=urn:ietf:params:oauth:token-type:access_token" \
72 | -d "scope=item_upload item_preview base_explorer" \
73 | -d "resource=https://api.box.com/2.0/folders/123456" \
74 | -d "grant_type=urn:ietf:params:oauth:grant-type:token-exchange"
75 | ```
76 |
77 | ## Revoke an access token
78 |
79 | Revoke an active Access Token, effectively logging a user out
80 | that has been previously authenticated.
81 |
82 |
83 |
84 | ```bash
85 | curl -i -X POST "https://api.box.com/oauth2/revoke" \
86 | -H "content-type: application/x-www-form-urlencoded" \
87 | -d "client_id=[CLIENT_ID]" \
88 | -d "client_secret=[CLIENT_SECRET]" \
89 | -d "token=[ACCESS_TOKEN]"
90 | ```
91 |
92 | ## Authentication with Client Credentials
93 |
94 | Creates a token using Client Credentials Grant, which
95 | allows you to log in as a Service Account.
96 |
97 |
98 |
99 | ```bash
100 | curl -i -X POST "https://api.box.com/oauth2/token" \
101 | -H "content-type: application/x-www-form-urlencoded" \
102 | -d "client_id=[CLIENT_ID]" \
103 | -d "client_secret=[CLIENT_SECRET]" \
104 | -d "grant_type=client_credentials" \
105 | -d "box_subject_type=enterprise" \
106 | -d "box_subject_id=[ENTERPRISE_ID]"
107 | ```
108 |
109 | ## Authentication with CCG as an admin or managed user
110 |
111 | Creates a token using Client Credentials Grant, which
112 | allows you to log in as an admin or a managed user.
113 |
114 |
115 |
116 | ```bash
117 | curl -i -X POST "https://api.box.com/oauth2/token" \
118 | -H "content-type: application/x-www-form-urlencoded" \
119 | -d "client_id=[CLIENT_ID]" \
120 | -d "client_secret=[CLIENT_SECRET]" \
121 | -d "grant_type=client_credentials" \
122 | -d "box_subject_type=user" \
123 | -d "box_subject_id=[USER_ID]"
124 | ```
125 |
126 | ## Authentication with CCG as app user
127 |
128 | Creates a token using Client Credentials Grant, which
129 | allows you to log in as any app user.
130 |
131 |
132 |
133 | ```bash
134 | curl -i -X POST "https://api.box.com/oauth2/token" \
135 | -H "content-type: application/x-www-form-urlencoded" \
136 | -d "client_id=[CLIENT_ID]" \
137 | -d "client_secret=[CLIENT_SECRET]" \
138 | -d "grant_type=client_credentials" \
139 | -d "box_subject_type=user" \
140 | -d "box_subject_id=[APPUSER_ID]"
141 | ```
142 |
143 | ## Send request to AI
144 |
145 |
146 |
147 | ```bash
148 | curl -i -L POST "https://api.box.com/2.0/ai/ask" \
149 | -H "content-type: application/json" \
150 | -H "authorization: Bearer " \
151 | -d '{
152 | "mode": "single_item_qa",
153 | "prompt": "What is the value provided by public APIs based on this document?",
154 | "items": [
155 | {
156 | "type": "file",
157 | "id": "9842787262"
158 | }
159 | ],
160 | "dialogue_history": [
161 | {
162 | "prompt": "Make my email about public APIs sound more professional",
163 | "answer": "Here is the first draft of your professional email about public APIs",
164 | "created_at": "2013-12-12T10:53:43-08:00"
165 | }
166 | ],
167 | "include_citations": true,
168 | "ai_agent": {
169 | "type": "ai_agent_ask",
170 | "long_text": {
171 | "model": "azure__openai__gpt_4o_mini",
172 | "prompt_template": "It is `{current_date}`, and I have $8000 and want to spend a week in the Azores. What should I see?",
173 | },
174 | "basic_text": {
175 | "model": "azure__openai__gpt_4o_mini",
176 | }
177 | }
178 | }'
179 | ```
180 |
181 | ## Send request to AI (extended)
182 |
183 |
184 |
185 | ```bash
186 | curl -i -L POST "https://api.box.com/2.0/ai/ask" \
187 | -H "content-type: application/json" \
188 | -H "authorization: Bearer " \
189 | -d '{
190 | "mode": "single_item_qa",
191 | "prompt": "What is the value provided by public APIs based on this document?",
192 | "items": [
193 | {
194 | "type": "file",
195 | "id": "9842787262"
196 | }
197 | ],
198 | "dialogue_history": [
199 | {
200 | "prompt": "Make my email about public APIs sound more professional",
201 | "answer": "Here is the first draft of your professional email about public APIs",
202 | "created_at": "2013-12-12T10:53:43-08:00"
203 | }
204 | ],
205 | "include_citations": true,
206 | "ai_agent": {
207 | "type": "ai_agent_ask",
208 | "long_text": {
209 | "model": "azure__openai__gpt_4o_mini",
210 | "system_message": "You are a helpful travel assistant specialized in budget travel",
211 | "prompt_template": "It is `{current_date}`, and I have $8000 and want to spend a week in the Azores. What should I see?",
212 | "num_tokens_for_completion": 8400,
213 | "llm_endpoint_params": {
214 | "type": "openai_params",
215 | "temperature": 0.0,
216 | "top_p": 1.0,
217 | "frequency_penalty": 1.5,
218 | "presence_penalty": 1.5,
219 | "stop": "<|im_end|>"
220 | },
221 | "embeddings": {
222 | "model": "openai__text_embedding_ada_002",
223 | "strategy": {
224 | "id": "basic",
225 | "num_tokens_per_chunk": 8400
226 | }
227 | }
228 | },
229 | "basic_text": {
230 | "model": "azure__openai__gpt_4o_mini",
231 | "system_message": "You are a helpful travel assistant specialized in budget travel",
232 | "prompt_template": "It is `{current_date}`, and I have $8000 and want to spend a week in the Azores. What should I see?",
233 | "num_tokens_for_completion": 8400,
234 | "llm_endpoint_params": {
235 | "type": "openai_params",
236 | "temperature": 0.0,
237 | "top_p": 1.0,
238 | "frequency_penalty": 1.5,
239 | "presence_penalty": 1.5,
240 | "stop": "<|im_end|>"
241 | }
242 | },
243 | "long_text_multi": {
244 | "model": "azure__openai__gpt_4o_mini",
245 | "system_message": "You are a helpful travel assistant specialized in budget travel",
246 | "prompt_template": "It is `{current_date}`, and I have $8000 and want to spend a week in the Azores. What should I see?",
247 | "num_tokens_for_completion": 8400,
248 | "llm_endpoint_params": {
249 | "type": "openai_params",
250 | "temperature": 0.0,
251 | "top_p": 1.0,
252 | "frequency_penalty": 1.5,
253 | "presence_penalty": 1.5,
254 | "stop": "<|im_end|>"
255 | },
256 | "embeddings": {
257 | "model": "openai__text_embedding_ada_002",
258 | "strategy": {
259 | "id": "basic",
260 | "num_tokens_per_chunk": 8400
261 | }
262 | }
263 | },
264 | "basic_text_multi": {
265 | "model": "azure__openai__gpt_4o_mini",
266 | "system_message": "You are a helpful travel assistant specialized in budget travel",
267 | "prompt_template": "It is `{current_date}`, and I have $8000 and want to spend a week in the Azores. What should I see?",
268 | "num_tokens_for_completion": 8400,
269 | "llm_endpoint_params": {
270 | "type": "openai_params",
271 | "temperature": 0.0,
272 | "top_p": 1.0,
273 | "frequency_penalty": 1.5,
274 | "presence_penalty": 1.5,
275 | "stop": "<|im_end|>"
276 | }
277 | }
278 | }'
279 | ```
280 |
281 | ## Send text generation request to AI
282 |
283 |
284 |
285 | ```bash
286 | curl -i -L POST "https://api.box.com/2.0/ai/text_gen" \
287 | -H "content-type: application/json" \
288 | -H "authorization: Bearer " \
289 | -d '{
290 | "prompt": "Write a social media post about protein powder.",
291 | "items": [
292 | {
293 | "id": "12345678",
294 | "type": "file",
295 | "content": "More information about protein powders"
296 | },
297 | ],
298 | "dialogue_history": [
299 | {
300 | "prompt": "Can you add some more information?",
301 | "answer": "Public API schemas provide necessary information to integrate with APIs...",
302 | "created_at": "2013-12-12T11:20:43-08:00"
303 | }
304 | ],
305 | "ai_agent": {
306 | "type": "ai_agent_text_gen",
307 | "basic_gen": {
308 | "model": "azure__openai__gpt_4o_mini"
309 | }
310 | }
311 | }'
312 | ```
313 |
314 | ## Send text generation request to AI (extended)
315 |
316 |
317 |
318 | ```bash
319 | curl -i -L POST "https://api.box.com/2.0/ai/text_gen" \
320 | -H "content-type: application/json" \
321 | -H "authorization: Bearer " \
322 | -d '{
323 | "prompt": "Write a social media post about protein powder.",
324 | "items": [
325 | {
326 | "id": "12345678",
327 | "type": "file",
328 | "content": "More information about protein powders"
329 | },
330 | ],
331 | "dialogue_history": [
332 | {
333 | "prompt": "Make my email about public APIs sound more professional",
334 | "answer": "Here is the first draft of your professional email about public APIs",
335 | "created_at": "2013-12-12T10:53:43-08:00"
336 | },
337 | {
338 | "prompt": "Can you add some more information?",
339 | "answer": "Public API schemas provide necessary information to integrate with APIs...",
340 | "created_at": "2013-12-12T11:20:43-08:00"
341 | }
342 | ],
343 | "ai_agent": {
344 | "type": "ai_agent_text_gen",
345 | "basic_gen": {
346 | "model": "azure__openai__gpt_4o_mini",
347 | "system_message": "You are a helpful travel assistant specialized in budget travel",
348 | "prompt_template": "It is `{current_date}`, and I have $8000 and want to spend a week in Azores. What should I see?",
349 | "num_tokens_for_completion": 8400,
350 | "llm_endpoint_params": {
351 | "type": "openai_params",
352 | "temperature": 2.0,
353 | "top_p": 1.0,
354 | "frequency_penalty": 1.5,
355 | "presence_penalty": 1.5,
356 | "stop": "<|im_end|>"
357 | },
358 | "embeddings": {
359 | "model": " openai__text_embedding_ada_002",
360 | "strategy": {
361 | "id": "basic",
362 | "num_tokens_per_chunk": 64
363 | }
364 | },
365 | "content_template": "---{content}---"
366 | }
367 | }
368 | }'
369 | ```
370 |
371 | ## Get default agent config
372 |
373 |
374 |
375 | ```bash
376 | curl -L GET "https://api.box.com/2.0/ai_agent_default?mode=text_gen" \
377 | -H 'Authorization: Bearer '
378 | ```
379 |
380 | ## Create agents
381 |
382 | Creates custom AI agents.
383 |
384 |
385 |
386 | ```bash
387 | curl -L POST "https://api.box.com/2.0/ai-agents" \
388 | -H 'Authorization: Bearer '
389 | -d '{
390 | type:
391 | type: string
392 | description: The type of agent used to handle queries.
393 | enum:
394 | - ai_agent
395 | example: ai_agent
396 | name:
397 | type: string
398 | description: The name of the AI Agent.
399 | example: 'My AI Agent'
400 | access_state:
401 | $ref: ../schemas/ai_agent_access_state.yml
402 | icon_reference:
403 | type: string
404 | minLength: 1
405 | description: |-
406 | The icon reference of the AI Agent. It should have format of the URL https://cdn01.boxcdn.net/app-assets/aistudio/avatars/
407 | where possible values of file_name are: `logo_boxAi.png`,`logo_stamp.png`,`logo_legal.png`,`logo_finance.png`,`logo_config.png`,`logo_handshake.png`,`logo_analytics.png`,`logo_classification.png
408 | example: 'https://cdn01.boxcdn.net/app-assets/aistudio/avatars/logo_analytics.svg'
409 | allowed_entities:
410 | type: array
411 | },
412 | - d '{
413 | items:
414 | $ref: '#/components/schemas/AiAgentAllowedEntity'
415 | description: List of allowed users or groups.
416 | ask:
417 | $ref: '#/components/schemas/AiStudioAgentAsk'
418 | text_gen:
419 | $ref: '#/components/schemas/AiStudioAgentTextGen'
420 | extract:
421 | $ref: '#/components/schemas/AiStudioAgentExtract'
422 | }
423 | ```
424 |
425 | ## Delete AI agent
426 |
427 |
428 |
429 | ```bash
430 | curl -L DELETE "https://api.box.com/2.0/ai_agents/12345" \
431 | -H 'Authorization: Bearer '
432 | ```
433 |
434 | ## Get AI agent by ID
435 |
436 |
437 |
438 | ```bash
439 | curl -i -X GET "https://api.box.com/2.0/ai_agents/1234567890" \
440 | -H "authorization: Bearer "
441 | ```
442 |
443 | ## Get AI agents
444 |
445 |
446 |
447 | ```bash
448 | curl -i -X GET "https://api.box.com/2.0/ai_agents" \
449 | -H "authorization: Bearer "
450 | ```
451 |
452 | ## Update AI agents
453 |
454 |
455 |
456 | ```bash
457 | curl -i -X PUT "https://api.box.com/2.0/ai_agents/1234567890" \
458 | -H "authorization: Bearer "
459 | ```
460 |
461 | ## Extract structured metadata
462 |
463 |
464 |
465 | ```bash
466 | curl -i -L 'https://api.box.com/2.0/ai/extract_structured' \
467 | -H 'content-type: application/json' \
468 | -H 'authorization: Bearer ' \
469 | -d '{
470 | "items": [
471 | {
472 | "id": "12345678",
473 | "type": "file",
474 | "content": "This is file content."
475 | }
476 | ],
477 | "metadata_template": {
478 | "template_key": "",
479 | "type": "metadata_template",
480 | "scope": ""
481 | },
482 | "fields": [
483 | {
484 | "key": "name",
485 | "description": "The name of the person.",
486 | "displayName": "Name",
487 | "prompt": "The name is the first and last name from the email address.",
488 | "type": "string",
489 | "options": [
490 | {
491 | "key": "First Name"
492 | },
493 | {
494 | "key": "Last Name"
495 | }
496 | ]
497 | }
498 | ],
499 | "ai_agent": {
500 | "type": "ai_agent_extract",
501 | "long_text": {
502 | "model": "azure__openai__gpt_4o_mini"
503 | },
504 | "basic_text": {
505 | "model": "azure__openai__gpt_4o_mini"
506 | }
507 | }
508 | }'
509 | ```
510 |
511 | ## Extract structured metadata (extended)
512 |
513 |
514 |
515 | ```bash
516 | curl -i -L 'https://api.box.com/2.0/ai/extract_structured' \
517 | -H 'content-type: application/json' \
518 | -H 'authorization: Bearer ' \
519 | -d '{
520 | "items": [
521 | {
522 | "id": "12345678",
523 | "type": "file",
524 | "content": "This is file content."
525 | }
526 | ],
527 | "metadata_template": {
528 | "template_key": "",
529 | "type": "metadata_template",
530 | "scope": ""
531 | },
532 | "fields": [
533 | {
534 | "key": "name",
535 | "description": "The name of the person.",
536 | "displayName": "Name",
537 | "prompt": "The name is the first and last name from the email address.",
538 | "type": "string",
539 | "options": [
540 | {
541 | "key": "First Name"
542 | },
543 | {
544 | "key": "Last Name"
545 | }
546 | ]
547 | }
548 | ],
549 | "ai_agent": {
550 | "type": "ai_agent_extract",
551 | "long_text": {
552 | "model": "azure__openai__gpt_4o_mini",
553 | "system_message": "You are a helpful travel assistant specialized in budget travel",
554 | "prompt_template": "It is `{current_date}`, and I have $8000 and want to spend a week in the Azores. What should I see?",
555 | "num_tokens_for_completion": 8400,
556 | "llm_endpoint_params": {
557 | "type": "openai_params",
558 | "temperature": 0,
559 | "top_p": 1,
560 | "frequency_penalty": 1.5,
561 | "presence_penalty": 1.5,
562 | "stop": "<|im_end|>"
563 | },
564 | "embeddings": {
565 | "model": "openai__text_embedding_ada_002",
566 | "strategy": {
567 | "id": "basic",
568 | "num_tokens_per_chunk": 64
569 | }
570 | }
571 | },
572 | "basic_text": {
573 | "model": "azure__openai__gpt_4o_mini",
574 | "system_message": "You are a helpful travel assistant specialized in budget travel",
575 | "prompt_template": "It is `{current_date}`, and I have $8000 and want to spend a week in the Azores. What should I see?",
576 | "num_tokens_for_completion": 8400,
577 | "llm_endpoint_params": {
578 | "type": "openai_params",
579 | "temperature": 0,
580 | "top_p": 1,
581 | "frequency_penalty": 1.5,
582 | "presence_penalty": 1.5,
583 | "stop": "<|im_end|>"
584 | }
585 | }
586 | }
587 | }'
588 | ```
589 |
590 | ## Extract metadata
591 |
592 |
593 |
594 | ```bash
595 | curl -i -L 'https://api.box.com/2.0/ai/extract' \
596 | -H 'content-type: application/json' \
597 | -H 'authorization: Bearer ' \
598 | -d '{
599 | "prompt": "Extract data related to contract conditions",
600 | "items": [
601 | {
602 | "type": "file",
603 | "id": "1497741268097"
604 | }
605 | ],
606 | "ai_agent": {
607 | "type": "ai_agent_extract",
608 | "long_text": {
609 | "model": "azure__openai__gpt_4o_mini",
610 | "prompt_template": "It is `{current_date}`, and I have $8000 and want to spend a week in the Azores. What should I see?",
611 | },
612 | "basic_text": {
613 | "model": "azure__openai__gpt_4o_mini",
614 | }
615 | }
616 | }'
617 | ```
618 |
619 | ## Extract metadata (extended)
620 |
621 |
622 |
623 | ```bash
624 | curl -i -L 'https://api.box.com/2.0/ai/extract' \
625 | -H 'content-type: application/json' \
626 | -H 'authorization: Bearer ' \
627 | -d '{
628 | "prompt": "Extract data related to contract conditions",
629 | "items": [
630 | {
631 | "type": "file",
632 | "id": "1497741268097"
633 | }
634 | ],
635 | "ai_agent": {
636 | "type": "ai_agent_extract",
637 | "long_text": {
638 | "model": "azure__openai__gpt_4o_mini",
639 | "system_message": "You are a helpful travel assistant specialized in budget travel",
640 | "prompt_template": "It is `{current_date}`, and I have $8000 and want to spend a week in the Azores. What should I see?",
641 | "num_tokens_for_completion": 8400,
642 | "llm_endpoint_params": {
643 | "type": "openai_params",
644 | "temperature": 0,
645 | "top_p": 1,
646 | "frequency_penalty": 1.5,
647 | "presence_penalty": 1.5,
648 | "stop": "<|im_end|>"
649 | },
650 | "embeddings": {
651 | "model": "openai__text_embedding_ada_002",
652 | "strategy": {
653 | "id": "basic",
654 | "num_tokens_per_chunk": 64
655 | }
656 | }
657 | },
658 | "basic_text": {
659 | "model": "azure__openai__gpt_4o_mini",
660 | "system_message": "You are a helpful travel assistant specialized in budget travel",
661 | "prompt_template": "It is `{current_date}`, and I have $8000 and want to spend a week in the Azores. What should I see?",
662 | "num_tokens_for_completion": 8400,
663 | "llm_endpoint_params": {
664 | "type": "openai_params",
665 | "temperature": 0,
666 | "top_p": 1,
667 | "frequency_penalty": 1.5,
668 | "presence_penalty": 1.5,
669 | "stop": "<|im_end|>"
670 | }
671 | }
672 | }
673 | }'
674 | ```
675 |
676 | ## Add a Doc Gen template
677 |
678 |
679 |
680 | ```bash
681 | curl -L 'https://api.box.com/2.0/docgen_templates' \
682 | -H 'box-version: 2025.0' \
683 | -H 'Authorization: Bearer ' \
684 | -H 'Content-Type: application/json' \
685 | -D '{
686 | "file": {
687 | "id": "12345678",
688 | "type": "file"
689 | }
690 | }'
691 | ```
692 |
693 | ## Delete association between Doc Gen template and file
694 |
695 |
696 |
697 | ```bash
698 | curl -L -X DELETE 'https://api.box.com/2.0/docgen_templates/12345678' \
699 | -H 'box-version: 2025.0' \
700 | -H 'Authorization: Bearer '
701 | ```
702 |
703 | ## Get all Doc Gen templates
704 |
705 |
706 |
707 | ```bash
708 | curl -L 'https://api.box.com/2.0/docgen_templates' \
709 | -H 'box-version: 2025.0' \
710 | -H 'Authorization: Bearer '
711 | ```
712 |
713 | ## Get Doc Gen template by ID
714 |
715 |
716 |
717 | ```bash
718 | curl -L 'https://api.box.com/2.0/docgen_templates/12345678' \
719 | -H 'box-version: 2025.0' \
720 | -H 'Authorization: Bearer '
721 | ```
722 |
723 | ## Get Doc Gen jobs for a template
724 |
725 |
726 |
727 | ```bash
728 | curl -L 'https://api.box.com/2.0/docgen_template_jobs/12345678' \
729 | -H 'box-version: 2025.0' \
730 | -H 'Authorization: Bearer '
731 | ```
732 |
733 | ## Get Doc Gen template tags for template
734 |
735 |
736 |
737 | ```bash
738 | curl -L 'https://api.box.com/2.0/docgen_templates/12345678/tags' \
739 | -H 'box-version: 2025.0' \
740 | -H 'Authorization: Bearer '
741 | ```
742 |
743 | ## Generate a document with Doc Gen
744 |
745 |
746 |
747 | ```bash
748 | curl -L 'https://api.box.com/2.0/docgen_batches' \
749 | -H 'box-version: 2025.0' \
750 | -H 'Authorization: Bearer ' \
751 | -D '{
752 | "file": {
753 | "id": "12345678",
754 | "type": "file"
755 | },
756 | "input_source": "api",
757 | "destination_folder": {
758 | "id": "12345678",
759 | "type": "folder"
760 | },
761 | "output_type": "docx",
762 | "document_generation_data": [
763 | {
764 | "generated_file_name": "Image test",
765 | "user_input": {
766 | "order": {
767 | "id": "12305",
768 | "date": "18-08-2023",
769 | "country": "US",
770 | "expiryDate": "18-08-2024",
771 | "currency": "$",
772 | "amount": 5060.5,
773 | "taxRate": 10,
774 | "requester": "John",
775 | "approver": "Smith",
776 | "department": "Procurement",
777 | "paymentTerms": "30 days",
778 | "deliveryTerms": "30 days",
779 | "deliveryDate": "18-09-2023",
780 | "vendor": {
781 | "company": "Example company",
782 | "address": {
783 | "street": "Example street",
784 | "city": "Example city",
785 | "zip": "EX-456"
786 | }
787 | },
788 | "products": [
789 | {
790 | "id": 1,
791 | "name": "A4 Papers",
792 | "type": "non-fragile",
793 | "quantity": 100,
794 | "price": 29,
795 | "amount": 2900
796 | },
797 | {
798 | "id": 2,
799 | "name": "Ink Cartridge",
800 | "type": "non-fragile",
801 | "quantity": 40,
802 | "price": 39,
803 | "amount": 1560
804 | },
805 | {
806 | "id": 3,
807 | "name": "Adhesive tape",
808 | "type": "non-fragile",
809 | "quantity": 20,
810 | "price": 30,
811 | "amount": 600.5
812 | }
813 | ]
814 | }
815 | }
816 | }
817 | ]`
818 |
819 | ```
820 |
821 | ## Get all Doc Gen jobs
822 |
823 |
824 |
825 | ```bash
826 | curl -i -X GET "https://api.box.com/2.0/docgen_jobs" \
827 | -H 'box-version: 2025.0' \
828 | -H "authorization: Bearer "
829 | ```
830 |
831 | ## Get Doc Gen job by ID
832 |
833 |
834 |
835 | ```bash
836 | curl -i -X GET "https://api.box.com/2.0/docgen_jobs/12345" \
837 | -H 'box-version: 2025.0' \
838 | -H "authorization: Bearer "
839 | ```
840 |
841 |
842 | ## Get Doc Gen job for a specific batch
843 |
844 |
845 |
846 | ```bash
847 | curl -i -X GET "https://api.box.com/2.0/docgen_batch_jobs/12345" \
848 | -H 'box-version: 2025.0' \
849 | -H "authorization: Bearer "
850 | ```
851 |
852 | ## Get a file
853 |
854 | Retrieves the details about a file.
855 |
856 |
857 |
858 | ```bash
859 | curl -i -X GET "https://api.box.com/2.0/files/12345" \
860 | -H "authorization: Bearer "
861 | ```
862 |
863 | ## Restore file
864 |
865 | Restores an file that has been moved to the trash.
866 |
867 |
868 |
869 | ```bash
870 | curl -i -X POST "https://api.box.com/2.0/files/12345" \
871 | -H "authorization: Bearer "
872 | ```
873 |
874 | ## Update a file
875 |
876 | Updates a file. This can be used to rename or move a file,
877 | create a shared link, or lock a file.
878 |
879 |
880 |
881 | ```bash
882 | curl -i -X PUT "https://api.box.com/2.0/files/12345" \
883 | -H "authorization: Bearer " \
884 | -H "content-type: application/json" \
885 | -d '{
886 | "name": "New name"
887 | }'
888 | ```
889 |
890 | ## Delete a file
891 |
892 | Deletes a file, either permanently or by moving it to
893 | the trash.
894 |
895 | The the enterprise settings determine whether the item will
896 | be permanently deleted from Box or moved to the trash.
897 |
898 |
899 |
900 | ```bash
901 | curl -i -X DELETE "https://api.box.com/2.0/files/12345" \
902 | -H "authorization: Bearer "
903 | ```
904 |
905 | ## Download a file
906 |
907 | Returns the contents of a file in binary format.
908 |
909 |
910 |
911 | ```bash
912 | curl -i -L -X GET "https://api.box.com/2.0/files/12345/content" \
913 | -H "authorization: Bearer " \
914 | ```
915 |
916 | ## Download a file version
917 |
918 |
919 |
920 | ```bash
921 | curl -i -L -X GET "https://api.box.com/2.0/files/12345/content?version=4" \
922 | -H "authorization: Bearer " \
923 | ```
924 |
925 | ## Get download URL
926 |
927 |
928 |
929 | ```bash
930 | curl -i -X GET "https://api.box.com/2.0/files/12345/content?version=4" \
931 | -H "authorization: Bearer "
932 | ```
933 |
934 | ## Download a shared link
935 |
936 | Returns the contents of a file in binary format.
937 |
938 |
939 |
940 | ```bash
941 | curl -i -L -X GET "https://api.box.com/2.0/files/12345/content" \
942 | -H "authorization: Bearer " \
943 | -H "boxapi: shared_link=https://cloud.box.com/shared/static/gjasdasjhasd&shared_link_password=letmein" \
944 | ```
945 |
946 | ## Upload a file version
947 |
948 | Update a file's content. For file sizes over 50MB we recommend
949 | using the Chunk Upload APIs.
950 |
951 |
952 |
953 | ```bash
954 | curl -i -X POST "https://upload.box.com/api/2.0/files/12345/content" \
955 | -H "authorization: Bearer " \
956 | -H "content-type: multipart/form-data" \
957 | -F attributes='{"name":"Contract.pdf", "parent":{"id":"11446498"}}' \
958 | -F file=@
959 | ```
960 |
961 | ## Preflight check
962 |
963 | Performs a check to verify that a file will be accepted by Box
964 | before you upload the entire file.
965 |
966 |
967 |
968 | ```bash
969 | curl -i -X OPTIONS "https://api.box.com/2.0/files/content" \
970 | -H "authorization: Bearer " \
971 | -H "content-type: application/json" \
972 | -d '{"name":"Contract.pdf", "parent":{"id":"11446498"}}'
973 | ```
974 |
975 |
976 |
977 | ```bash
978 | curl -i -X OPTIONS "https://api.box.com/2.0/files/12345/content" \
979 | -H "authorization: Bearer " \
980 | -H "content-type: application/json" \
981 | -d '{"name":"Contract.pdf", "parent":{"id":"11446498"}}'
982 | ```
983 |
984 | ## Upload a file
985 |
986 | Uploads a small file to Box. For file sizes over 50MB we recommend
987 | using the Chunk Upload APIs.
988 |
989 |
990 |
991 | ```bash
992 | curl -i -X POST "https://upload.box.com/api/2.0/files/content" \
993 | -H "authorization: Bearer " \
994 | -H "content-type: multipart/form-data" \
995 | -F attributes='{"name":"Contract.pdf", "parent":{"id":"11446498"}}' \
996 | -F file=@
997 | ```
998 |
999 | ## Create upload session
1000 |
1001 | Creates an upload session for a new file.
1002 |
1003 |
1004 |
1005 | ```bash
1006 | curl -i -X POST "https://upload.box.com/api/2.0/files/upload_sessions" \
1007 | -H "authorization: Bearer " \
1008 | -H "content-type: application/json" \
1009 | -d '{
1010 | "folder_id": "0",
1011 | "file_size": 104857600,
1012 | "file_name": "Contract.pdf"
1013 | }'
1014 | ```
1015 |
1016 | ## Create upload session for existing file
1017 |
1018 | Creates an upload session for an existing file.
1019 |
1020 |
1021 |
1022 | ```bash
1023 | curl -i -X POST "https://upload.box.com/api/2.0/files/12345/upload_sessions" \
1024 | -H "authorization: Bearer " \
1025 | -H "content-type: application/json" \
1026 | -d '{
1027 | "file_size": 104857600
1028 | }'
1029 | ```
1030 |
1031 | ## Get upload session
1032 |
1033 | Return information about an upload session.
1034 |
1035 |
1036 |
1037 | ```bash
1038 | curl -i -X GET "https://upload.box.com/2.0/files/upload_sessions/F971964745A5CD0C001BBE4E58196BFD" \
1039 | -H "authorization: Bearer "
1040 | ```
1041 |
1042 | ## Upload a part
1043 |
1044 | Updates a chunk of an upload session for a file.
1045 |
1046 |
1047 |
1048 | ```bash
1049 | curl -i -X PUT "https://upload.box.com/2.0/files/upload_sessions/F971964745A5CD0C001BBE4E58196BFD" \
1050 | -H "authorization: Bearer " \
1051 | -H "digest: sha=fpRyg5eVQletdZqEKaFlqwBXJzM=" \
1052 | -H "content-range: bytes 8388608-16777215/445856194" \
1053 | -H "content-type: application/octet-stream" \
1054 | --data-binary @
1055 | ```
1056 |
1057 | ## Abort upload session
1058 |
1059 | Abort an upload session and discard all data uploaded.
1060 |
1061 | This cannot be reversed.
1062 |
1063 |
1064 |
1065 | ```bash
1066 | curl -i -X DELETE "https://upload.box.com/2.0/files/upload_sessions/F971964745A5CD0C001BBE4E58196BFD" \
1067 | -H "authorization: Bearer "
1068 | ```
1069 |
1070 | ## List parts
1071 |
1072 | Return a list of the chunks uploaded to the upload
1073 | session so far.
1074 |
1075 |
1076 |
1077 | ```bash
1078 | curl -i -X GET "https://upload.box.com/2.0/files/upload_sessions/F971964745A5CD0C001BBE4E58196BFD/parts" \
1079 | -H "authorization: Bearer "
1080 | ```
1081 |
1082 | ## Commit upload session
1083 |
1084 | Close an upload session and create a file from the
1085 | uploaded chunks.
1086 |
1087 |
1088 |
1089 | ```bash
1090 | curl -i -X POST "https://upload.box.com/2.0/files/upload_sessions/F971964745A5CD0C001BBE4E58196BFD/commit" \
1091 | -H "authorization: Bearer " \
1092 | -H "digest: sha=fpRyg5eVQletdZqEKaFlqwBXJzM=" \
1093 | -H "content-type: application/json" \
1094 | -d '{
1095 | "parts": [
1096 | {
1097 | "part_id": "BFDF5379",
1098 | "offset": 0,
1099 | "size": 8388608,
1100 | "sha1": "134b65991ed521fcfe4724b7d814ab8ded5185dc"
1101 | },
1102 | {
1103 | "part_id": "E8A3ED8E",
1104 | "offset": 8388608,
1105 | "size": 1611392,
1106 | "sha1": "234b65934ed521fcfe3424b7d814ab8ded5185dc"
1107 | }
1108 | ],
1109 | "attributes": {
1110 | "content_modified_at": "2017-04-08T00:58:08Z"
1111 | }
1112 | }'
1113 | ```
1114 |
1115 | ## Copy a file
1116 |
1117 | Creates a copy of a file.
1118 |
1119 |
1120 |
1121 | ```bash
1122 | curl -i -X POST "https://api.box.com/2.0/files/12345/copy" \
1123 | -H "authorization: Bearer " \
1124 | -H "content-type: application/json" \
1125 | -d '{
1126 | "parent": {
1127 | "id": "123"
1128 | }
1129 | }'
1130 | ```
1131 |
1132 | ## Get a file thumbnail
1133 |
1134 | Retrieves a thumbnail, or smaller image representation, of a file.
1135 |
1136 | Sizes of `32x32`,`64x64`, `128x128`, and `256x256` can be returned in
1137 | the `.png` format and sizes of `32x32`, `94x94`, `160x160`, and `320x320`
1138 | can be returned in the `.jpg` format.
1139 |
1140 | Thumbnails can be generated for the image and video file formats listed
1141 | [found on our community site](http://community.box.com/t5/Managing-
1142 | Your-Content/What-file-types-are-supported-by-Box-s-Content-Preview/
1143 | ta-p/327).
1144 |
1145 |
1146 |
1147 | ```bash
1148 | curl -i -X GET "https://api.box.com/2.0/files/12345/thumbnail.png" \
1149 | -H "authorization: Bearer "
1150 | ```
1151 |
1152 | ## Get file collaborations
1153 |
1154 | Retrieves a list of collaborations for a file. This
1155 | returns all the users that have access to the file.
1156 |
1157 |
1158 |
1159 | ```bash
1160 | curl -i -X GET "https://api.box.com/2.0/files/12345/collaborations" \
1161 | -H "authorization: Bearer "
1162 | ```
1163 |
1164 | ## List a file's comments
1165 |
1166 | Retrieves a list of comments for a file.
1167 |
1168 |
1169 |
1170 | ```bash
1171 | curl -i -X GET "https://api.box.com/2.0/files/12345/comments" \
1172 | -H "authorization: Bearer "
1173 | ```
1174 |
1175 | ## Get file tasks
1176 |
1177 | Retrieves a list of all the tasks for a file. This
1178 | endpoint does not support paging.
1179 |
1180 |
1181 |
1182 | ```bash
1183 | curl -i -X GET "https://api.box.com/2.0/files/12345/tasks" \
1184 | -H "authorization: Bearer "
1185 | ```
1186 |
1187 | ## Get trashed file
1188 |
1189 | Retrieves a file that has been moved to the trash.
1190 |
1191 |
1192 |
1193 | ```bash
1194 | curl -i -X GET "https://api.box.com/2.0/files/12345/trash" \
1195 | -H "authorization: Bearer "
1196 | ```
1197 |
1198 | ## Permanently delete file
1199 |
1200 | Permanently deletes a file that is in the trash.
1201 | This action cannot be undone.
1202 |
1203 |
1204 |
1205 | ```bash
1206 | curl -i -X DELETE "https://api.box.com/2.0/files/12345/trash" \
1207 | -H "authorization: Bearer "
1208 | ```
1209 |
1210 | ## List all file versions
1211 |
1212 | Retrieve information on all version of a file. This endpoint can be used to
1213 | retrieve information about older versions of a file.
1214 |
1215 | Versions are only tracked for Box users with premium accounts.
1216 |
1217 |
1218 |
1219 | ```bash
1220 | curl -i -X GET "https://api.box.com/2.0/files/12345/versions" \
1221 | -H "authorization: Bearer "
1222 | ```
1223 |
1224 | ## Get a file version
1225 |
1226 | Retrieve a specific older version of a file.
1227 |
1228 | Versions are only tracked for Box users with premium accounts.
1229 |
1230 |
1231 |
1232 | ```bash
1233 | curl -i -X GET "https://api.box.com/2.0/files/12345/versions/456456" \
1234 | -H "authorization: Bearer "
1235 | ```
1236 |
1237 | ## Delete file version
1238 |
1239 | Move a file version to the trash.
1240 |
1241 | Versions are only tracked for Box users with premium accounts.
1242 |
1243 |
1244 |
1245 | ```bash
1246 | curl -i -X DELETE "https://api.box.com/2.0/files/12345/versions/456456" \
1247 | -H "authorization: Bearer "
1248 | ```
1249 |
1250 | ## Promote file version
1251 |
1252 | Promote a specific version of a file.
1253 |
1254 | If previous versions exist, this method can be used to
1255 | promote one of the older versions to the top of the version history.
1256 |
1257 | This actually creates a new copy of the old version and puts it at the
1258 | top of the versions history. The file will have the exact same contents
1259 | as the older version, with the the same SHA1/etag, and the same name
1260 | as the original.
1261 |
1262 | Other properties such as comments do not get updated to their
1263 | former values.
1264 | Don't use this endpoint to restore Box Notes,
1265 | as it works with file formats such as PDF, DOC, PPTX or similar.
1266 |
1267 |
1268 |
1269 | ```bash
1270 | curl -i -X POST "https://api.box.com/2.0/files/12345/versions/current" \
1271 | -H "authorization: Bearer " \
1272 | -H "content-type: application/json" \
1273 | -d '{
1274 | "type": "file_version",
1275 | "id": "456456"
1276 | }'
1277 | ```
1278 |
1279 | ## Restore file version
1280 |
1281 | Restores a specific version of a file after it was deleted.
1282 | Don't use this endpoint to restore Box Notes,
1283 | as it works with file formats such as PDF, DOC, PPTX or similar.
1284 |
1285 |
1286 |
1287 | ```bash
1288 | curl -i -X POST "https://api.box.com/2.0/files/12345/versions/456456" \
1289 | -H "authorization: Bearer " \
1290 | -H "content-type: application/json" \
1291 | -d '{
1292 | "trashed_at": null
1293 | }'
1294 | ```
1295 |
1296 | ## List file's metadata
1297 |
1298 | Retrieves all metadata for a given file.
1299 |
1300 |
1301 |
1302 | ```bash
1303 | curl -i -X GET "https://api.box.com/2.0/files/12345/metadata" \
1304 | -H "authorization: Bearer "
1305 | ```
1306 |
1307 | ## Get specific file metadata
1308 |
1309 | Retrieve a specific metadata template instance for a file
1310 |
1311 |
1312 |
1313 | ```bash
1314 | curl -i -X GET "https://api.box.com/2.0/files/12345/metadata/enterprise_27335/blueprintTemplate" \
1315 | -H "authorization: Bearer "
1316 | ```
1317 |
1318 | ## Create metadata on file
1319 |
1320 | Creates a piece of metadata on a file based on the specified template.
1321 |
1322 | Only values that are present in the metadata template
1323 | will be accepted.
1324 |
1325 |
1326 |
1327 | ```bash
1328 | curl -i -X POST "https://api.box.com/2.0/files/12345/metadata/enterprise_27335/blueprintTemplate" \
1329 | -H "authorization: Bearer " \
1330 | -H "content-type: application/json" \
1331 | -d '{
1332 | "audience": "internal",
1333 | "documentType": "Q1 plans",
1334 | "competitiveDocument": "no",
1335 | "status": "active",
1336 | "author": "Jones",
1337 | "currentState": "proposal"
1338 | }'
1339 |
1340 | ```
1341 |
1342 | ## Update file metadata
1343 |
1344 | Updates a piece of metadata on a file.
1345 |
1346 | The metadata instance can only be updated if the instance
1347 | already exists. When editing metadata, only values that adhere to the
1348 | metadata template schema will be accepted.
1349 |
1350 | The update is applied atomically. If any errors occur during the
1351 | application of the operations, the metadata instance remains unchanged.
1352 |
1353 |
1354 |
1355 | ```bash
1356 | curl -i -X PUT "https://api.box.com/2.0/files/12345/metadata/enterprise_27335/blueprintTemplate" \
1357 | -H "authorization: Bearer " \
1358 | -H "content-type: application/json-patch+json" \
1359 | -d '[
1360 | {
1361 | "op": "test",
1362 | "path": "/competitiveDocument",
1363 | "value": "no"
1364 | },
1365 | {
1366 | "op": "remove",
1367 | "path": "/competitiveDocument"
1368 | },
1369 | {
1370 | "op": "test",
1371 | "path": "/status",
1372 | "value": "active"
1373 | },
1374 | {
1375 | "op": "replace",
1376 | "path": "/status",
1377 | "value": "inactive"
1378 | },
1379 | {
1380 | "op": "test",
1381 | "path": "/author",
1382 | "value": "Jones"
1383 | },
1384 | {
1385 | "op": "copy",
1386 | "from": "/author",
1387 | "path": "/editor"
1388 | },
1389 | {
1390 | "op": "test",
1391 | "path": "/currentState",
1392 | "value": "proposal"
1393 | },
1394 | {
1395 | "op": "move",
1396 | "from": "/currentState",
1397 | "path": "/previousState"
1398 | },
1399 | {
1400 | "op": "add",
1401 | "path": "/currentState",
1402 | "value": "reviewed"
1403 | }
1404 | ]'
1405 | ```
1406 |
1407 | ## Delete file metadata
1408 |
1409 | Deletes a piece of file metadata.
1410 |
1411 |
1412 |
1413 | ```bash
1414 | curl -i -X DELETE "https://api.box.com/2.0/files/12345/metadata/enterprise_27335/blueprintTemplate" \
1415 | -H "authorization: Bearer "
1416 | ```
1417 |
1418 | ## Get file watermark
1419 |
1420 | Retrieve the watermark for a file.
1421 |
1422 |
1423 |
1424 | ```bash
1425 | curl -i -X GET "https://api.box.com/2.0/files/12345/watermark" \
1426 | -H "authorization: Bearer "
1427 | ```
1428 |
1429 | ## Apply watermark to file
1430 |
1431 | Applies or update a watermark on a file.
1432 |
1433 |
1434 |
1435 | ```bash
1436 | curl -i -X PUT "https://api.box.com/2.0/files/12345/watermark" \
1437 | -H "authorization: Bearer " \
1438 | -H "content-type: application/json" \
1439 | -d '{
1440 | "watermark": {
1441 | "imprint": "default"
1442 | }
1443 | }'
1444 | ```
1445 |
1446 | ## Remove file watermark
1447 |
1448 | Removes the watermark from a file.
1449 |
1450 |
1451 |
1452 | ```bash
1453 | curl -i -X DELETE "https://api.box.com/2.0/files/12345/watermark" \
1454 | -H "authorization: Bearer "
1455 | ```
1456 |
1457 | ## Get a folder
1458 |
1459 | Retrieves details for a folder, including the first 100 entries
1460 | in the folder.
1461 |
1462 | To fetch more items within the folder, please use the
1463 | [Get items in a folder](#get-folders-id-items) endpoint.
1464 |
1465 |
1466 |
1467 | ```bash
1468 | curl -i -X GET "https://api.box.com/2.0/folders/4353455" \
1469 | -H "authorization: Bearer "
1470 | ```
1471 |
1472 | ## Restore folder
1473 |
1474 | Restores a folder that has been moved to the trash.
1475 |
1476 |
1477 |
1478 | ```bash
1479 | curl -i -X POST "https://api.box.com/2.0/folders/4353455" \
1480 | -H "authorization: Bearer "
1481 | ```
1482 |
1483 | ## Update a folder
1484 |
1485 | Updates a folder. This can be also be used to move the folder,
1486 | create shared links, update collaborations, and more.
1487 |
1488 |
1489 |
1490 | ```bash
1491 | curl -i -X PUT "https://api.box.com/2.0/folders/4353455" \
1492 | -H "authorization: Bearer " \
1493 | -H "content-type: application/json" \
1494 | -d '{
1495 | "name": "New folder name"
1496 | }'
1497 | ```
1498 |
1499 | ## Move a folder
1500 |
1501 |
1502 |
1503 | ```bash
1504 | curl -i -X PUT "https://api.box.com/2.0/folders/4353455" \
1505 | -H "authorization: Bearer " \
1506 | -H "content-type: application/json" \
1507 | -d '{
1508 | "name": "New folder name",
1509 | "parent": {
1510 | "id": "123"
1511 | }
1512 | }'
1513 | ```
1514 |
1515 | ## Move a subfolder to a private folder
1516 |
1517 |
1518 |
1519 | ```bash
1520 | curl -i -X PUT "https://api.box.com/2.0/folders/4353455" \
1521 | -H "authorization: Bearer " \
1522 | -H "content-type: application/json" \
1523 | -d '{
1524 | "name": "New folder name",
1525 | "parent": {
1526 | "id": "123"
1527 | }
1528 | "owned_by": {
1529 | "id": "123456"
1530 | }
1531 | }'
1532 | ```
1533 |
1534 | ## Rename a folder
1535 |
1536 |
1537 |
1538 | ```bash
1539 | curl -i -X PUT "https://api.box.com/2.0/folders/4353455" \
1540 | -H "authorization: Bearer " \
1541 | -H "content-type: application/json" \
1542 | -d '{
1543 | "name": "New folder name"
1544 | }'
1545 | ```
1546 |
1547 | ## Change folder owner
1548 |
1549 |
1550 |
1551 | ```bash
1552 | curl -i -X PUT "https://api.box.com/2.0/folders/4353455" \
1553 | -H "authorization: Bearer " \
1554 | -H "content-type: application/json" \
1555 | -d '{
1556 | "owned_by": {
1557 | "id": "123"
1558 | }
1559 | }'
1560 | ```
1561 |
1562 | ## Delete a folder
1563 |
1564 | Deletes a folder, either permanently or by moving it to
1565 | the trash.
1566 |
1567 |
1568 |
1569 | ```bash
1570 | curl -i -X DELETE "https://api.box.com/2.0/folders/4353455" \
1571 | -H "authorization: Bearer "
1572 | ```
1573 |
1574 | ## Get items in folder
1575 |
1576 | Retrieves a page of items in a folder. These items can be files,
1577 | folders, and web links.
1578 |
1579 | To request more information about the folder itself, like its size,
1580 | please use the [Get a folder](#get-folders-id) endpoint instead.
1581 |
1582 |
1583 |
1584 | ```bash
1585 | curl -i -X GET "https://api.box.com/2.0/folders/0/items" \
1586 | -H "authorization: Bearer "
1587 | ```
1588 |
1589 | ## Create a folder
1590 |
1591 | Creates a new empty folder within the specified parent folder.
1592 |
1593 |
1594 |
1595 | ```bash
1596 | curl -i -X POST "https://api.box.com/2.0/folders" \
1597 | -H "authorization: Bearer " \
1598 | -H "content-type: application/json" \
1599 | -d '{
1600 | "name": "New Folder",
1601 | "parent": {
1602 | "id": "0"
1603 | }
1604 | }'
1605 | ```
1606 |
1607 | ## Copy a folder
1608 |
1609 | Creates a copy of a folder within a destination folder.
1610 |
1611 | The original folder will not be changed.
1612 |
1613 |
1614 |
1615 | ```bash
1616 | curl -i -X POST "https://api.box.com/2.0/folders/4353455/copy" \
1617 | -H "authorization: Bearer " \
1618 | -H "content-type: application/json" \
1619 | -d '{
1620 | "parent": {
1621 | "id": "345345"
1622 | }
1623 | }'
1624 | ```
1625 |
1626 | ## Get folder collaborations
1627 |
1628 | Retrieves a list of collaborations for a folder. This
1629 | returns all the users that have access to the folder.
1630 |
1631 |
1632 |
1633 | ```bash
1634 | curl -i -X GET "https://api.box.com/2.0/folders/4353455/collaborations" \
1635 | -H "authorization: Bearer "
1636 | ```
1637 |
1638 | ## Get trashed folder
1639 |
1640 | Retrieves a folder that has been moved to the trash.
1641 |
1642 |
1643 |
1644 | ```bash
1645 | curl -i -X GET "https://api.box.com/2.0/folders/4353455/trash" \
1646 | -H "authorization: Bearer "
1647 | ```
1648 |
1649 | ## Permanently delete folder
1650 |
1651 | Permanently deletes a folder that is in the trash.
1652 | This action cannot be undone.
1653 |
1654 |
1655 |
1656 | ```bash
1657 | curl -i -X DELETE "https://api.box.com/2.0/folders/4353455/trash" \
1658 | -H "authorization: Bearer "
1659 | ```
1660 |
1661 | ## List folder's metadata
1662 |
1663 | Retrieves all metadata for a given folder.
1664 |
1665 |
1666 |
1667 | ```bash
1668 | curl -i -X GET "https://api.box.com/2.0/folders/4353455/metadata" \
1669 | -H "authorization: Bearer "
1670 | ```
1671 |
1672 | ## Get specific folder metadata
1673 |
1674 | Retrieve a specific metadata template instance for a folder
1675 |
1676 |
1677 |
1678 | ```bash
1679 | curl -i -X GET "https://api.box.com/2.0/folders/4353455/metadata/enterprise_27335/blueprintTemplate" \
1680 | -H "authorization: Bearer "
1681 | ```
1682 |
1683 | ## Create metadata on folder
1684 |
1685 | Creates a piece of metadata on a folder based on the specified template.
1686 |
1687 | Only values that are present in the metadata template
1688 | will be accepted.
1689 |
1690 |
1691 |
1692 | ```bash
1693 | curl -i -X POST "https://api.box.com/2.0/folders/4353455/metadata/enterprise_27335/blueprintTemplate" \
1694 | -H "authorization: Bearer " \
1695 | -H "content-type: application/json" \
1696 | -d '{
1697 | "audience": "internal",
1698 | "documentType": "Q1 plans",
1699 | "competitiveDocument": "no",
1700 | "status": "active",
1701 | "author": "Jones",
1702 | "currentState": "proposal"
1703 | }'
1704 | ```
1705 |
1706 | ## Update folder metadata
1707 |
1708 | Updates a piece of metadata on a folder based.
1709 |
1710 | The metadata instance can only be updated if the instance
1711 | already exists. When editing metadata, only values that adhere to the
1712 | metadata template schema will be accepted.
1713 |
1714 | The update is applied atomically. If any errors occur during the
1715 | application of the operations, the metadata instance remains unchanged.
1716 |
1717 |
1718 |
1719 | ```bash
1720 | curl -i -X PUT "https://api.box.com/2.0/folders/4353455/metadata/enterprise_27335/blueprintTemplate" \
1721 | -H "authorization: Bearer " \
1722 | -H "content-type: application/json-patch+json" \
1723 | -d '[
1724 | {
1725 | "op": "test",
1726 | "path": "/competitiveDocument",
1727 | "value": "no"
1728 | },
1729 | {
1730 | "op": "remove",
1731 | "path": "/competitiveDocument"
1732 | },
1733 | {
1734 | "op": "test",
1735 | "path": "/status",
1736 | "value": "active"
1737 | },
1738 | {
1739 | "op": "replace",
1740 | "path": "/status",
1741 | "value": "inactive"
1742 | },
1743 | {
1744 | "op": "test",
1745 | "path": "/author",
1746 | "value": "Jones"
1747 | },
1748 | {
1749 | "op": "copy",
1750 | "from": "/author",
1751 | "path": "/editor"
1752 | },
1753 | {
1754 | "op": "test",
1755 | "path": "/currentState",
1756 | "value": "proposal"
1757 | },
1758 | {
1759 | "op": "move",
1760 | "from": "/currentState",
1761 | "path": "/previousState"
1762 | },
1763 | {
1764 | "op": "add",
1765 | "path": "/currentState",
1766 | "value": "reviewed"
1767 | }
1768 | ]'
1769 | ```
1770 |
1771 | ## Delete folder metadata
1772 |
1773 | Deletes a piece of folder metadata.
1774 |
1775 |
1776 |
1777 | ```bash
1778 | curl -i -X DELETE "https://api.box.com/2.0/folders/4353455/metadata/enterprise_27335/blueprintTemplate" \
1779 | -H "authorization: Bearer "
1780 | ```
1781 |
1782 | ## List trashed items
1783 |
1784 | Retrieves the files and folders that have been moved
1785 | to the trash.
1786 |
1787 | Any attribute in the full files or folders objects can be passed
1788 | in with the `fields` parameter to retrieve those specific
1789 | attributes that are not returned by default.
1790 |
1791 |
1792 |
1793 | ```bash
1794 | curl -i -X GET "https://api.box.com/2.0/folders/trash/items" \
1795 | -H "authorization: Bearer "
1796 | ```
1797 |
1798 | ## Get folder watermark
1799 |
1800 | Retrieve the watermark for a folder.
1801 |
1802 |
1803 |
1804 | ```bash
1805 | curl -i -X GET "https://api.box.com/2.0/folders/4353455/watermark" \
1806 | -H "authorization: Bearer "
1807 | ```
1808 |
1809 | ## Apply watermark to folder
1810 |
1811 | Applies or update a watermark on a folder.
1812 |
1813 |
1814 |
1815 | ```bash
1816 | curl -i -X PUT "https://api.box.com/2.0/folders/4353455/watermark" \
1817 | -H "authorization: Bearer " \
1818 | -H "content-type: application/json" \
1819 | -d '{
1820 | "watermark": {
1821 | "imprint": "default"
1822 | }
1823 | }'
1824 | ```
1825 |
1826 | ## Remove folder watermark
1827 |
1828 | Removes the watermark from a folder.
1829 |
1830 |
1831 |
1832 | ```bash
1833 | curl -i -X DELETE "https://api.box.com/2.0/folders/4353455/watermark" \
1834 | -H "authorization: Bearer "
1835 | ```
1836 |
1837 | ## Get folder lock
1838 |
1839 | Retrieve locks applied to a folder.
1840 |
1841 |
1842 |
1843 | ```bash
1844 | curl -i -X GET "https://api.box.com/2.0/folder_locks?folder_id=33552487093" \
1845 | -H "authorization: Bearer "
1846 | ```
1847 |
1848 | ## Create folder lock
1849 |
1850 | Creates a lock on a folder to prevent move and / or delete operations.
1851 |
1852 |
1853 |
1854 | ```bash
1855 | curl -i -X POST "https://api.box.com/2.0/folder_locks" \
1856 | -H "authorization: Bearer " \
1857 | -H "content-type: application/json" \
1858 | -d '{
1859 | "folder": {
1860 | "type": "folder",
1861 | "id": "33552487093"
1862 | },
1863 | "locked_operations": {
1864 | "move": true,
1865 | "delete": true
1866 | }
1867 | }'
1868 | ```
1869 |
1870 | ## Delete folder lock
1871 |
1872 | Deletes a lock on a folder.
1873 |
1874 |
1875 |
1876 | ```bash
1877 | curl -i -X DELETE "https://api.box.com/2.0/folder_locks/93134" \
1878 | -H "authorization: Bearer "
1879 | ```
1880 |
1881 | ## Get template by name
1882 |
1883 | Retrieves a metadata template by its scope and template name.
1884 |
1885 |
1886 |
1887 | ```bash
1888 | curl -i -X GET "https://api.box.com/2.0/metadata_templates/enterprise/blueprintTemplate/schema" \
1889 | -H "authorization: Bearer "
1890 | ```
1891 |
1892 | ## Update metadata template
1893 |
1894 | Updates a metadata template.
1895 |
1896 | The metadata template can only be updated if the template
1897 | already exists.
1898 |
1899 | The update is applied atomically. If any errors occur during the
1900 | application of the operations, the metadata template remains unchanged.
1901 |
1902 |
1903 |
1904 | ```bash
1905 | curl -i -X PUT "https://api.box.com/2.0/metadata_templates/enterprise/blueprintTemplate/schema" \
1906 | -H "authorization: Bearer " \
1907 | -H "content-type: application/json-patch+json" \
1908 | -d '[
1909 | {
1910 | "op": "editField",
1911 | "fieldKey": "category",
1912 | "data": {
1913 | "displayName": "Customer Group"
1914 | }
1915 | }
1916 | ]'
1917 | ```
1918 |
1919 | ## Delete metadata template
1920 |
1921 | Delete a metadata template and its instances.
1922 | This deletion is permanent and can not be reversed.
1923 |
1924 |
1925 |
1926 | ```bash
1927 | curl -i -X DELETE "https://api.box.com/2.0/metadata_templates/enterprise/blueprintTemplate/schema" \
1928 | -H "authorization: Bearer "
1929 | ```
1930 |
1931 | ## Get a template by ID
1932 |
1933 | Retrieves a metadata template by its ID.
1934 |
1935 |
1936 |
1937 | ```bash
1938 | curl -i -X GET "https://api.box.com/2.0/metadata_templates/d9671692-3df6-11ea-b77f-2e728ce88125" \
1939 | -H "authorization: Bearer "
1940 | ```
1941 |
1942 | ## List enterprise templates
1943 |
1944 | Used to retrieve all metadata templates within a user's enterprise
1945 |
1946 |
1947 |
1948 | ```bash
1949 | curl -i -X GET "https://api.box.com/2.0/metadata_templates/enterprise" \
1950 | -H "authorization: Bearer "
1951 | ```
1952 |
1953 | ## List global templates
1954 |
1955 | Used to retrieve all globally available metadata templates.
1956 |
1957 |
1958 |
1959 | ```bash
1960 | curl -i -X GET "https://api.box.com/2.0/metadata_templates/global" \
1961 | -H "authorization: Bearer "
1962 | ```
1963 |
1964 | ## Create metadata template
1965 |
1966 | Creates a new metadata template that can be applied to files and folders.
1967 |
1968 |
1969 |
1970 | ```bash
1971 | curl -i -X POST "https://api.box.com/2.0/metadata_templates/schema" \
1972 | -H "authorization: Bearer " \
1973 | -H "content-type: application/json" \
1974 | -d '{
1975 | "scope": "enterprise",
1976 | "displayName": "Customer",
1977 | "fields": [
1978 | {
1979 | "type": "string",
1980 | "key": "name",
1981 | "displayName": "Name",
1982 | "description": "The customer name",
1983 | "hidden": false
1984 | },
1985 | {
1986 | "type": "date",
1987 | "key": "last_contacted_at",
1988 | "displayName": "Last Contacted At",
1989 | "description": "When this customer was last contacted at",
1990 | "hidden": false
1991 | },
1992 | {
1993 | "type": "enum",
1994 | "key": "industry",
1995 | "displayName": "Industry",
1996 | "options": [
1997 | {"key": "Technology"},
1998 | {"key": "Healthcare"},
1999 | {"key": "Legal"}
2000 | ]
2001 | },
2002 | {
2003 | "type": "multiSelect",
2004 | "key": "role",
2005 | "displayName": "Contact Role",
2006 | "options": [
2007 | {"key": "Developer"},
2008 | {"key": "Business Owner"},
2009 | {"key": "Marketing"},
2010 | {"key": "Legal"},
2011 | {"key": "Sales"}
2012 | ]
2013 | }
2014 | ]
2015 | }'
2016 | ```
2017 |
2018 | ## List cascade policies
2019 |
2020 | Retrieve a collection of metadata cascade policies
2021 | within a given folder for the current enterprise.
2022 |
2023 |
2024 |
2025 | ```bash
2026 | curl -i -X GET "https://api.box.com/2.0/metadata_cascade_policies?folder_id=31232" \
2027 | -H "authorization: Bearer "
2028 | ```
2029 |
2030 | ## Create cascade policy
2031 |
2032 | Creates a new metadata cascade policy that applies a given
2033 | metadata template to a given folder and automatically
2034 | cascades it down to its children.
2035 |
2036 | In order for the policy to work, a metadata instance must first
2037 | be applied to the folder.
2038 |
2039 |
2040 |
2041 | ```bash
2042 | curl -i -X POST "https://api.box.com/2.0/metadata_cascade_policies" \
2043 | -H "authorization: Bearer " \
2044 | -H "content-type: application/json" \
2045 | -d '{
2046 | "folder_id": "12321",
2047 | "scope": "enterprise_27335",
2048 | "templateKey": "productInfo"
2049 | }'
2050 | ```
2051 |
2052 | ## Get cascade policy
2053 |
2054 | Retrieve a metadata cascade policy.
2055 |
2056 |
2057 |
2058 | ```bash
2059 | curl -i -X GET "https://api.box.com/2.0/metadata_cascade_policies/324324" \
2060 | -H "authorization: Bearer "
2061 | ```
2062 |
2063 | ## Delete cascade policy
2064 |
2065 | Deletes a metadata cascade policy.
2066 |
2067 |
2068 |
2069 | ```bash
2070 | curl -i -X DELETE "https://api.box.com/2.0/metadata_cascade_policies/324324" \
2071 | -H "authorization: Bearer "
2072 | ```
2073 |
2074 | ## Force apply cascade policy
2075 |
2076 | If a policy already exists on a folder, this will apply that policy
2077 | to all existing files and sub-folders within the target folder.
2078 |
2079 |
2080 |
2081 | ```bash
2082 | curl -i -X POST "https://api.box.com/2.0/metadata_cascade_policies/21312/apply" \
2083 | -H "authorization: Bearer " \
2084 | -H "content-type: application/json" \
2085 | -d '{
2086 | "conflict_resolution": "overwrite"
2087 | }'
2088 | ```
2089 |
2090 | ## Create a metadata query
2091 |
2092 |
2093 |
2094 | ```bash
2095 | curl -i -X POST "https://api.box.com/2.0/files/12345" \
2096 | -H "authorization: Bearer " \
2097 | -H "content-type: application/json" \
2098 | -d '{
2099 | "from": "enterprise_123456.contractTemplate",
2100 | "query": "amount >= :value",
2101 | "query_params": {
2102 | "value": 100
2103 | },
2104 | "fields": [
2105 | "created_at",
2106 | "metadata.enterprise_123456.contractTemplate.amount",
2107 | "metadata.enterprise_123456.contractTemplate.customerName"
2108 | ],
2109 | "ancestor_folder_id": "5555",
2110 | "order_by": [
2111 | {
2112 | "field_key": "amount",
2113 | "direction": "asc"
2114 | }
2115 | ],
2116 | "limit": 100
2117 | }'
2118 | ```
2119 |
2120 | ## Get metadata query indices
2121 |
2122 |
2123 |
2124 | ```bash
2125 | curl -i -X GET "https://api.box.com/2.0/metadata_query_indices?scope=enterprise&template_key=properties" \
2126 | -H "authorization: Bearer "
2127 | ```
2128 |
2129 | ## Get comment
2130 |
2131 | Retrieves the message and metadata for a specific comment, as well
2132 | as information on the user who created the comment.
2133 |
2134 |
2135 |
2136 | ```bash
2137 | curl -i -X GET "https://api.box.com/2.0/comments/12345" \
2138 | -H "authorization: Bearer "
2139 | ```
2140 |
2141 | ## Update comment
2142 |
2143 | Update the message of a comment.
2144 |
2145 |
2146 |
2147 | ```bash
2148 | curl -i -X PUT "https://api.box.com/2.0/comments/12345" \
2149 | -H "authorization: Bearer " \
2150 | -H "content-type: application/json" \
2151 | -d '{
2152 | "message": "My New Message"
2153 | }'
2154 | ```
2155 |
2156 | ## Delete comment
2157 |
2158 | Permanently deletes a comment.
2159 |
2160 |
2161 |
2162 | ```bash
2163 | curl -i -X DELETE "https://api.box.com/2.0/comments/12345" \
2164 | -H "authorization: Bearer "
2165 | ```
2166 |
2167 | ## Create comment
2168 |
2169 | Adds a comment comment by the user to a specific file, or
2170 | as a reply to an other comment.
2171 |
2172 |
2173 |
2174 | ```bash
2175 | curl -i -X POST "https://api.box.com/2.0/comments" \
2176 | -H "authorization: Bearer " \
2177 | -H "content-type: application/json" \
2178 | -d '{
2179 | "message": "Review completed!",
2180 | "item": {
2181 | "type": "file",
2182 | "id": 426436
2183 | }
2184 | }'
2185 | ```
2186 |
2187 | ## Create reply
2188 |
2189 |
2190 |
2191 | ```bash
2192 | curl -i -X POST "https://api.box.com/2.0/comments" \
2193 | -H "authorization: Bearer " \
2194 | -H "content-type: application/json" \
2195 | -d '{
2196 | "message": "I agree with this.",
2197 | "item": {
2198 | "type": "comment",
2199 | "id": 345344
2200 | }
2201 | }
2202 | ```
2203 |
2204 | ## Tag User in Comment
2205 |
2206 |
2207 |
2208 | ```bash
2209 | curl -i -X POST "https://api.box.com/2.0/comments" \
2210 | -H "authorization: Bearer " \
2211 | -H "content-type: application/json" \
2212 | -d '{
2213 | "tagged_message": "What do you think @[1234:John]?",
2214 | "item": {
2215 | "type": "file",
2216 | "id": 123
2217 | }
2218 | }
2219 | ```
2220 |
2221 | ## Tag User in Reply
2222 |
2223 |
2224 |
2225 | ```bash
2226 | curl -i -X POST "https://api.box.com/2.0/comments" \
2227 | -H "authorization: Bearer " \
2228 | -H "content-type: application/json" \
2229 | -d '{
2230 | "message": " @[1234:John], I agree with this.",
2231 | "item": {
2232 | "type": "comment",
2233 | "id": 345344
2234 | }
2235 | }
2236 | ```
2237 |
2238 | ## Get collaboration
2239 |
2240 | Retrieves a single collaboration.
2241 |
2242 |
2243 |
2244 | ```bash
2245 | curl -i -X GET "https://api.box.com/2.0/collaborations/1234" \
2246 | -H "authorization: Bearer "
2247 | ```
2248 |
2249 | ## Update collaboration
2250 |
2251 | Updates a collaboration.
2252 |
2253 | Can be used to change the owner of an item, or to
2254 | accept collaboration invites.
2255 |
2256 |
2257 |
2258 | ```bash
2259 | curl -i -X PUT "https://api.box.com/2.0/collaborations/1234" \
2260 | -H "authorization: Bearer " \
2261 | -H "content-type: application/json" \
2262 | -d '{
2263 | "role": "viewer"
2264 | }'
2265 | ```
2266 |
2267 | ## Delete collaboration
2268 |
2269 | Deletes a single collaboration.
2270 |
2271 |
2272 |
2273 | ```bash
2274 | curl -i -X DELETE "https://api.box.com/2.0/collaborations/1234" \
2275 | -H "authorization: Bearer "
2276 | ```
2277 |
2278 | ## List pending collaborations
2279 |
2280 | Retrieves all pending collaboration invites for this user.
2281 |
2282 |
2283 |
2284 | ```bash
2285 | curl -i -X GET "https://api.box.com/2.0/collaborations?status=pending" \
2286 | -H "authorization: Bearer "
2287 | ```
2288 |
2289 | ## Create collaboration
2290 |
2291 | Adds a collaboration for a single user or a single group to a file
2292 | or folder.
2293 |
2294 | Collaborations can be created using email address, user IDs, or a
2295 | group IDs.
2296 |
2297 | If a collaboration is being created with a group, access to
2298 | this endpoint is dependent on the group's ability to be invited.
2299 |
2300 |
2301 |
2302 | ```bash
2303 | curl -i -X POST "https://api.box.com/2.0/collaborations" \
2304 | -H "authorization: Bearer " \
2305 | -H "content-type: application/json" \
2306 | -d '{
2307 | "item": {
2308 | "type": "file",
2309 | "id": "11446498"
2310 | },
2311 | "accessible_by": {
2312 | "type": "user",
2313 | "login": "user@example.com"
2314 | },
2315 | "role": "editor"
2316 | }'
2317 | ```
2318 |
2319 |
2320 |
2321 | ```bash
2322 | curl -i -X POST "https://api.box.com/2.0/collaborations" \
2323 | -H "authorization: Bearer " \
2324 | -H "content-type: application/json" \
2325 | -d '{
2326 | "item": {
2327 | "type": "file",
2328 | "id": "11446498"
2329 | },
2330 | "accessible_by": {
2331 | "type": "group",
2332 | "id": "845344"
2333 | },
2334 | "role": "editor"
2335 | }'
2336 | ```
2337 |
2338 | ## Search for content
2339 |
2340 | Searches for items that are available to the user or an entire enterprise.
2341 |
2342 |
2343 |
2344 | ```bash
2345 | curl -i -X GET "https://api.box.com/2.0/search?query=sales" \
2346 | -H "authorization: Bearer "
2347 | ```
2348 |
2349 | ## Create task
2350 |
2351 | Creates a single task on a file.
2352 |
2353 |
2354 |
2355 | ```bash
2356 | curl -i -X POST "https://api.box.com/2.0/tasks" \
2357 | -H "authorization: Bearer " \
2358 | -H "content-type: application/json" \
2359 | -d '{
2360 | "item": {
2361 | "id": "11446498",
2362 | "type": "file"
2363 | },
2364 | "action": "review"
2365 | }'
2366 | ```
2367 |
2368 | ## Get task
2369 |
2370 | Fetches a specific task.
2371 |
2372 |
2373 |
2374 | ```bash
2375 | curl -i -X GET "https://api.box.com/2.0/tasks/12345" \
2376 | -H "authorization: Bearer "
2377 | ```
2378 |
2379 | ## Update task
2380 |
2381 | Updates a specific task.
2382 |
2383 |
2384 |
2385 | ```bash
2386 | curl -i -X PUT "https://api.box.com/2.0/tasks/12345" \
2387 | -H "authorization: Bearer " \
2388 | -H "content-type: application/json" \
2389 | -d '{
2390 | "action": "review"
2391 | }'
2392 | ```
2393 |
2394 | ## Delete task
2395 |
2396 | Deletes a specific task.
2397 |
2398 |
2399 |
2400 | ```bash
2401 | curl -i -X DELETE "https://api.box.com/2.0/tasks/12345" \
2402 | -H "authorization: Bearer "
2403 | ```
2404 |
2405 | ## List task's assignments
2406 |
2407 | Retrieves all of the assignments for a given task.
2408 |
2409 |
2410 |
2411 | ```bash
2412 | curl -i -X GET "https://api.box.com/2.0/tasks/12345/assignments" \
2413 | -H "authorization: Bearer "
2414 | ```
2415 |
2416 | ## Assign task
2417 |
2418 | Assigns a task to a user.
2419 |
2420 | Multiple assignments to different users
2421 | are allowed per task.
2422 |
2423 |
2424 |
2425 | ```bash
2426 | curl -i -X POST "https://api.box.com/2.0/task_assignments" \
2427 | -H "authorization: Bearer " \
2428 | -H "content-type: application/json" \
2429 | -d '{
2430 | "task": {
2431 | "id": "11446498",
2432 | "type": "task"
2433 | },
2434 | "assign_to": {
2435 | "id": "4823213"
2436 | }
2437 | }'
2438 | ```
2439 |
2440 | ## Get task assignment
2441 |
2442 | Fetches a specific task assignment.
2443 |
2444 |
2445 |
2446 | ```bash
2447 | curl -i -X GET "https://api.box.com/2.0/task_assignments/12345" \
2448 | -H "authorization: Bearer "
2449 | ```
2450 |
2451 | ## Update task assignment
2452 |
2453 | Updates a task assignment. This endpoint can be
2454 | used to update the state of a task.
2455 |
2456 |
2457 |
2458 | ```bash
2459 | curl -i -X PUT "https://api.box.com/2.0/task_assignments/12345" \
2460 | -H "authorization: Bearer " \
2461 | -H "content-type: application/json" \
2462 | -d '{
2463 | "message": "New message",
2464 | "resolution_state": "completed"
2465 | }'
2466 | ```
2467 |
2468 | ## Unassign task
2469 |
2470 | Deletes a specific task assignment.
2471 |
2472 |
2473 |
2474 | ```bash
2475 | curl -i -X DELETE "https://api.box.com/2.0/task_assignments/12345" \
2476 | -H "authorization: Bearer "
2477 | ```
2478 |
2479 | ## Find item for shared link
2480 |
2481 | Return the file or folder represented by a shared link.
2482 |
2483 | Shared items are any files or folders that are represented by a shared link,
2484 | which can originate within the current enterprise or within another one.
2485 |
2486 | This endpoint allows an application to retrieve information about a
2487 | shared item when only given a shared link.
2488 |
2489 |
2490 |
2491 | ```bash
2492 | curl -i -X GET "https://api.box.com/2.0/shared_items" \
2493 | -H "authorization: Bearer " \
2494 | -H "boxapi: shared_link=https://app.box.com/s/gjasdasjhasd&shared_link_password=letmein"
2495 | ```
2496 |
2497 | The syntax is the same regardless of wether the shared link is a file or a folder.
2498 |
2499 |
2500 |
2501 | ```bash
2502 | curl -i -X GET "https://api.box.com/2.0/shared_items" \
2503 | -H "authorization: Bearer " \
2504 | -H "boxapi: shared_link=https://app.box.com/s/jsasdsd8sad24&shared_link_password=letmein"
2505 | ```
2506 |
2507 | ## Create web link
2508 |
2509 | Creates a web link object within a folder.
2510 |
2511 |
2512 |
2513 | ```bash
2514 | curl -i -X POST "https://api.box.com/2.0/web_links" \
2515 | -H "authorization: Bearer " \
2516 | -H "content-type: application/json" \
2517 | -d '{
2518 | "name": "Cloud Content Management",
2519 | "url": "https://box.com",
2520 | "parent": {
2521 | "id": "0"
2522 | }
2523 | }'
2524 | ```
2525 |
2526 | ## Get web link
2527 |
2528 | Retrieve information about a web link.
2529 |
2530 |
2531 |
2532 | ```bash
2533 | curl -i -X GET "https://api.box.com/2.0/web_links/12345" \
2534 | -H "authorization: Bearer "
2535 | ```
2536 |
2537 | ## Restore web link
2538 |
2539 | Restores an web link that has been moved to the trash.
2540 |
2541 |
2542 |
2543 | ```bash
2544 | curl -i -X POST "https://api.box.com/2.0/web_links/12345" \
2545 | -H "authorization: Bearer "
2546 | ```
2547 |
2548 | ## Update web link
2549 |
2550 | Updates a web link object.
2551 |
2552 |
2553 |
2554 | ```bash
2555 | curl -i -X PUT "https://api.box.com/2.0/web_links/12345" \
2556 | -H "authorization: Bearer " \
2557 | -H "content-type: application/json" \
2558 | -d '{
2559 | "name": "Cloud Content Management"
2560 | }'
2561 | ```
2562 |
2563 | ## Delete web link
2564 |
2565 | Deletes a web link.
2566 |
2567 |
2568 |
2569 | ```bash
2570 | curl -i -X DELETE "https://api.box.com/2.0/web_links/12345" \
2571 | -H "authorization: Bearer "
2572 | ```
2573 |
2574 | ## Get trashed web link
2575 |
2576 | Retrieves a web link that has been moved to the trash.
2577 |
2578 |
2579 |
2580 | ```bash
2581 | curl -i -X GET "https://api.box.com/2.0/web_links/12345/trash" \
2582 | -H "authorization: Bearer "
2583 | ```
2584 |
2585 | ## Permanently delete web link
2586 |
2587 | Permanently deletes a web link that is in the trash.
2588 | This action cannot be undone.
2589 |
2590 |
2591 |
2592 | ```bash
2593 | curl -i -X DELETE "https://api.box.com/2.0/web_links/12345/trash" \
2594 | -H "authorization: Bearer "
2595 | ```
2596 |
2597 | ## List enterprise users
2598 |
2599 | Returns a list of all users for the Enterprise along with their user_id,
2600 | public_name, and login.
2601 |
2602 | The application and the authenticated user need to
2603 | have the permission to look up users in the entire
2604 | enterprise.
2605 |
2606 |
2607 |
2608 | ```bash
2609 | curl -i -X GET "https://api.box.com/2.0/users" \
2610 | -H "authorization: Bearer "
2611 | ```
2612 |
2613 | ## Create user
2614 |
2615 | Creates a new managed user in an enterprise. This endpoint
2616 | is only available to users and applications with the right
2617 | admin permissions.
2618 |
2619 |
2620 |
2621 | ```bash
2622 | curl -i -X POST "https://api.box.com/2.0/users" \
2623 | -H "authorization: Bearer " \
2624 | -H "content-type: application/json" \
2625 | -d '{
2626 | "login": "ceo@example.com",
2627 | "name": "Aaron Levie"
2628 | }'
2629 | ```
2630 |
2631 | ## Get authenticated user
2632 |
2633 | Retrieves information about the user who is currently authenticated.
2634 |
2635 | In the case of a 3-legged OAuth2, client-side authenticated application
2636 | this will be the user who authorized the app.
2637 |
2638 | In the case of a JWT, server-side authenticated application
2639 | this will be the service account that belongs to the application
2640 | by default.
2641 |
2642 | Use the `As-User` header to change who this API call is made on behalf of.
2643 |
2644 |
2645 |
2646 | ```bash
2647 | curl -i -X GET "https://api.box.com/2.0/users/me" \
2648 | -H "authorization: Bearer "
2649 | ```
2650 |
2651 | ## Get user
2652 |
2653 | Retrieves information about a user in the enterprise.
2654 |
2655 | The application and the authenticated user need to
2656 | have the permission to look up users in the entire
2657 | enterprise.
2658 |
2659 | This endpoint also returns a limited set of information
2660 | for external users who are collaborated on content
2661 | owned by the enterprise for authenticated users with the
2662 | right scopes. In this case, disallowed fields will return
2663 | null instead.
2664 |
2665 |
2666 |
2667 | ```bash
2668 | curl -i -X GET "https://api.box.com/2.0/users/12345" \
2669 | -H "authorization: Bearer "
2670 | ```
2671 |
2672 | ## Update user
2673 |
2674 | Updates a managed user in an enterprise. This endpoint
2675 | is only available to users and applications with the right
2676 | admin permissions.
2677 |
2678 |
2679 |
2680 | ```bash
2681 | curl -i -X PUT "https://api.box.com/2.0/users/12345" \
2682 | -H "authorization: Bearer " \
2683 | -H "content-type: application/json" \
2684 | -d '{
2685 | "name": "Aaron Levie"
2686 | }'
2687 | ```
2688 |
2689 | ## Delete user
2690 |
2691 | Deletes a user. By default this will fail if the user
2692 | still owns any content. Move their owned content first
2693 | before proceeding, or use the `force` field to delete
2694 | the user and their files.
2695 |
2696 |
2697 |
2698 | ```bash
2699 | curl -i -X DELETE "https://api.box.com/2.0/users/12345" \
2700 | -H "authorization: Bearer "
2701 | ```
2702 |
2703 | ## Get user avatar
2704 |
2705 | Retrieves an image of a the user's avatar.
2706 |
2707 |
2708 |
2709 | ```bash
2710 | curl -i -X GET "https://api.box.com/2.0/users/12345/avatar" \
2711 | -H "authorization: Bearer "
2712 | ```
2713 |
2714 | ## Add or update user avatar
2715 |
2716 | Uploads or updates a user avatar.
2717 |
2718 |
2719 |
2720 | ```bash
2721 | curl -i -X -L POST "https://api.box.net/2.0/users/12345/avatar" \
2722 | -H "authorization: Bearer " \
2723 | --form 'pic=@"path/to/file/file.jpeg"'
2724 | ```
2725 |
2726 | ## Delete user avatar
2727 |
2728 | Deletes a user avatar.
2729 |
2730 |
2731 |
2732 | ```bash
2733 | curl -i -X DELETE -L "https://api.box.net/2.0/users/12345/avatar" \
2734 | -H "authorization: Bearer "
2735 | ```
2736 |
2737 | ## Transfer owned folders
2738 |
2739 | Move all of the items owned by a user into a
2740 | new folder in another user’s account.
2741 |
2742 | Only the root folder (`0`) can be transferred.
2743 |
2744 | Folders can only be moved across users by users with administrative
2745 | permissions.
2746 |
2747 | This call will be performed synchronously which might lead to a slow response
2748 | when the source user has a large number of items in all of its folders.
2749 |
2750 | If the destination path has a metadata cascade policy attached to any of
2751 | the parent folders, a metadata cascade operation will be kicked off
2752 | asynchronously.
2753 |
2754 | There is currently no way to check for when this operation is finished.
2755 |
2756 |
2757 |
2758 | ```bash
2759 | curl -i -X PUT "https://api.box.com/2.0/users/12345/folders/0" \
2760 | -H "authorization: Bearer " \
2761 | -H "content-type: application/json" \
2762 | -d '{
2763 | "owned_by": {
2764 | "id": "1232234"
2765 | }
2766 | }'
2767 | ```
2768 |
2769 | ## List user's email aliases
2770 |
2771 | Retrieves all email aliases for a user. The collection
2772 | does not include the primary login for the user.
2773 |
2774 |
2775 |
2776 | ```bash
2777 | curl -i -X GET "https://api.box.com/2.0/users/12345/email_aliases" \
2778 | -H "authorization: Bearer "
2779 | ```
2780 |
2781 | ## Create email alias
2782 |
2783 | Adds a new email alias to a user account.
2784 |
2785 |
2786 |
2787 | ```bash
2788 | curl -i -X POST "https://api.box.com/2.0/users/12345/email_aliases" \
2789 | -H "authorization: Bearer " \
2790 | -H "content-type: application/json" \
2791 | -d '{
2792 | "email": "alias@example.com"
2793 | }'
2794 | ```
2795 |
2796 | ## Remove email alias
2797 |
2798 | Removes an email alias from a user.
2799 |
2800 |
2801 |
2802 | ```bash
2803 | curl -i -X DELETE "https://api.box.com/2.0/users/12345/email_aliases/23432" \
2804 | -H "authorization: Bearer "
2805 | ```
2806 |
2807 | ## List user's groups
2808 |
2809 | Retrieves all the groups for a user. The user making
2810 | an API call must have admin permissions to inspect the
2811 | enterprise's groups.
2812 |
2813 |
2814 |
2815 | ```bash
2816 | curl -i -X GET "https://api.box.com/2.0/users/12345/memberships" \
2817 | -H "authorization: Bearer "
2818 | ```
2819 |
2820 | ## Invite user
2821 |
2822 | Invites an existing external user to join an enterprise.
2823 |
2824 | The existing user can not be part of another enterprise and
2825 | must already have a Box account. Once invited, the user will receive an
2826 | email and are prompted to accept the invitation within the
2827 | Box web application.
2828 |
2829 | This method requires the "Manage An Enterprise" scope enabled for
2830 | the application, which can be enabled within the developer console.
2831 |
2832 |
2833 |
2834 | ```bash
2835 | curl -i -X POST "https://api.box.com/2.0/invites" \
2836 | -H "authorization: Bearer " \
2837 | -H "content-type: application/json" \
2838 | -d '{
2839 | "enterprise": {
2840 | "id": "1232234"
2841 | },
2842 | "actionable_by": {
2843 | "login" : "freeuser@box.com"
2844 | }
2845 | }'
2846 | ```
2847 |
2848 | ## Get user invite status
2849 |
2850 | Returns the status of a user invite.
2851 |
2852 |
2853 |
2854 | ```bash
2855 | curl -i -X GET "https://api.box.com/2.0/invites/213723" \
2856 | -H "authorization: Bearer "
2857 | ```
2858 |
2859 | ## List enterprise groups
2860 |
2861 | Retrieves all of the groups for a given enterprise. The user
2862 | must have admin permissions to inspect enterprise's groups.
2863 |
2864 |
2865 |
2866 | ```bash
2867 | curl -i -X GET "https://api.box.com/2.0/groups" \
2868 | -H "authorization: Bearer "
2869 | ```
2870 |
2871 | ## Create group
2872 |
2873 | Creates a new group of users in an enterprise. Only users with admin
2874 | permissions can create new groups.
2875 |
2876 |
2877 |
2878 | ```bash
2879 | curl -i -X POST "https://api.box.com/2.0/groups" \
2880 | -H "authorization: Bearer " \
2881 | -H "content-type: application/json" \
2882 | -d '{
2883 | "name": "Customer Support"
2884 | }'
2885 | ```
2886 |
2887 | ## Get group
2888 |
2889 | Retrieves information about a group.
2890 |
2891 |
2892 |
2893 | ```bash
2894 | curl -i -X GET "https://api.box.com/2.0/groups/57645" \
2895 | -H "authorization: Bearer "
2896 | ```
2897 |
2898 | ## Update group
2899 |
2900 | Updates a specific group.
2901 |
2902 |
2903 |
2904 | ```bash
2905 | curl -i -X PUT "https://api.box.com/2.0/groups/57645" \
2906 | -H "authorization: Bearer " \
2907 | -H "content-type: application/json" \
2908 | -d '{
2909 | "name": "Customer Support"
2910 | }'
2911 | ```
2912 |
2913 | ## Delete group
2914 |
2915 | Permanently deletes a group.
2916 |
2917 |
2918 |
2919 | ```bash
2920 | curl -i -X DELETE "https://api.box.com/2.0/groups/57645" \
2921 | -H "authorization: Bearer "
2922 | ```
2923 |
2924 | ## List group's members
2925 |
2926 | Retrieves all the members for a group. The user
2927 | must have admin permissions to inspect enterprise's groups.
2928 |
2929 |
2930 |
2931 | ```bash
2932 | curl -i -X GET "https://api.box.com/2.0/groups/57645/memberships" \
2933 | -H "authorization: Bearer "
2934 | ```
2935 |
2936 | ## List group's collaborations
2937 |
2938 | Retrieves all the collaborations for a group. The user
2939 | must have admin permissions to inspect enterprise's groups.
2940 |
2941 | Each collaboration object has details on which files or
2942 | folders the group has access to and with what role.
2943 |
2944 |
2945 |
2946 | ```bash
2947 | curl -i -X GET "https://api.box.com/2.0/groups/57645/collaborations" \
2948 | -H "authorization: Bearer "
2949 | ```
2950 |
2951 | ## Add user to group
2952 |
2953 | Creates a group membership
2954 |
2955 |
2956 |
2957 | ```bash
2958 | curl -i -X POST "https://api.box.com/2.0/group_memberships" \
2959 | -H "authorization: Bearer " \
2960 | -H "content-type: application/json" \
2961 | -d '{
2962 | "user": {
2963 | "id": "1434325"
2964 | },
2965 | "group": {
2966 | "id": "4545523"
2967 | }
2968 | }'
2969 | ```
2970 |
2971 | ## Get group membership
2972 |
2973 | Retrieves a specific group membership.
2974 |
2975 |
2976 |
2977 | ```bash
2978 | curl -i -X GET "https://api.box.com/2.0/group_memberships/434534" \
2979 | -H "authorization: Bearer "
2980 | ```
2981 |
2982 | ## Update user's membership
2983 |
2984 | Updates a user's group membership.
2985 |
2986 |
2987 |
2988 | ```bash
2989 | curl -i -X PUT "https://api.box.com/2.0/group_memberships/434534" \
2990 | -H "authorization: Bearer " \
2991 | -H "content-type: application/json" \
2992 | -d '{
2993 | "role": "admin"
2994 | }'
2995 | ```
2996 |
2997 | ## Remove user from group
2998 |
2999 | Deletes a specific group membership.
3000 |
3001 |
3002 |
3003 | ```bash
3004 | curl -i -X DELETE "https://api.box.com/2.0/group_memberships/434534" \
3005 | -H "authorization: Bearer "
3006 | ```
3007 |
3008 | ## List all webhooks
3009 |
3010 | Returns all defined webhooks for the requesting application.
3011 |
3012 |
3013 |
3014 | ```bash
3015 | curl -i -X GET "https://api.box.com/2.0/webhooks" \
3016 | -H "authorization: Bearer "
3017 | ```
3018 |
3019 | ## Create webhook
3020 |
3021 | Creates a webhook.
3022 |
3023 |
3024 |
3025 | ```bash
3026 | curl -i -X POST "https://api.box.com/2.0/webhooks" \
3027 | -H "authorization: Bearer " \
3028 | -H "content-type: application/json" \
3029 | -d '{
3030 | "target": {
3031 | "id": "21322",
3032 | "type": "file"
3033 | },
3034 | "address": "https://example.com/webhooks",
3035 | "triggers": [
3036 | "FILE.PREVIEWED"
3037 | ]
3038 | }'
3039 | ```
3040 |
3041 |
3042 |
3043 | ```bash
3044 | curl -i -X POST "https://api.box.com/2.0/webhooks" \
3045 | -H "authorization: Bearer " \
3046 | -H "content-type: application/json" \
3047 | -d '{
3048 | "target": {
3049 | "id": "234234",
3050 | "type": "folder"
3051 | },
3052 | "address": "https://example.com/webhooks",
3053 | "triggers": [
3054 | "FILE.UPLOADED"
3055 | ]
3056 | }'
3057 | ```
3058 |
3059 | ## Get webhook
3060 |
3061 | Retrieves a specific webhook
3062 |
3063 |
3064 |
3065 | ```bash
3066 | curl -i -X GET "https://api.box.com/2.0/webhooks/3321123" \
3067 | -H "authorization: Bearer "
3068 | ```
3069 |
3070 | ## Update webhook
3071 |
3072 | Updates a webhook.
3073 |
3074 |
3075 |
3076 | ```bash
3077 | curl -i -X PUT "https://api.box.com/2.0/webhooks/3321123" \
3078 | -H "authorization: Bearer " \
3079 | -H "content-type: application/json" \
3080 | -d '{
3081 | "triggers": [
3082 | "FILE.DOWNLOADED"
3083 | ]
3084 | }'
3085 | ```
3086 |
3087 | ## Delete webhook
3088 |
3089 | Deletes a webhook.
3090 |
3091 |
3092 |
3093 | ```bash
3094 | curl -i -X DELETE "https://api.box.com/2.0/webhooks/3321123" \
3095 | -H "authorization: Bearer "
3096 | ```
3097 |
3098 | ## Update skill invocation
3099 |
3100 | Updates the status, usage and response metadata of a
3101 | skill invocation.
3102 |
3103 |
3104 |
3105 | ```bash
3106 | curl -i -X PUT "https://api.box.com/2.0/skill_invocations/33243242" \
3107 | -H "authorization: Bearer " \
3108 | -H "content-type: application/json" \
3109 | -d '{
3110 | "status": "success",
3111 | "metadata": {
3112 | "cards": [{
3113 | "type": "skill_card",
3114 | "skill_card_type": "keyword",
3115 | "skill_card_title": {
3116 | "code": "license-plates",
3117 | "message": "Licence Plates"
3118 | },
3119 | "skill": {
3120 | "type": "service"
3121 | "id": "license-plates-service"
3122 | },
3123 | "invocation": {
3124 | "type": "skill_invocation"
3125 | "id": "license-plates-service-123"
3126 | },
3127 | "entries": {
3128 | { "text": "DD-26-YT" },
3129 | { "text": "DN86 BOX" }
3130 | }
3131 | },{
3132 | "type": "skill_card",
3133 | "skill_card_type": "transcript",
3134 | "skill_card_title": {
3135 | "code": "video-transcription",
3136 | "message": "Video Transcription"
3137 | },
3138 | "skill": {
3139 | "type": "service"
3140 | "id": "video-transcription-service"
3141 | },
3142 | "invocation": {
3143 | "type": "skill_invocation"
3144 | "id": "video-transcription-service-123"
3145 | },
3146 | "duration": 1000,
3147 | "entries": {
3148 | {
3149 | "text": "Hi John, have I told you about Box recently?",
3150 | "appears": [{ "start": 0 }]
3151 | },
3152 | {
3153 | "text": "No Aaron, you have not. Tell me more!",
3154 | "appears": [{ "start": 5 }]
3155 | }
3156 | }
3157 | },{
3158 | "type": "skill_card",
3159 | "skill_card_type": "timeline",
3160 | "skill_card_title": {
3161 | "code": "face-detection",
3162 | "message": "Faces"
3163 | },
3164 | "skill": {
3165 | "type": "service"
3166 | "id": "face-detection-service"
3167 | },
3168 | "invocation": {
3169 | "type": "skill_invocation"
3170 | "id": "face-detection-service-123"
3171 | },
3172 | "duration": 1000,
3173 | "entries": {
3174 | {
3175 | "text": "John",
3176 | "appears": [{ "start": 0, "end": 5 }, { "start": 10, "end": 15 }],
3177 | "image_url": "https://example.com/john.png"
3178 | },
3179 | {
3180 | "text": "Aaron",
3181 | "appears": [{ "start": 5, "end": 10 }],
3182 | "image_url": "https://example.com/aaron.png"
3183 | }
3184 | }
3185 | },{
3186 | "type": "skill_card",
3187 | "skill_card_type": "status",
3188 | "skill_card_title": {
3189 | "code": "hold",
3190 | "message": "Please hold..."
3191 | },
3192 | "skill": {
3193 | "type": "service"
3194 | "id": "face-detection-service"
3195 | },
3196 | "invocation": {
3197 | "type": "skill_invocation"
3198 | "id": "face-detection-service-123"
3199 | },
3200 | "status": {
3201 | "code": "processing",
3202 | "message": "We are processing this file right now."
3203 | }
3204 | }],
3205 | },
3206 | "file": {
3207 | "id": "12345"
3208 | },
3209 | "usage": {
3210 | "unit": "file",
3211 | "value": 1
3212 | }
3213 | }'
3214 | ```
3215 |
3216 | ## List Skill cards on file
3217 |
3218 |
3219 |
3220 | ```bash
3221 | curl -i -X PUT "https://api.box.com/2.0/files/12345/metadata/global/boxSkillsCards" \
3222 | -H "authorization: Bearer "
3223 | ```
3224 |
3225 | ## Create Skill cards on file
3226 |
3227 |
3228 |
3229 | ```bash
3230 | curl -i -X POST "https://api.box.com/2.0/files/12345/metadata/global/boxSkillsCards" \
3231 | -H "authorization: Bearer " \
3232 | -H "content-type: application/json" \
3233 | -d '{
3234 | "cards": [{
3235 | "type": "skill_card",
3236 | "skill_card_type": "keyword",
3237 | "skill_card_title": {
3238 | "code": "license-plates",
3239 | "message": "Licence Plates"
3240 | },
3241 | "skill": {
3242 | "type": "service"
3243 | "id": "license-plates-service"
3244 | },
3245 | "invocation": {
3246 | "type": "skill_invocation"
3247 | "id": "license-plates-service-123"
3248 | },
3249 | "entries": {
3250 | { "text": "DD-26-YT" },
3251 | { "text": "DN86 BOX" }
3252 | }
3253 | },{
3254 | "type": "skill_card",
3255 | "skill_card_type": "transcript",
3256 | "skill_card_title": {
3257 | "code": "video-transcription",
3258 | "message": "Video Transcription"
3259 | },
3260 | "skill": {
3261 | "type": "service"
3262 | "id": "video-transcription-service"
3263 | },
3264 | "invocation": {
3265 | "type": "skill_invocation"
3266 | "id": "video-transcription-service-123"
3267 | },
3268 | "duration": 1000,
3269 | "entries": {
3270 | {
3271 | "text": "Hi John, have I told you about Box recently?",
3272 | "appears": [{ "start": 0 }]
3273 | },
3274 | {
3275 | "text": "No Aaron, you have not. Tell me more!",
3276 | "appears": [{ "start": 5 }]
3277 | }
3278 | }
3279 | },{
3280 | "type": "skill_card",
3281 | "skill_card_type": "timeline",
3282 | "skill_card_title": {
3283 | "code": "face-detection",
3284 | "message": "Faces"
3285 | },
3286 | "skill": {
3287 | "type": "service"
3288 | "id": "face-detection-service"
3289 | },
3290 | "invocation": {
3291 | "type": "skill_invocation"
3292 | "id": "face-detection-service-123"
3293 | },
3294 | "duration": 1000,
3295 | "entries": {
3296 | {
3297 | "text": "John",
3298 | "appears": [{ "start": 0, "end": 5 }, { "start": 10, "end": 15 }],
3299 | "image_url": "https://example.com/john.png"
3300 | },
3301 | {
3302 | "text": "Aaron",
3303 | "appears": [{ "start": 5, "end": 10 }],
3304 | "image_url": "https://example.com/aaron.png"
3305 | }
3306 | }
3307 | },{
3308 | "type": "skill_card",
3309 | "skill_card_type": "status",
3310 | "skill_card_title": {
3311 | "code": "hold",
3312 | "message": "Please hold..."
3313 | },
3314 | "skill": {
3315 | "type": "service"
3316 | "id": "face-detection-service"
3317 | },
3318 | "invocation": {
3319 | "type": "skill_invocation"
3320 | "id": "face-detection-service-123"
3321 | },
3322 | "status": {
3323 | "code": "processing",
3324 | "message": "We are processing this file right now."
3325 | }
3326 | }],
3327 | }'
3328 | ```
3329 |
3330 | ## Update Skill cards on file
3331 |
3332 |
3333 |
3334 | ```bash
3335 | curl -i -X PUT "https://api.box.com/2.0/files/12345/metadata/global/boxSkillsCards" \
3336 | -H "authorization: Bearer " \
3337 | -H "content-type: application/json-patch+json" \
3338 | -d '[
3339 | "op": "replace",
3340 | "path": "/cards/0",
3341 | "value": {
3342 | "type": "skill_card",
3343 | "skill_card_type": "keyword",
3344 | "skill_card_title": {
3345 | "code": "license-plates",
3346 | "message": "Licence Plates"
3347 | },
3348 | "skill": {
3349 | "type": "service"
3350 | "id": "license-plates-service"
3351 | },
3352 | "invocation": {
3353 | "type": "skill_invocation"
3354 | "id": "license-plates-service-123"
3355 | },
3356 | "entries": {
3357 | { "text": "DD-26-YT" },
3358 | { "text": "DN86 BOX" }
3359 | }
3360 | }
3361 | ]'
3362 | ```
3363 |
3364 | ## Delete Skill cards from file
3365 |
3366 |
3367 |
3368 | ```bash
3369 | curl -i -X DELETE "https://api.box.com/2.0/files/12345/metadata/global/boxSkillsCards" \
3370 | -H "authorization: Bearer "
3371 | ```
3372 |
3373 | ## Get a long poll endpoint
3374 |
3375 | Returns a list of real-time servers that can be used for long-polling updates
3376 | to the [event stream](#get-events).
3377 |
3378 | Long polling is the concept where a HTTP request is kept open until the
3379 | server sends a response, then repeating the process over and over to receive
3380 | updated responses.
3381 |
3382 | Long polling the event stream can only be used for user events, not for
3383 | enterprise events.
3384 |
3385 | To use long polling, first use this endpoint to retrieve a list of long poll
3386 | URLs. Next, make a long poll request to any of the provided URLs.
3387 |
3388 | When an event occurs in monitored account a response with the value
3389 | `new_change` will be sent. The response contains no other details as
3390 | it simply serves as a prompt to take further action such as sending a
3391 | request to the [events endpoint](#get-events) with the last known
3392 | `stream_position`.
3393 |
3394 | After the server sends this response it closes the connection. You must now
3395 | repeat the long poll process to begin listening for events again.
3396 |
3397 | If no events occur for a while and the connection times out you will
3398 | receive a response with the value `reconnect`. When you receive this response
3399 | you’ll make another call to this endpoint to restart the process.
3400 |
3401 | If you receive no events in `retry_timeout` seconds then you will need to
3402 | make another request to the real-time server (one of the URLs in the response
3403 | for this endpoint). This might be necessary due to network errors.
3404 |
3405 | Finally, if you receive a `max_retries` error when making a request to the
3406 | real-time server, you should start over by making a call to this endpoint
3407 | first.
3408 |
3409 |
3410 |
3411 | ```bash
3412 | curl -i -X OPTIONS "https://api.box.com/2.0/events" \
3413 | -H "authorization: Bearer "
3414 | ```
3415 |
3416 | ## Get user and enterprise events
3417 |
3418 | Returns up to a year of past events for a given user
3419 | or for the entire enterprise.
3420 |
3421 | By default this returns events for the authenticated user. To retrieve
3422 | events for the entire enterprise, set the `stream_type` to `admin_logs`
3423 | (historical - 1 year) or `admin_logs_streaming` (live - two weeks). The user
3424 | making the API call will need to have admin privileges, and the application will
3425 | need to have the permission to access the event feed to get the enterprise event
3426 | feed.
3427 |
3428 |
3429 |
3430 | ```bash
3431 | curl -i -X GET "https://api.box.com/2.0/events" \
3432 | -H "authorization: Bearer "
3433 | ```
3434 |
3435 |
3436 |
3437 | ```bash
3438 | curl -i -X GET "https://api.box.com/2.0/events?stream_type=admin_logs" \
3439 | -H "authorization: Bearer "
3440 | ```
3441 |
3442 |
3443 |
3444 | ```bash
3445 | curl -i -X GET "https://api.box.com/2.0/events?stream_type=admin_logs&event_type=LOGIN,FAILED_LOGIN" \
3446 | -H "authorization: Bearer "
3447 | ```
3448 |
3449 |
3450 |
3451 | ```bash
3452 | curl -i -X GET "https://api.box.com/2.0/events?stream_type=admin_logs_streaming" \
3453 | -H "authorization: Bearer "
3454 | ```
3455 |
3456 |
3457 |
3458 | ```bash
3459 | curl -i -X GET "https://api.box.com/2.0/events?stream_type=admin_logs_streaming&event_type=LOGIN,FAILED_LOGIN" \
3460 | -H "authorization: Bearer "
3461 | ```
3462 |
3463 | ## List all collections
3464 |
3465 | Retrieves all collections for a given user.
3466 |
3467 | Currently, only the `favorites` collection
3468 | is supported.
3469 |
3470 |
3471 |
3472 | ```bash
3473 | curl -i -X GET "https://api.box.com/2.0/collections" \
3474 | -H "authorization: Bearer "
3475 | ```
3476 |
3477 | ## List collection items
3478 |
3479 | Retrieves the files and/or folders contained within
3480 | this collection.
3481 |
3482 |
3483 |
3484 | ```bash
3485 | curl -i -X GET "https://api.box.com/2.0/collections/926489/items" \
3486 | -H "authorization: Bearer "
3487 | ```
3488 |
3489 | ## Add file to collection
3490 |
3491 |
3492 |
3493 | ```bash
3494 | curl -i -X PUT "https://api.box.com/2.0/files/12345" \
3495 | -H "authorization: Bearer " \
3496 | -H "content-type: application/json" \
3497 | -d '{
3498 | "collections": [
3499 | {
3500 | "id": "123"
3501 | }
3502 | ]
3503 | }'
3504 | ```
3505 |
3506 | ## Add folder to collection
3507 |
3508 |
3509 |
3510 | ```bash
3511 | curl -i -X PUT "https://api.box.com/2.0/folders/12345" \
3512 | -H "authorization: Bearer " \
3513 | -H "content-type: application/json" \
3514 | -d '{
3515 | "collections": [
3516 | {
3517 | "id": "123"
3518 | }
3519 | ]
3520 | }'
3521 | ```
3522 |
3523 | ## Add web link to collection
3524 |
3525 |
3526 |
3527 | ```bash
3528 | curl -i -X PUT "https://api.box.com/2.0/web_links/12345" \
3529 | -H "authorization: Bearer " \
3530 | -H "content-type: application/json" \
3531 | -d '{
3532 | "collections": [
3533 | {
3534 | "id": "123"
3535 | }
3536 | ]
3537 | }'
3538 | ```
3539 |
3540 | ## Remove file from collection
3541 |
3542 |
3543 |
3544 | ```bash
3545 | curl -i -X PUT "https://api.box.com/2.0/files/12345" \
3546 | -H "authorization: Bearer " \
3547 | -H "content-type: application/json" \
3548 | -d '{
3549 | "collections": []
3550 | }'
3551 | ```
3552 |
3553 | ## Remove folder from collection
3554 |
3555 |
3556 |
3557 | ```bash
3558 | curl -i -X PUT "https://api.box.com/2.0/folders/12345" \
3559 | -H "authorization: Bearer " \
3560 | -H "content-type: application/json" \
3561 | -d '{
3562 | "collections": []
3563 | }'
3564 | ```
3565 |
3566 | ## Remove web link from collection
3567 |
3568 |
3569 |
3570 | ```bash
3571 | curl -i -X PUT "https://api.box.com/2.0/web_links/12345" \
3572 | -H "authorization: Bearer " \
3573 | -H "content-type: application/json" \
3574 | -d '{
3575 | "collections": []
3576 | }'
3577 | ```
3578 |
3579 | ## List recent items
3580 |
3581 | Returns information about the recent items accessed
3582 | by a user, either in the last 90 days or up to the last
3583 | 1000 items accessed.
3584 |
3585 |
3586 |
3587 | ```bash
3588 | curl -i -X GET "https://api.box.com/2.0/recent_items" \
3589 | -H "authorization: Bearer "
3590 | ```
3591 |
3592 | ## List retention policies
3593 |
3594 | Retrieves all of the retention policies for an enterprise.
3595 |
3596 |
3597 |
3598 | ```bash
3599 | curl -i -X GET "https://api.box.com/2.0/retention_policies" \
3600 | -H "authorization: Bearer "
3601 | ```
3602 |
3603 | ## Create retention policy
3604 |
3605 | Creates a retention policy.
3606 |
3607 |
3608 |
3609 | ```bash
3610 | curl -i -X POST "https://api.box.com/2.0/retention_policies" \
3611 | -H "authorization: Bearer " \
3612 | -H "content-type: application/json" \
3613 | -d '{
3614 | "policy_name": "Some Policy Name",
3615 | "policy_type": "finite",
3616 | "retention_length": 365,
3617 | "disposition_action": "permanently_delete"
3618 | }'
3619 | ```
3620 |
3621 | ## Get retention policy
3622 |
3623 | Retrieves a retention policy.
3624 |
3625 |
3626 |
3627 | ```bash
3628 | curl -i -X GET "https://api.box.com/2.0/retention_policies/982312" \
3629 | -H "authorization: Bearer "
3630 | ```
3631 |
3632 | ## Update retention policy
3633 |
3634 | Updates a retention policy.
3635 |
3636 |
3637 |
3638 | ```bash
3639 | curl -i -X PUT "https://api.box.com/2.0/retention_policies/982312" \
3640 | -H "authorization: Bearer " \
3641 | -H "content-type: application/json" \
3642 | -d '{
3643 | "disposition_action": "permanently_delete"
3644 | }'
3645 | ```
3646 |
3647 | ## List policy's assignments
3648 |
3649 | Returns a list of all retention policy assignments associated with a specified
3650 | retention policy.
3651 |
3652 |
3653 |
3654 | ```bash
3655 | curl -i -X GET "https://api.box.com/2.0/retention_policies/982312/assignments" \
3656 | -H "authorization: Bearer "
3657 | ```
3658 |
3659 | ## Assign retention policy
3660 |
3661 | Assigns a retention policy to an item.
3662 |
3663 |
3664 |
3665 | ```bash
3666 | curl -i -X POST "https://api.box.com/2.0/retention_policy_assignments" \
3667 | -H "authorization: Bearer " \
3668 | -H "content-type: application/json" \
3669 | -d '{
3670 | "policy_id": "173463",
3671 | "assign_to": {
3672 | "type": "folder",
3673 | "id": "6564564"
3674 | }
3675 | }'
3676 | ```
3677 |
3678 | ## Get policy assignment
3679 |
3680 | Retrieves a retention policy assignment
3681 |
3682 |
3683 |
3684 | ```bash
3685 | curl -i -X GET "https://api.box.com/2.0/retention_policy_assignments/1233123" \
3686 | -H "authorization: Bearer "
3687 | ```
3688 |
3689 | ## List all legal hold policies
3690 |
3691 | Retrieves a list of legal hold policies that belong to
3692 | an enterprise.
3693 |
3694 |
3695 |
3696 | ```bash
3697 | curl -i -X GET "https://api.box.com/2.0/legal_hold_policies" \
3698 | -H "authorization: Bearer "
3699 | ```
3700 |
3701 | ## Create legal hold policy
3702 |
3703 | Create a new legal hold policy.
3704 |
3705 |
3706 |
3707 | ```bash
3708 | curl -i -X POST "https://api.box.com/2.0/legal_hold_policies" \
3709 | -H "authorization: Bearer " \
3710 | -H "content-type: application/json" \
3711 | -d '{
3712 | "policy_name": "Policy 3",
3713 | "description": "Automatic created policy"
3714 | }'
3715 | ```
3716 |
3717 | ## Get legal hold policy
3718 |
3719 | Retrieve a legal hold policy.
3720 |
3721 |
3722 |
3723 | ```bash
3724 | curl -i -X GET "https://api.box.com/2.0/legal_hold_policies/324432" \
3725 | -H "authorization: Bearer "
3726 | ```
3727 |
3728 | ## Update legal hold policy
3729 |
3730 | Update legal hold policy.
3731 |
3732 |
3733 |
3734 | ```bash
3735 | curl -i -X PUT "https://api.box.com/2.0/legal_hold_policies/324432" \
3736 | -H "authorization: Bearer " \
3737 | -H "content-type: application/json" \
3738 | -d '{
3739 | "policy_name": "Policy 4"
3740 | }'
3741 | ```
3742 |
3743 | ## Delete legal hold policy
3744 |
3745 | Delete an existing legal hold policy.
3746 |
3747 | This is an asynchronous process. The policy will not be
3748 | fully deleted yet when the response returns.
3749 |
3750 |
3751 |
3752 | ```bash
3753 | curl -i -X DELETE "https://api.box.com/2.0/legal_hold_policies/324432" \
3754 | -H "authorization: Bearer "
3755 | ```
3756 |
3757 | ## List policy's assignments
3758 |
3759 | Retrieves a list of items a legal hold policy has been assigned to.
3760 |
3761 |
3762 |
3763 | ```bash
3764 | curl -i -X GET "https://api.box.com/2.0/legal_hold_policy_assignments?policy_id=324432" \
3765 | -H "authorization: Bearer "
3766 | ```
3767 |
3768 | ## Assign legal hold policy
3769 |
3770 | Assign a legal hold to a file, file version, folder, or user.
3771 |
3772 |
3773 |
3774 | ```bash
3775 | curl -i -X POST "https://api.box.com/2.0/legal_hold_policy_assignments" \
3776 | -H "authorization: Bearer " \
3777 | -H "content-type: application/json" \
3778 | -d '{
3779 | "policy_id": "123244",
3780 | "assign_to": {
3781 | "type": "folder",
3782 | "id": "6564564"
3783 | }
3784 | }'
3785 | ```
3786 |
3787 | ## Get policy assignment
3788 |
3789 | Retrieve a legal hold policy assignment.
3790 |
3791 |
3792 |
3793 | ```bash
3794 | curl -i -X GET "https://api.box.com/2.0/legal_hold_policy_assignments/753465" \
3795 | -H "authorization: Bearer "
3796 | ```
3797 |
3798 | ## Unassign legal hold policy
3799 |
3800 | Remove a legal hold from an item.
3801 |
3802 | This is an asynchronous process. The policy will not be
3803 | fully removed yet when the response returns.
3804 |
3805 |
3806 |
3807 | ```bash
3808 | curl -i -X DELETE "https://api.box.com/2.0/legal_hold_policy_assignments/753465" \
3809 | -H "authorization: Bearer "
3810 | ```
3811 |
3812 | ## Get retention for file
3813 |
3814 | Returns information about a file version retention.
3815 |
3816 |
3817 |
3818 | ```bash
3819 | curl -i -X GET "https://api.box.com/2.0/file_version_retentions/3424234" \
3820 | -H "authorization: Bearer "
3821 | ```
3822 |
3823 | ## List retentions on files
3824 |
3825 | Retrieves all file version retentions for the given enterprise.
3826 |
3827 |
3828 |
3829 | ```bash
3830 | curl -i -X GET "https://api.box.com/2.0/file_version_retentions" \
3831 | -H "authorization: Bearer "
3832 | ```
3833 |
3834 | ## List files under retention for a retention policy
3835 |
3836 | Retrieves all files for the given retention policy id.
3837 |
3838 |
3839 |
3840 | ```bash
3841 | curl -i -X GET "https://app.box.com/api/2.0/retention_policy_assignments/3424234/files_under_retention" \
3842 | -H "authorization: Bearer "
3843 | ```
3844 |
3845 | ## List file versions under retention for a retention policy
3846 |
3847 | Retrieves all file versions for the given retention policy id.
3848 |
3849 |
3850 |
3851 | ```bash
3852 | curl -i -X GET "https://app.box.com/api/2.0/retention_policy_assignments/3424234/file_versions_under_retention" \
3853 | -H "authorization: Bearer "
3854 | ```
3855 |
3856 | ## Inspect legal hold on file
3857 |
3858 | Retrieves information about the legal hold policies
3859 | assigned to a file version.
3860 |
3861 |
3862 |
3863 | ```bash
3864 | curl -i -X GET "https://api.box.com/2.0/file_version_legal_holds/2348213" \
3865 | -H "authorization: Bearer "
3866 | ```
3867 |
3868 | ## List legal holds for policy
3869 |
3870 | Get list of non-deleted legal holds for a single legal
3871 | hold policy.
3872 |
3873 |
3874 |
3875 | ```bash
3876 | curl -i -X GET "https://api.box.com/2.0/file_version_legal_holds?policy_id=133870" \
3877 | -H "authorization: Bearer "
3878 | ```
3879 |
3880 | ## Get device pin
3881 |
3882 | Retrieves information about an individual device pin.
3883 |
3884 |
3885 |
3886 | ```bash
3887 | curl -i -X GET "https://api.box.com/2.0/device_pinners/2324234" \
3888 | -H "authorization: Bearer "
3889 | ```
3890 |
3891 | ## Delete device pin
3892 |
3893 | Deletes an individual device pin.
3894 |
3895 |
3896 |
3897 | ```bash
3898 | curl -i -X DELETE "https://api.box.com/2.0/device_pinners/2324234" \
3899 | -H "authorization: Bearer "
3900 | ```
3901 |
3902 | ## List enterprise device pins
3903 |
3904 | Retrieves all the device pins within an enterprise.
3905 |
3906 | The user must have admin privileges, and the application
3907 | needs the "manage enterprise" scope to make this call.
3908 |
3909 |
3910 |
3911 | ```bash
3912 | curl -i -X GET "https://api.box.com/2.0/enterprises/3442311/device_pinners" \
3913 | -H "authorization: Bearer "
3914 | ```
3915 |
3916 | ## List terms of services
3917 |
3918 | Returns the current terms of service text and settings
3919 | for the enterprise.
3920 |
3921 |
3922 |
3923 | ```bash
3924 | curl -i -X GET "https://api.box.com/2.0/terms_of_services" \
3925 | -H "authorization: Bearer "
3926 | ```
3927 |
3928 | ## Create terms of service
3929 |
3930 | Creates a terms of service for a given enterprise
3931 | and type of user.
3932 |
3933 |
3934 |
3935 | ```bash
3936 | curl -i -X POST "https://api.box.com/2.0/terms_of_services" \
3937 | -H "authorization: Bearer " \
3938 | -H "content-type: application/json" \
3939 | -d '{
3940 | "status": "enabled",
3941 | "text": "By collaborating on this file you are accepting..."
3942 | }'
3943 | ```
3944 |
3945 | ## Get terms of service
3946 |
3947 | Fetches a specific terms of service.
3948 |
3949 |
3950 |
3951 | ```bash
3952 | curl -i -X GET "https://api.box.com/2.0/terms_of_services/324234" \
3953 | -H "authorization: Bearer "
3954 | ```
3955 |
3956 | ## Update terms of service
3957 |
3958 | Updates a specific terms of service.
3959 |
3960 |
3961 |
3962 | ```bash
3963 | curl -i -X PUT "https://api.box.com/2.0/terms_of_services/324234" \
3964 | -H "authorization: Bearer " \
3965 | -H "content-type: application/json" \
3966 | -d '{
3967 | "status": "enabled",
3968 | "text": "By collaborating on this file you are accepting..."
3969 | }'
3970 | ```
3971 |
3972 | ## List ToS user statuses
3973 |
3974 | Retrieves an overview of users and their status for a
3975 | terms of service, including Whether they have accepted
3976 | the terms and when.
3977 |
3978 |
3979 |
3980 | ```bash
3981 | curl -i -X GET "https://api.box.com/2.0/terms_of_service_user_statuses?tos_id=324234" \
3982 | -H "authorization: Bearer "
3983 | ```
3984 |
3985 | ## Set status for new user
3986 |
3987 | Sets the status for a terms of service for a user.
3988 |
3989 |
3990 |
3991 | ```bash
3992 | curl -i -X POST "https://api.box.com/2.0/terms_of_service_user_statuses" \
3993 | -H "authorization: Bearer " \
3994 | -H "content-type: application/json" \
3995 | -d '{
3996 | "tos": {
3997 | "type": "terms_of_service",
3998 | "id": "1232132"
3999 | },
4000 | "user": {
4001 | "type": "user",
4002 | "id": "3423423"
4003 | },
4004 | "is_accepted": true
4005 | }'
4006 | ```
4007 |
4008 | ## Set status for existing user
4009 |
4010 | Updates the status for a terms of service for a user.
4011 |
4012 |
4013 |
4014 | ```bash
4015 | curl -i -X PUT "https://api.box.com/2.0/terms_of_service_user_statuses/324234" \
4016 | -H "authorization: Bearer " \
4017 | -H "content-type: application/json" \
4018 | -d '{
4019 | "is_accepted": true
4020 | }'
4021 | ```
4022 |
4023 | ## List whitelist entries
4024 |
4025 | Returns the list of whitelist entries which specify what domains can
4026 | collaborate with the current enterprise.
4027 |
4028 |
4029 |
4030 | ```bash
4031 | curl -i -X GET "https://api.box.com/2.0/collaboration_whitelist_entries" \
4032 | -H "authorization: Bearer "
4033 | ```
4034 |
4035 | ## Create whitelist entry
4036 |
4037 | Creates a collaboration whitelist entry, specifying a domain
4038 | and direction to allow collaboration for.
4039 |
4040 |
4041 |
4042 | ```bash
4043 | curl -i -X POST "https://api.box.com/2.0/collaboration_whitelist_entries" \
4044 | -H "authorization: Bearer " \
4045 | -H "content-type: application/json" \
4046 | -d '{
4047 | "domain": "example.com",
4048 | "direction": "inboud"
4049 | }'
4050 | ```
4051 |
4052 | ## Get whitelist entry
4053 |
4054 | Returns a specific collaboration whitelist entry.
4055 |
4056 |
4057 |
4058 | ```bash
4059 | curl -i -X GET "https://api.box.com/2.0/collaboration_whitelist_entries/213123" \
4060 | -H "authorization: Bearer "
4061 | ```
4062 |
4063 | ## Delete whitelist entry
4064 |
4065 | Deletes a specific collaboration whitelist entry.
4066 |
4067 |
4068 |
4069 | ```bash
4070 | curl -i -X DELETE "https://api.box.com/2.0/collaboration_whitelist_entries/213123" \
4071 | -H "authorization: Bearer "
4072 | ```
4073 |
4074 | ## List whitelist exemptions
4075 |
4076 | Returns a list of users who have been exempt from the collaboration
4077 | whitelist.
4078 |
4079 |
4080 |
4081 | ```bash
4082 | curl -i -X GET "https://api.box.com/2.0/collaboration_whitelist_exempt_targets" \
4083 | -H "authorization: Bearer "
4084 | ```
4085 |
4086 | ## Create whitelist exemption
4087 |
4088 | Creates a collaboration whitelist entry exemption, specifying a user
4089 | that is exempted from the whitelist.
4090 |
4091 |
4092 |
4093 | ```bash
4094 | curl -i -X POST "https://api.box.com/2.0/collaboration_whitelist_exempt_targets" \
4095 | -H "authorization: Bearer " \
4096 | -H "content-type: application/json" \
4097 | -d '{
4098 | "user": {
4099 | "id": "23522323"
4100 | }
4101 | }'
4102 | ```
4103 |
4104 | ## Get whitelist exemption
4105 |
4106 | Returns a users who has been exempt from the collaboration
4107 | whitelist.
4108 |
4109 |
4110 |
4111 | ```bash
4112 | curl -i -X GET "https://api.box.com/2.0/collaboration_whitelist_exempt_targets/984923" \
4113 | -H "authorization: Bearer "
4114 | ```
4115 |
4116 | ## Remove whitelist exemption
4117 |
4118 | Deletes a specific collaboration whitelist exemption.
4119 |
4120 |
4121 |
4122 | ```bash
4123 | curl -i -X DELETE "https://api.box.com/2.0/collaboration_whitelist_exempt_targets/984923" \
4124 | -H "authorization: Bearer "
4125 | ```
4126 |
4127 | ## List storage policies
4128 |
4129 | Fetches all the storage policies in the enterprise.
4130 |
4131 |
4132 |
4133 | ```bash
4134 | curl -i -X GET "https://api.box.com/2.0/storage_policies" \
4135 | -H "authorization: Bearer "
4136 | ```
4137 |
4138 | ## Get storage policy
4139 |
4140 | Fetches a specific storage policy.
4141 |
4142 |
4143 |
4144 | ```bash
4145 | curl -i -X GET "https://api.box.com/2.0/storage_policies/34342" \
4146 | -H "authorization: Bearer "
4147 | ```
4148 |
4149 | ## List policy assignments
4150 |
4151 | Fetches all the storage policy assignment for an enterprise or user.
4152 |
4153 |
4154 |
4155 | ```bash
4156 | curl -i -X GET "https://api.box.com/2.0/storage_policy_assignments?resolved_for_type=userresolved_for_id=984322" \
4157 | -H "authorization: Bearer "
4158 | ```
4159 |
4160 | ## Assign storage policy
4161 |
4162 | Creates a storage policy assignment for an enterprise or user.
4163 |
4164 |
4165 |
4166 | ```bash
4167 | curl -i -X POST "https://api.box.com/2.0/storage_policy_assignments" \
4168 | -H "authorization: Bearer " \
4169 | -H "content-type: application/json" \
4170 | -d '{
4171 | "storage_policy": {
4172 | "type": "storage_policy",
4173 | "id": "1434325"
4174 | },
4175 | "assigned_to": {
4176 | "type": "user",
4177 | "id": "9987987"
4178 | }
4179 | }'
4180 | ```
4181 |
4182 | ## Get policy assignment
4183 |
4184 | Fetches a specific storage policy assignment.
4185 |
4186 |
4187 |
4188 | ```bash
4189 | curl -i -X GET "https://api.box.com/2.0/storage_policy_assignments/932483" \
4190 | -H "authorization: Bearer "
4191 | ```
4192 |
4193 | ## Update policy assignment
4194 |
4195 | Updates a specific storage policy assignment.
4196 |
4197 |
4198 |
4199 | ```bash
4200 | curl -i -X PUT "https://api.box.com/2.0/storage_policy_assignments/932483" \
4201 | -H "authorization: Bearer " \
4202 | -H "content-type: application/json" \
4203 | -d '{
4204 | "storage_policy": {
4205 | "type": "storage_policy",
4206 | "id": "1434325"
4207 | }
4208 | }'
4209 | ```
4210 |
4211 | ## Unassign storage policy
4212 |
4213 | Delete a storage policy assignment.
4214 |
4215 | Deleting a storage policy assignment on a user
4216 | will have the user inherit the enterprise's default
4217 | storage policy.
4218 |
4219 | There is a rate limit for calling this endpoint of only
4220 | twice per user in a 24 hour period.
4221 |
4222 |
4223 |
4224 | ```bash
4225 | curl -i -X DELETE "https://api.box.com/2.0/storage_policy_assignments/932483" \
4226 | -H "authorization: Bearer " \
4227 | -d '{
4228 | "items": {
4229 | "type": "storage_policy",
4230 | "id": "1434325"
4231 | }
4232 | }'
4233 | ```
4234 |
4235 | ## Create zip download
4236 |
4237 |
4238 |
4239 | ```bash
4240 | curl -i -X POST "https://api.box.com/2.0/zip_downloads" \
4241 | -H "authorization: Bearer " \
4242 | -d '{
4243 | "download_file_name": "January Financials",
4244 | "items": [
4245 | {
4246 | "type": "file",
4247 | "id": "12345"
4248 | },
4249 | {
4250 | "type": "file",
4251 | "id": "34325"
4252 | },
4253 | {
4254 | "type": "folder",
4255 | "id": "45678"
4256 | }
4257 | ]
4258 | }'
4259 | ```
4260 |
4261 | ## Get zip download status
4262 |
4263 |
4264 |
4265 | ```bash
4266 | curl -i -X GET "https://api.box.com/2.0/zip_downloads/29l00nfxDyHOt7RphI9zT_w==nDnZEDjY2S8iEWWCHEEiptFxwoWojjlibZjJ6geuE5xnXENDTPxzgbks_yY=/status" \
4267 | -H "authorization: Bearer "
4268 | ```
4269 |
4270 | ## Download zip archive
4271 |
4272 |
4273 |
4274 | ```bash
4275 | curl -L GET "https://dl.boxcloud.com/2.0/zip_downloads/29l00nfxDyHOt7RphI9zT_w==nDnZEDjY2S8iEWWCHEEiptFxwoWojjlibZjJ6geuE5xnXENDTPxzgbks_yY=/content" \
4276 | -H "authorization: Bearer " \
4277 | -o sample_curl.zip
4278 | ```
4279 |
4280 | ## List all classifications
4281 |
4282 |
4283 |
4284 | ```bash
4285 | curl -i -X GET "https://api.box.com/2.0/metadata_templates/enterprise/securityClassification-6VMVochwUWo/schema" \
4286 | -H "authorization: Bearer "
4287 | ```
4288 |
4289 | ## Add initial classifications
4290 |
4291 |
4292 |
4293 | ```bash
4294 | curl -i -X POST "https://api.box.com/2.0/metadata_templates/schema" \
4295 | -H "authorization: Bearer " \
4296 | -H "content-type: application/json" \
4297 | -d '{
4298 | "templateKey": "securityClassification-6VMVochwUWo",
4299 | "scope": "enterprise",
4300 | "displayName": "Classification",
4301 | "hidden": false,
4302 | "copyInstanceOnItemCopy": true,
4303 | "fields": [
4304 | {
4305 | "type": "enum",
4306 | "key": "Box__Security__Classification__Key",
4307 | "displayName": "Classification",
4308 | "hidden": false,
4309 | "options": [
4310 | {
4311 | "key": "Classified",
4312 | "staticConfig": {
4313 | "classification": {
4314 | "colorID": 7,
4315 | "classificationDefinition": "Top Seret"
4316 | }
4317 | }
4318 | }
4319 | ]
4320 | }
4321 | ]
4322 | }'
4323 | ```
4324 |
4325 | ## Add another classification
4326 |
4327 |
4328 |
4329 | ```bash
4330 | curl -i -X PUT "https://api.box.com/2.0/metadata_templates/enterprise/securityClassification-6VMVochwUWo/schema" \
4331 | -H "authorization: Bearer " \
4332 | -H "content-type: application/json-patch+json" \
4333 | -d '[{
4334 | "op": "addEnumOption",
4335 | "fieldKey": "Box__Security__Classification__Key",
4336 | "data": {
4337 | "key": "Sensitive",
4338 | "staticConfig":{
4339 | "classification": {
4340 | "classificationDefinition": "Sensitive information that must not be shared.",
4341 | "colorID": 4
4342 | }
4343 | }
4344 | }
4345 | }]'
4346 | ```
4347 |
4348 | ## Update classification
4349 |
4350 |
4351 |
4352 | ```bash
4353 | curl -i -X PUT "https://api.box.com/2.0/metadata_templates/enterprise/securityClassification-6VMVochwUWo/schema" \
4354 | -H "authorization: Bearer " \
4355 | -H "content-type: application/json-patch+json" \
4356 | -d '[{
4357 | "op": "editEnumOption",
4358 | "fieldKey": "Box__Security__Classification__Key",
4359 | "enumOptionKey": "Sensitive",
4360 | "data": {
4361 | "key": "Very Sensitive",
4362 | "staticConfig": {
4363 | "classification": {
4364 | "classificationDefinition": "Sensitive information that must not be shared.",
4365 | "colorID": 4
4366 | }
4367 | }
4368 | }
4369 | }]'
4370 | ```
4371 |
4372 | ## Delete classification
4373 |
4374 |
4375 |
4376 | ```bash
4377 | curl -i -X PUT "https://api.box.com/2.0/metadata_templates/enterprise/securityClassification-6VMVochwUWo/schema" \
4378 | -H "authorization: Bearer " \
4379 | -H "content-type: application/json-patch+json" \
4380 | -d '[{
4381 | "op": "removeEnumOption",
4382 | "fieldKey": "Box__Security__Classification__Key",
4383 | "enumOptionKey": "Sensitive"
4384 | }]'
4385 | ```
4386 |
4387 | ## Delete all classifications
4388 |
4389 |
4390 |
4391 | ```bash
4392 | curl -i -X DELETE "https://api.box.com/2.0/metadata_templates/enterprise/securityClassification-6VMVochwUWo/schema" \
4393 | -H "authorization: Bearer "
4394 | ```
4395 |
4396 | ## Get classification on file
4397 |
4398 |
4399 |
4400 | ```bash
4401 | curl -i -X GET "https://api.box.com/2.0/files/12345/metadata/enterprise/securityClassification-6VMVochwUWo" \
4402 | -H "authorization: Bearer "
4403 | ```
4404 |
4405 | ## Add classification to file
4406 |
4407 |
4408 |
4409 | ```bash
4410 | curl -i -X POST "https://api.box.com/2.0/files/12345/metadata/enterprise/securityClassification-6VMVochwUWo" \
4411 | -H "authorization: Bearer " \
4412 | -H "content-type: application/json" \
4413 | -d '{
4414 | "Box__Security__Classification__Key": "Sensitive"
4415 |
4416 | }'
4417 | ```
4418 |
4419 | ## Update classification on file
4420 |
4421 |
4422 |
4423 | ```bash
4424 | curl -i -X PUT "https://api.box.com/2.0/files/12345/metadata/enterprise/securityClassification-6VMVochwUWo" \
4425 | -H "authorization: Bearer " \
4426 | -H "content-type: application/json-patch+json" \
4427 | -d '[{
4428 | "op": "replace",
4429 | "path": "/Box__Security__Classification__Key",
4430 | "value": "Internal"
4431 | }]'
4432 | ```
4433 |
4434 | ## Remove classification from file
4435 |
4436 |
4437 |
4438 | ```bash
4439 | curl -i -X DELETE "https://api.box.com/2.0/files/12345/metadata/enterprise/securityClassification-6VMVochwUWo" \
4440 | -H "authorization: Bearer "
4441 | ```
4442 |
4443 | ## Get classification on folder
4444 |
4445 |
4446 |
4447 | ```bash
4448 | curl -i -X GET "https://api.box.com/2.0/folders/12345/metadata/enterprise/securityClassification-6VMVochwUWo" \
4449 | -H "authorization: Bearer "
4450 | ```
4451 |
4452 | ## Add classification to folder
4453 |
4454 |
4455 |
4456 | ```bash
4457 | curl -i -X POST "https://api.box.com/2.0/folders/12345/metadata/enterprise/securityClassification-6VMVochwUWo" \
4458 | -H "authorization: Bearer " \
4459 | -H "content-type: application/json" \
4460 | -d '{
4461 | "Box__Security__Classification__Key": "Sensitive"
4462 | }'
4463 | ```
4464 |
4465 | ## Update classification on folder
4466 |
4467 |
4468 |
4469 | ```bash
4470 | curl -i -X PUT "https://api.box.com/2.0/folders/12345/metadata/enterprise/securityClassification-6VMVochwUWo" \
4471 | -H "authorization: Bearer