POST/document
This method stages a document to be uploaded, and requires the type of document to be uploaded, and the language(s) that the document contains. A successful call returns a documentId value that is then used as a path parameter in an uploadDocument call.
When a document is successfully created, the method returns the HTTP Status Code 201 Created.
The method returns documentId in the response payload, which you can use to retrieve the document resource. This ID is also returned in the location header, for convenience.
Important! Make sure to capture the document ID value returned in the response payload. This value is required to use the other methods in the document resource, and also needed to associate a document to a listing using the Trading and Inventory APIs.
To upload a created document, use the document ID returned from this method's response with the uploadDocument method. See Managing documents for information on creating, uploading, and adding documents to listings.
Input
Resource URI
This method is supported in Sandbox environment. To access the endpoint, just replace the api.ebay.com
root URI with api.sandbox.ebay.com
URI parameters
This method has no URI parameters.
HTTP request headers
All requests made to eBay REST operations require you to provide the Authorization
HTTP header for authentication authorization.
The table below shows additional HTTP request headers that are either required, conditionally required, or strongly recommended for this method. Other standard HTTP request headers- opens rest request components page (not in this table) can also be used, but they are optional.
Header | Type | Description |
---|---|---|
Content-Type | string | This header indicates the format of the request body provided by the client. Its value should be set to application/json. For more information, refer to HTTP request headers. Occurrence: Required |
OAuth scope
This request requires an access token created with the authorization code grant flow, using one or more scopes from the following list (please check your Application Keys page for a list of OAuth scopes available to your application):
https://api.ebay.com/oauth/api_scope/sell.inventory
See OAuth access tokens for more information.
Request payload
Copy complete valid JSON to clipboardRequest fields
Input container/field | Type | Description |
---|---|---|
documentType | DocumentTypeEnum | The type of the document being uploaded. For example, a Occurrence: Required |
languages | array of LanguageEnum | This array shows the language(s) used in the document. Occurrence: Required |
Output
HTTP response headers
See HTTP response headers for details.
Header | Meaning |
---|---|
Location | The location response header returns the getDocument URI. |
Response payload
Response fields
Output container/field | Type | Description |
---|---|---|
documentId | string | The unique identifier of the document to be uploaded. Occurrence: Always |
documentStatus | DocumentStatusEnum | The status of the document resource. For example, the value Occurrence: Always |
documentType | DocumentTypeEnum | The type of the document uploaded. For example, Occurrence: Always |
languages | array of LanguageEnum | This array shows the language(s) used in the document. Occurrence: Always |
HTTP status codes
This call can return one of the following HTTP status codes. For an overview of the status codes, see HTTP status codes in Using eBay RESTful APIs.
Status | Meaning |
---|---|
201 | Created |
400 | Bad Request |
500 | Internal Server Error |
Error codes
For more on errors, plus the codes of other common errors, see Handling errors.
Code | Domain | Category | Meaning |
---|---|---|---|
190050 | API_MEDIA | REQUEST | Missing or invalid 'languages' value(s). |
190051 | API_MEDIA | REQUEST | Missing or invalid 'documentType' value. |
Warnings
This call has no warnings.
Samples
New to making API calls? Please see Making a Call.
Note: Identifiers, such as order IDs or user IDs, and personal data in these samples might be anonymized or may no longer be active on eBay. If necessary, substitute current, relevant eBay data in your requests.
Sample 1: Create a document ID
This sample creates a document ID using provided metadata to be used when uploading a document. Metadata includes documentType and languages.
Input
The inputs are the documentType and languages array.
POSThttps://api.ebay.com/commerce/media/v1_beta/document
Output
A successful call will show an HTTP status of 201 Created and the following payload. If the call is successful, the document will be created and the document ID is returned in the response payload as well as the Location header. The response payload includes the document ID, status, type, and language(s).