Skip to content

Build with a coding agent

If you build with a coding agent, give it the prompt on this page. It makes the agent read the MarsX documentation first, build only the route your connection uses, and prove each part against the sandbox. You still run the human steps at the end.

The prompt points the agent at two sources of truth: the full text of this site, at /llms-full.txt, and the contract, /openapi.yaml. The agent reads both before it writes code. If you want a plain-text copy of the prompt, it is at /agent-prompt.txt. The site also publishes /llms.txt as an index for agents.

Start the agent in an empty project folder. If MarsX has not yet sent your sandbox details, the prompt tells the agent to read, plan and stop.

  • Read the documentation and the contract in full before it writes code, and ask you before it assumes anything they do not settle.
  • Ask which route your connection uses (API push, the shared sheet or the AI agent, MCP). MarsX sets it, and your onboarding pack states it. Then build only that route.
  • For push: build the sender that calls POST /v1/sources/{connection}/events, and, only if you want the optional safety net, the four endpoints you may host: the token URL, GET /v1/changes, GET /v1/privacy-events and GET /v1/leads/{partner_lead_id}.
  • For the shared sheet: build only the automation you ask for, if you want to automate writing the rows.
  • For the AI agent route: connect your agent to the MCP endpoint with an events:write token and use the six tools. See AI agent (MCP).
  • Follow the field rules and the allowed values exactly.
  • Sign with HMAC v1 only, and reproduce the test vector before it sends anything.
  • Refuse any URL that is not https before it attaches credentials or data, and treat a 3xx as a failure without following it.
  • Treat only 202 as confirmation. Retry with the same webhook-id and the same body (the envelope timestamp included), and a fresh webhook-timestamp and signature.
  • Send each withdrawal and erasure at once.
  • Build and test against the sandbox first, with invented data only. It keeps the base URL, connection reference and signing secret in configuration, so going live is a configuration change.
  • Read secrets from environment variables, and never log them or customer data.

Using an AI coding agent?

Paste this prompt into your agent. It points the agent at this documentation and sets the rules for the whole job. You can also read it as plain text at /agent-prompt.txt.

The sandbox (api-sandbox.marsx.media) opens when MarsX sends your connection details. The live address (api.marsx.media) opens at go-live.

Read the prompt
You are helping us build our side of the MarsX Lead Intake API v1, so that our customer enquiries reach Concour. Before you write any code, read https://docs.marsx.media/llms-full.txt and https://docs.marsx.media/openapi.yaml in full. They are the only source of truth. Ask me before you assume anything they do not settle. If we have not yet received sandbox details from MarsX, stop after reading the documents and planning the work.

Scope. First ask me which route our connection uses: API push, the shared sheet or the AI agent (MCP) route. MarsX sets it, and our onboarding pack states it. Then build only that route:
(1) API push: the sender that calls POST /v1/sources/{connection}/events, and, only if we choose the optional safety net, the four endpoints we may host: the OAuth token URL, GET /v1/changes, GET /v1/privacy-events and GET /v1/leads/{partner_lead_id}. We do not need them to go live. If we host them, MarsX reads those four every 15 minutes. The status read is optional.
(2) Shared-sheet automation, only if we are on the shared sheet and want to automate it: one whole row per call, spreadsheets.values.append on Leads!A:AQ with RAW (columns AK and AL stay empty, AM to AQ are the five optional extras), the first empty row below the filled rows (row 7 on a new sheet), a higher source_revision for each change, and the MarsX status column for results.
(3) AI agent (MCP), only if our own AI agent sends the leads: connect it to https://api-sandbox.marsx.media/mcp with an OAuth client credentials token of scope events:write from /oauth/token, and use the six tools exactly as the AI agent (MCP) page says. The four endpoints of (1) stay optional.

Rules that never change:
- Obey the field rules and the allowed values exactly, including the ten source_channel values and the fields required from contract version 1.3: phone, email, model_interest, test_drive_requested and enquiry_notes, plus the location, which from contract version 1.9 is customer_city or preferred_dealer_code, either one alone and both accepted. Contract version 1.5 adds five optional extras (customer_address, customer_gps, lead_score, creative_label, staff_notes): send them when you can and leave them out when unknown, with no not-known value. Contract version 1.7.0 gives every text field a maximum length (maxLength in each tool's input schema) and refuses control characters other than tab, line feed and carriage return: never send a value longer than its limit. Contract version 1.8.0: send one JSON-RPC request for each MCP call and never a batch, which MarsX refuses with the error -32600; send every privacy request at once, and if the status answers queued with the reason clearing_awaiting_confirmation or clearing_held_for_investigation, do not send the request again. Contract version 1.4 also requires campaign, and model_interest is never not_specified. Where the data is genuinely missing, send the not-known value (not_provided for email, not_specified for preferred_dealer_code and campaign, unknown for test_drive_requested, none for enquiry_notes). model_interest and customer_city always need a real value. Never invent a value.
- Sign with HMAC v1 only, as the Sign requests page says. Reproduce its test vector before you send anything.
- Refuse any URL that is not https before you attach credentials or data. Do not follow redirects. Treat a 3xx as a failure.
- Only a 202 confirms that MarsX has an event. Retry with the same webhook-id and the same body (the envelope timestamp included), a fresh webhook-timestamp and a fresh signature, on the schedule on the Responses and retries page. 400, 401, 404, 409, 413 and 415 are not retried on that schedule: fix the cause, then send the event again with a fresh webhook-timestamp and signature. A 409 means the webhook-id was already used for a different event, so send that event with a new webhook-id. Put at most 4 signatures in webhook-signature.
- Send each withdrawal and erasure at once. Never batch it and never hold it behind another event.
- Build and test against the sandbox first, https://api-sandbox.marsx.media, with invented data only. Keep the base URL, connection reference and signing secret in configuration, so going live is a configuration change.
- Read secrets from environment variables. Never put them in code or logs, and never log customer data.

You are done when you have shown me: (1) the test vector reproduced; (2) every step of the sandbox test page run, with the results it gives; (3) the Postman collection passing, if we use it; (4) if we host them, each of the four endpoints validated against openapi.yaml, with the cases on the Changes and privacy events page covered: an empty feed, a malformed cursor, an expired cursor (410), and a restricted or erased lead.

Run the Postman collection with npx newman if it is available. If not, tell me to run it in Postman.

MarsX's endpoint tests (R1 to R5), creating the test key in the sandbox console, and going live are human steps after you finish. Do not go live. A person requests the live key, MarsX approves it, and a person sends the first live lead. Support is support@marsx.media, Monday to Saturday 08:00 to 20:00 WIB, with a reply within 1 business day.

The prompt asks the agent to show you:

  1. The test vector reproduced. See Sign requests.
  2. Every step of the sandbox test page run, with the results it gives. See Test in the sandbox.
  3. The Postman collection passing, if you use it. The agent runs it with npx newman when it is available. Otherwise it tells you to run it in Postman. See Test with Postman.
  4. If you host them, each of your four endpoints checked against openapi.yaml, with these cases covered: an empty feed, a malformed cursor, an expired cursor (410), and a restricted or erased lead. See Changes and privacy events.

Check these results yourself. Do not accept a summary without the output.

The agent stops there. These are human steps:

  • MarsX’s endpoint tests R1 to R5, only if you host the endpoints. See Test your endpoints.
  • Making your test key in the sandbox console (see Get sandbox access), and entering the client ID and secret of the read client under Your endpoints.
  • Going live. A person requests the live key, MarsX approves it, and a person sends the first live lead. See Go live.