Error: API Error 400: You cannot access body after reading from request's data stream
When calling openseaSDK.createSellOrder, getting this error and not sure why.
That link is looking mighty phishy.
getting the same error when calling createBuyOrder
Just deleted the bot comment, sorry about that.
Can you send over specific steps so I can reproduce? Also, is this happening for both sellOrder and buyOrder?
Hi @esteban-OpenSea,
I've also noticed this as well. Here is an example request:
curl https://testnets-api.opensea.io/api/v2/orders/rinkeby/seaport/offers -X POST --data-raw '{"parameters":{"offerer":"0xd5E4EC33d198c57598BE0CA5e78772a4098A2cF6","zone":"0x9b814233894cd227f561b78cc65891aa55c62ad2","zoneHash":"0x3000000000000000000000000000000000000000000000000000000000000000","startTime":"1655418624","endTime":"1655505024","orderType":0,"offer":[{"itemType":1,"token":"0xc778417e063141139fce010982780140aa0cd5ab","identifierOrCriteria":"0","startAmount":"1000000000000000","endAmount":"1000000000000000"}],"consideration":[{"itemType":2,"token":"0xb74bf94049d2c01f8805b8b15db0909168cabf46","identifierOrCriteria":"271","startAmount":"1","endAmount":"1","recipient":"0xd5E4EC33d198c57598BE0CA5e78772a4098A2cF6"},{"itemType":1,"token":"0xc778417e063141139fce010982780140aa0cd5ab","identifierOrCriteria":"0","startAmount":"25000000000000","endAmount":"25000000000000","recipient":"0x0000000000000000000000000000000000000000"}],"totalOriginalConsiderationItems":2,"salt":"0x84d51b5b68c414392f80eeb33c0b6ab4","conduitKey":"0x0000007b02230091a7ed01230072f7006a004d60a8d4e71d599b8104250f0000","counter":0},"signature":"0x538492d5ab4f260190e6a819b329d731d869e81ebac6aae35aecd1bd5bd83181479cdec7fb059af83f3b8cd9bd2751c6e526b865beedb8d3ad5e334345734296"}' -H 'X-API-KEY: <api_key>'
{"errors":["You cannot access body after reading from request's data stream"]}%
It's actually because of the url. In the repo, the basePath is https://api.opensea.io/api/v2/ but it should be https://api.opensea.io/v2/. So the final url is https://api.opensea.io/v2/orders/ethereum/seaport/offers
Do you need to call testnets-api if the network is rinkeby?
yes it would be https://testnets-api.opensea.io/v2/orders/rinkeby/seaport/offers
@davidseroussi I think both urls should work actually. Would you mind posting a successful request with the order data?
@plondon sure, this payload returned
{
"errors": [
"You cannot access body after reading from request's data stream"
]
}
using /api/v2/offers, but returned the successful order using /v2/offers
{
"parameters": {
"offerer": "0xb040d6f5Ea06FBdB221004C1F5a8885D98EBdEa3",
"offer": [{
"itemType": 1,
"token": "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2",
"identifierOrCriteria": 0,
"startAmount": 100000000000000000,
"endAmount": 100000000000000000
}],
"consideration": [{
"itemType": 2,
"token": "0x0Cfb5d82BE2b949e8fa73A656dF91821E2aD99FD",
"identifierOrCriteria": 281479271686476,
"startAmount": 1,
"endAmount": 1,
"recipient": "0xb040d6f5Ea06FBdB221004C1F5a8885D98EBdEa3"
}, {
"itemType": 1,
"token": "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2",
"identifierOrCriteria": 0,
"startAmount": 2500000000000000,
"endAmount": 2500000000000000,
"recipient": "0x8De9C5A032463C561423387a9648c5C7BCC5BC90"
}, {
"itemType": 1,
"token": "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2",
"identifierOrCriteria": 0,
"startAmount": 5000000000000000,
"endAmount": 5000000000000000,
"recipient": "0x8fda7f45b1427F2d4444F4c6D44D2B5d1cb46b53"
}],
"startTime": 0,
"endTime": 1655574606,
"orderType": 2,
"zone": "0x004C00500000aD104D7DBd00e3ae0A5C00560C00",
"zoneHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"salt": 89054825639822128,
"conduitKey": "0x0000007b02230091a7ed01230072f7006a004d60a8d4e71d599b8104250f0000",
"totalOriginalConsiderationItems": 3,
"counter": 0
},
"signature": "0x0b13752edae09a827c32381561a4709b8defa7789209d66276ef9889f9fd730867cb167c56c27b823af61db3b11810f9d103d26e225e106062ed21907525ae7b1c"
}
This issue seems to be specific to the testnets-api, where the error returned is always
{"errors":["You cannot access body after reading from request's data stream"]}%
For mainnet, errors are coming through correctly
This seems to be working for me, I am running the url you all are running: https://testnets-api.opensea.io/v2/orders/rinkeby/seaport/offers
It returns a successful call.
@esteban-OpenSea thanks for the response, could you include the full curl?
Same error here using: https://testnets-api.opensea.io/v2/orders/rinkeby/seaport/offers
The /orders seaport APIs endpoints are simply not working, at least for the rinkeby network. I face the same error for createSellOrder.
The error is due to a bad handling of the user request data in Opensea's API django backend. It seems pretty easy to solve this error IMO.
Also, the docs are outdated and quite confusing: endpoints differ between docs and the SDK (api/v2 in SDK and v2 in docs). They also put /ethereum in the endpoint path for the rinkeby doc examples. The order parameters format in the docs is wrong.
As a user, I expect better guidance and/or support given how seaport is currently advertised as a functional protocol.
curl --request POST
--url https://testnets-api.opensea.io/v2/orders/rinkeby/seaport/listings
--header 'Accept: application/json'
--header 'Content-Type: application/json'
--header 'X-API-KEY: 2f6f419a083c46de9d83ce3dbe7db601'
--data '
{
"order_parameters": {
"offerer": "0x45fe652136DB9a4BAC7A51B97217E16380e3C4F9",
"zone": "0x9b814233894cd227f561b78cc65891aa55c62ad2",
"zoneHash": "0x3000000000000000000000000000000000000000000000000000000000000000",
"startTime": "1655538402",
"endTime": "1656143201",
"orderType": 0,
"offer": [
{
"itemType": 2,
"token": "0xf5769f5d59e52363ac24fdd4781659430374cbb1",
"identifierOrCriteria": "63",
"startAmount": "1",
"endAmount": "1"
}
],
"consideration": [
{
"itemType": 0,
"token": "0x0000000000000000000000000000000000000000",
"identifierOrCriteria": "0",
"startAmount": "1950000000000000",
"endAmount": "1950000000000000",
"recipient": "0x45fe652136DB9a4BAC7A51B97217E16380e3C4F9"
},
{
"itemType": 0,
"token": "0x0000000000000000000000000000000000000000",
"identifierOrCriteria": "0",
"startAmount": "50000000000000",
"endAmount": "50000000000000",
"recipient": "0x8de9c5a032463c561423387a9648c5c7bcc5bc90"
}
],
"totalOriginalConsiderationItems": 2,
"salt": "0x38d239ca430328b9cd02423b2942a68f",
"conduitKey": "0x0000007b02230091a7ed01230072f7006a004d60a8d4e71d599b8104250f0000",
"counter": 0
},
"signature": "0x98b65e071d2c002d769d4a5a98073824a34e85232f5e094b9f8108a43c5d2b1957438185209a1e8de8a13d3de89278adfa06e3effa5890049801c21a097884ed"
}
'
{"errors":["You cannot access body after reading from request's data stream"]}
Reproduced with mainnet API:

