Back to Karakeep

Upload a new asset

docs/versioned_docs/version-v0.31.0/api/upload-asset.api.mdx

0.31.01.9 KB
Original Source

import MethodEndpoint from "@theme/ApiExplorer/MethodEndpoint"; import ParamsDetails from "@theme/ParamsDetails"; import RequestSchema from "@theme/RequestSchema"; import StatusCodes from "@theme/StatusCodes"; import OperationTabs from "@theme/OperationTabs"; import TabItem from "@theme/TabItem"; import Heading from "@theme/Heading";

<Heading as={"h1"} className={"openapi__heading"} children={"Upload a new asset"}

</Heading>

<MethodEndpoint method={"post"} path={"/assets"} context={"endpoint"}

</MethodEndpoint>

Upload a binary file as a new asset. The uploaded asset can then be attached to a bookmark via the POST /bookmarks/{bookmarkId}/assets endpoint.

<Heading id={"request"} as={"h2"} className={"openapi-tabs__heading"} children={"Request"}

</Heading>

<ParamsDetails parameters={undefined}

</ParamsDetails>

<RequestSchema title={"Body"} body={{"description":"The file to upload as multipart/form-data.","content":{"multipart/form-data":{"schema":{"type":"object","properties":{"file":{"title":"File to be uploaded"}},"required":["file"]}}}}}

</RequestSchema>

<StatusCodes id={undefined} label={undefined} responses={{"200":{"description":"The asset was uploaded successfully. Returns metadata about the uploaded asset.","content":{"application/json":{"schema":{"type":"object","properties":{"assetId":{"type":"string","description":"The unique identifier assigned to the uploaded asset."},"contentType":{"type":"string","description":"The MIME type of the uploaded file."},"size":{"type":"number","description":"The size of the uploaded file in bytes."},"fileName":{"type":"string","description":"The original file name of the uploaded file."}},"required":["assetId","contentType","size","fileName"],"title":"UploadedAsset"}}}},"401":{"description":"Unauthorized — the Bearer token is missing, invalid, or expired.","content":{"text/plain":{"schema":{"type":"string","example":"Unauthorized"}}}}}}

</StatusCodes>