Create a link session
Generates the links for the seller to connect marketplaces, through our page or a button in your app.
Creates the connect session of a seller and returns two kinds of link. Both share the same deadline and show up only in this response.
url, the hosted page. Send it to the seller (email, message). They pick the marketplace, authorize on the marketplace screen and come back to the page, which shows the connected account.connectUrls, one link per marketplace to put behind your own "Connect" button. Opening it takes the seller straight to the marketplace consent screen; after authorizing, they land on yourredirectUrlwith?connected=<marketplace>(or?error=<code>). Our page is never in the way. Without aredirectUrl, they land on the hosted page instead.
Either way, exchanging the code for a token and renewing it is on us: the seller only sees the marketplace and your app.
allowedMarketplaceslimits the marketplaces offered and the keys ofconnectUrls. Without it, every marketplace available in this environment is offered.redirectUrlis where the seller lands at the end: after the Finish button of the page, or right after the marketplace when they came through aconnectUrlslink. It must behttps.apppicks the marketplace app the seller authorizes:auto(default) uses your own app (BYOK) when you registered one for that marketplace, and ours otherwise;platformalways uses ours. A connection keeps the app it was made with. See BYOK.expiresInMsis the deadline of the links: from 1 to 5 min, default 5 min. Create the session when the seller is about to click, not earlier.
Send an Idempotency-Key: if the response is lost, repeating the request with the same key returns the same links, without creating another session.
?error= codes
| Code | Meaning |
|---|---|
authorization_denied | The seller did not authorize on the marketplace screen. |
authorization_failed | The marketplace refused the code exchange (account without administrator rights, expired code). Create a new session. |
session_unavailable | The session expired, was revoked or completed before the seller finished. |
marketplace_unavailable | The marketplace is not available in this environment or in this session. |
Common errors
400 VALIDATION_ERRORwithdetails.unavailable: a requested marketplace is not available in this environment.400 VALIDATION_ERRORwithdetails.fieldset toredirectUrl: theredirectUrlis nothttps.400 VALIDATION_ERRORwithoutdetails:expiresInMsoutside 1 to 5 min.404 NOT_FOUND: the seller in the path does not exist or belongs to another account.
api_keyAuthorizationBearer <token>API key (mk_...)
id*stringIdentifier of the resource, as returned by the API.
^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$uuidIdempotency-Key?stringOptional. A unique value (for example a UUID), 1 to 255 characters, that makes the request safe to retry: repeating it with the same body within 24h returns the original response with Idempotency-Replayed: true instead of running the operation again. Scoped to your account. Reusing it with a different body returns 409.
1 <= length <= 255application/json- body
allowedMarketplaces?array<>Optional. Marketplaces the page offers, at least one and no repeats. Omit it to offer every marketplace available in this environment; one that is not available returns 400.
1 <= itemsredirectUrl?|Optional. An https URL, up to 2048 characters, where the seller lands at the end: the Finish button of the hosted page sends them there, and so does the marketplace callback when the seller came through one of the connectUrls (with ?connected=<marketplace> or ?error=<code> appended). The contract accepts http too, for development and e2e, but the API refuses a non-https URL outside development. Omit it or send null and the page just thanks them.
urilength <= 2048app?stringOptional. Which marketplace app the seller authorizes. auto (default): your own app when you registered one for that marketplace in the dashboard, ours otherwise. platform: always ours, even when you have your own. A connection keeps the app it was made with for its whole life.
"auto""auto""platform"expiresInMs?integerOptional. How long the page and the connectUrls work, in milliseconds: from 60000 (1 min) to 300000 (5 min). Defaults to 300000 (5 min).
60000 <= value <= 300000300000The link session was created. The body carries url, the hosted page to send to the seller, and connectUrls, one link per marketplace to put behind your own button; both show up only here.
application/json- response
The new link session, with the URL of its hosted page and the per-marketplace connect links.
id*stringOpaque unique identifier of the link session, generated by the API. Use it in the /v1/link-sessions/{id} routes.
^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$uuidsellerId*stringThe seller who connects through this session.
^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$uuidstatus*stringState of the session. pending: open and within its deadline. completed: the seller clicked Finish. expired: expiresAt passed before that. revoked: you revoked it.
"pending""completed""expired""revoked"allowedMarketplaces*array<>Marketplaces the hosted page offers.
app*stringThe app choice made when the session was created: auto or platform.
"auto""platform"redirectUrl*|Where the seller lands at the end: after Finish on the hosted page, or right after the marketplace when they came through a connectUrls link. null when the page just thanks them.
connectionIds*array<>Connections made, or made again, through this session.
expiresAt*stringWhen the hosted page stops working, in ISO-8601 (UTC).
^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z))$date-timecompletedAt*|When the seller clicked Finish, in ISO-8601 (UTC). null before that.
^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z))$date-timecreatedAt*stringWhen the session was created, in ISO-8601 (UTC).
^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z))$date-timeurl*stringThe hosted page to send to the seller. It shows up only in this response (and in the replay of the same Idempotency-Key): we keep only a hash of it.
uriconnectUrls*One link per marketplace in allowedMarketplaces, to put behind your own "Connect" button instead of sending the seller to the hosted page. Opening it takes the seller straight to the marketplace consent screen; after authorizing, they land on your redirectUrl with ?connected=<marketplace> (or ?error=<code>), never on our page. Without a redirectUrl they land on the hosted page instead. Same deadline as url; shows up only in this response.
curl -X POST "https://example.com/v1/sellers/3d1c8a52-7f0e-4b0a-8a65-9c1b2f6d7e01/link-sessions" \ -H "Content-Type: application/json" \ -d '{ "allowedMarketplaces": [ "mercadolivre" ], "redirectUrl": "https://your-app.com/connected" }'{ "id": "5b2f0c1e-8d3a-4f6b-9c21-7e4d3a2b1c00", "sellerId": "3d1c8a52-7f0e-4b0a-8a65-9c1b2f6d7e01", "status": "pending", "allowedMarketplaces": [ "mercadolivre" ], "app": "auto", "redirectUrl": "https://your-app.com/connected", "connectionIds": [], "expiresAt": "2026-10-06T14:45:00.000Z", "completedAt": null, "createdAt": "2026-10-06T14:30:00.000Z", "url": "https://marketapi.shop/connect/Zq3kR8vN2xLm5pT7wY1aB4cD6eF9gH0jK2lM4nP6qRs", "connectUrls": { "mercadolivre": "https://api.marketapi.shop/connect/Zq3kR8vN2xLm5pT7wY1aB4cD6eF9gH0jK2lM4nP6qRs/mercadolivre/start?return=client" }}