seaport = new OpenSeaPort(app.provider, {
networkName: Network.Main,
apiKey: process.env.OPENSEA_APIKEY,
})
const params = ...
await seaport.createSellOrder(params)
Error appears after signing.
app.provider is window.ethereum.
opensea-js version 4.0.1 and 4.0.2
I'm getting the same error on rinkeby and mainnet. I echo the same sentiment as @gqoew, the docs are wrong and confusing--fields are labeled using snake_case, but the sdk uses camelCase. The create listing doc model for parameters does not express how to put an array for considerations and offer. The sdk also works differently than the doc. I'm confused and need dev support.
I'm also running into the same issues - please help!
Thanks
In Rinkeby, I change the URL manually to https://testnets-api.opensea.io/v2/orders/rinkeby/seaport/listings it changes to return CORS error now.
Wanted to provide an update-- I got sells working with a few changes:
- Updating the POST listing url to
https://api.opensea.io/v2/orders/ethereum/seaport/listingsremove the/apipath segment. - Updating to latest
opensea-jsandseaport-jswhich include updated Fee payout addresses. - Adding
restrictedByZone: trueandallowPartialFills: falseto the seaport callseaport.createOrder({...}). Thanks to @plondon for this.
It's worth pointing out that I'm actually listing on chain, without a signature, from a smart contract wallet so I'm using seaport.validate() and then posting the completed order to the corrected listings api using a signature from a different EOA account.