> ## Documentation Index
> Fetch the complete documentation index at: https://developer.box.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Create Upload Session

export const MultiRelatedLinks = ({sections = []}) => {
  if (!sections || sections.length === 0) {
    return null;
  }
  return <div className="space-y-8">
      {sections.map((section, index) => <RelatedLinks key={index} title={section.title} items={section.items} />)}
    </div>;
};

export const RelatedLinks = ({title, items = []}) => {
  const getBadgeClass = badge => {
    if (!badge) return "badge-default";
    const badgeType = badge.toLowerCase().replace(/\s+/g, "-");
    return `badge-${badge === "ガイド" ? "guide" : badgeType}`;
  };
  if (!items || items.length === 0) {
    return null;
  }
  return <div className="my-8">
      {}
      <h3 className="text-sm font-bold uppercase tracking-wider mb-4">{title}</h3>

      {}
      <div className="flex flex-col gap-3">
        {items.map((item, index) => <a key={index} href={item.href} className="py-2 px-3 rounded related_link hover:bg-[#f2f2f2] dark:hover:bg-[#111827] flex items-center gap-3 group no-underline hover:no-underline border-b-0">
            {}
            <span className={`px-2 py-1 rounded-full text-xs font-semibold uppercase tracking-wide flex-shrink-0 ${getBadgeClass(item.badge)}`}>
              {item.badge}
            </span>

            {}
            <span className="text-base">{item.label}</span>
          </a>)}
      </div>
    </div>;
};

export const Link = ({href, children, className, ...props}) => {
  const localizedHref = localizeLink(href);
  return <a href={localizedHref} className={className} {...props}>
      {children}
    </a>;
};

To create an upload session, call the
<Link href="/reference/post-files-upload-sessions">`POST /files/upload_sessions`</Link> API with the desired `file_name`
and `folder_id` to put the file in, as well as the `file_size` of the file to be
uploaded.

To create a session for a new version of an existing file, call the
<Link href="/reference/post-files-id-upload-sessions">`POST /files/:id/upload_sessions`</Link> API instead. In this
case, the `file_name` and `folder_id` are only required when renaming or moving
the file in the process.

## Pre-flight Check

Creating an upload session also performs a <Link href="/guides/uploads/check">preflight check</Link>, making it
unnecessary to do so separately when working with chunked uploads.

## Response

When a session is created successfully the response includes an <Link href="/reference/resources/upload-session">Upload
Session</Link> that includes a session ID, the number of parts, the
part sizes, as well as links to the relevant next API endpoints to use.

```json theme={null}
{
  "id": "F971964745A5CD0C001BBE4E58196BFD",
  "type": "upload_session",
  "session_expires_at": "2012-12-12T10:53:43-08:00",
  "part_size": 1024,
  "total_parts": 1000,
  "num_parts_processed": 455,
  "session_endpoints": {
    "upload_part": "https://upload.box.com/api/2.0/files/upload_sessions/F971964745A5CD0C001BBE4E58196BFD",
    "commit": "https://upload.box.com/api/2.0/files/upload_sessions/F971964745A5CD0C001BBE4E58196BFD/commit",
    "abort": "https://upload.box.com/api/2.0/files/upload_sessions/F971964745A5CD0C001BBE4E58196BFD",
    "list_parts": "https://upload.box.com/api/2.0/files/upload_sessions/F971964745A5CD0C001BBE4E58196BFD/parts",
    "status": "https://upload.box.com/api/2.0/files/upload_sessions/F971964745A5CD0C001BBE4E58196BFD",
    "log_event": "https://upload.box.com/api/2.0/files/upload_sessions/F971964745A5CD0C001BBE4E58196BFD/log"
  }
}
```

The upload session defines the size of the parts to use when uploading the
individual parts.

<RelatedLinks
  title="RELATED APIS"
  items={[
{ label: translate("Create upload session"), href: "/reference/post-files-upload-sessions", badge: "POST" },
{ label: translate("Create upload session for existing file"), href: "/reference/post-files-id-upload-sessions", badge: "POST" }
]}
/>

<RelatedLinks
  title="RELATED GUIDES"
  items={[
{ label: translate("Upload Part"), href: "/guides/uploads/chunked/upload-part", badge: "GUIDE" },
{ label: translate("Commit Upload Session"), href: "/guides/uploads/chunked/commit-session", badge: "GUIDE" }
]}
/>
