python/resources/uploads/subresources/parts/index.md +0 −98 deleted
File Deleted View Diff
1# Parts
2
3## Add upload part
4
5`uploads.parts.create(strupload_id, PartCreateParams**kwargs) -> UploadPart`
6
7**post** `/uploads/{upload_id}/parts`
8
9Adds a [Part](https://platform.openai.com/docs/api-reference/uploads/part-object) to an [Upload](https://platform.openai.com/docs/api-reference/uploads/object) object. A Part represents a chunk of bytes from the file you are trying to upload.
10
11Each Part can be at most 64 MB, and you can add Parts until you hit the Upload maximum of 8 GB.
12
13It is possible to add multiple Parts in parallel. You can decide the intended order of the Parts when you [complete the Upload](https://platform.openai.com/docs/api-reference/uploads/complete).
14
15### Parameters
16
17- `upload_id: str`
18
19- `data: FileTypes`
20
21 The chunk of bytes for this Part.
22
23### Returns
24
25- `class UploadPart: …`
26
27 The upload Part represents a chunk of bytes we can add to an Upload object.
28
29 - `id: str`
30
31 The upload Part unique identifier, which can be referenced in API endpoints.
32
33 - `created_at: int`
34
35 The Unix timestamp (in seconds) for when the Part was created.
36
37 - `object: Literal["upload.part"]`
38
39 The object type, which is always `upload.part`.
40
41 - `"upload.part"`
42
43 - `upload_id: str`
44
45 The ID of the Upload object that this Part was added to.
46
47### Example
48
49```python
50import os
51from openai import OpenAI
52
53client = OpenAI(
54 api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted
55)
56upload_part = client.uploads.parts.create(
57 upload_id="upload_abc123",
58 data=b"Example data",
59)
60print(upload_part.id)
61```
62
63#### Response
64
65```json
66{
67 "id": "id",
68 "created_at": 0,
69 "object": "upload.part",
70 "upload_id": "upload_id"
71}
72```
73
74## Domain Types
75
76### Upload Part
77
78- `class UploadPart: …`
79
80 The upload Part represents a chunk of bytes we can add to an Upload object.
81
82 - `id: str`
83
84 The upload Part unique identifier, which can be referenced in API endpoints.
85
86 - `created_at: int`
87
88 The Unix timestamp (in seconds) for when the Part was created.
89
90 - `object: Literal["upload.part"]`
91
92 The object type, which is always `upload.part`.
93
94 - `"upload.part"`
95
96 - `upload_id: str`
97
98 The ID of the Upload object that this Part was added to.