API reference
The REST operations an agent uses, the usage limits and every error code.
Base URL:
https://agents.avanzafibra.com/ordersMCP tool order_createCreates an order on behalf of a customer.
Requires orders:write
- The server RECALCULATES the total. The amount you send is a check, never the source of truth.
- If the total does not match the calculated one, it answers PRICE_MISMATCH and creates nothing.
- conditions.userConfirmedAt is required: the instant the CUSTOMER confirmed the conditions (ISO 8601, not in the future, at most 7 days old). Without it: ORDER_USER_CONFIRMATION_REQUIRED.
- paymentRef is required, just as the web checkout requires the IBAN: without it, PAYMENT_REF_REQUIRED. Never send customer.iban: AGENT_RAW_IBAN_NOT_ALLOWED. See "Payments without an IBAN".
- The idempotency-key header is optional but recommended: without it the order is still created, with no protection against a retry.
- A retry with the same key returns the original order with 200 and the Idempotency-Replayed: true header. Over MCP, the response always includes replay (boolean) and, when it is true, replayNote explains (in Spanish) that nothing new was created.
/draftsMCP tool draft_createLeaves a configured draft and returns the customer's signed link (72 h).
Requires drafts:write
- orders:write also opens it. The draft is the step before secure payment: payment_link_create takes it by draftId.
/payment-linksMCP tool payment_link_createCreates the secure link (30 minutes) where the CUSTOMER types their IBAN. You never see it.
Requires orders:write
- Pass exactly one of draftId (a draft created by your same credential) or quote (configuration, network, packId, isEmpresa).
- collectPersonalData=true makes the link also collect name, ID number, email and phone: it is the recommended flow.
/payment-links/{linkId}/statusMCP tool payment_link_statuspending, completed or expired. On completed it returns paymentRef, the masked IBAN and the initials.
Requires orders:write
- You only see your own links: any other answers 404.
/agent/payment-credentialsREST only Delegated tokenization, server to server: an IBAN and holder in exchange for a paymentRef.
Requires payment:tokenize · Operation payment_credential_tokenize
- It is NOT an MCP tool and the MCP rejects any IBAN in its arguments.
- Body: iban, holderName, bindTo ({ draftId } or { quoteFingerprint }) and ttlSec (maximum 1800).
/orders/{orderId}REST only Returns the order. Requires ?token= with the order's accessToken.
Requires orders:write · Operation order_get
- 404 if the token does not belong to the order.
/orders/{orderId}/statusMCP tool order_status_getOrder progress, without personal data.
Requires orders:write
- Returns only orderId, status and updatedAt (plus installationStatus when it exists).
- There is no anonymous access: it requires an agent credential.
/productsMCP tool products_listThe full catalog: fibre, mobile, TV, landline, alarms and packs.
Public, no credential needed
- It is the same list that feeds the website. Load it once and reuse it.
/products/{id}MCP tool product_getOne product by identifier.
Public, no credential needed
/pricing/calculateMCP tool pricing_calculateA quote for a configuration: the pricing engine, exactly as on the website.
Public, no credential needed
- The total it returns is the one POST /orders will expect to receive.
| Limit | Value | Detail |
|---|---|---|
| Orders per day | 50 | Per credential label, in a UTC calendar day. Fixed window aligned to midnight. |
| Reads per minute | 600 | Per credential label. Fixed window aligned to the minute. |
| Order status | 120 / min | The status endpoint's own limit, on top of the previous one. |
| Messages per JSON-RPC batch (MCP) | 20 | A batch with more messages is rejected as a whole. |
| Payment links per hour | 30 | Per credential label. Each link lasts 30 minutes at most. |
| Tokenizations per hour | 60 | Per credential label that holds payment:tokenize. |
Limits apply per credential label. They never count the anonymous or personal funnel.
Over a limit, the API answers 429 with AGENT_RATE_LIMITED. You have exceeded your credential limit. There is no effect: the request is rejected before the handler, with no order and no idempotency row. Respect Retry-After.
Every error has a code. The Retry column says whether repeating the same request can ever succeed.
Retry only what can be retried
PRICE_MISMATCH, IDEMPOTENCY_KEY_REUSED and the 4xx validation errors do not improve when repeated: they give the same result. AGENT_RATE_LIMITED, 5xx responses and network errors do make sense to retry.
| Code | Meaning | Retry |
|---|---|---|
PRICE_MISMATCH | The total you sent does not match the one the server calculates. No order is created. | No |
IDEMPOTENCY_KEY_EXPIRED | The key is more than 24 hours old. Nothing was created with it: generate a new key for the SAME cart. | Yes |
IDEMPOTENCY_KEY_REUSED | An order may already exist with that key and different data. Do not regenerate the key: you would create the duplicate that idempotency prevents. | No |
ORDER_USER_CONFIRMATION_REQUIRED | conditions.userConfirmedAt is missing. Nothing is created. Ask the customer to confirm the conditions and resend with that instant (ISO 8601, not in the future, at most 7 days old). | No |
PAYMENT_REF_REQUIRED | An agent order requires paymentRef, just as the web checkout requires the IBAN. Create a payment link, wait for completed and resend with the reference. | No |
AGENT_RAW_IBAN_NOT_ALLOWED | The order carries a raw IBAN. It is rejected without being stored or logged. Remove it and use paymentRef. | No |
PAYMENT_REF_INVALID | The reference does not exist or is not yours. The answer is the same for both cases, on purpose. | No |
PAYMENT_REF_EXPIRED | The reference has expired. Create a new link: the customer has to type their IBAN again. | No |
PAYMENT_REF_ALREADY_REDEEMED | The reference has already backed an order. It is single-use. If this is a retry of that same order, repeat it with the same idempotency-key and you will receive the original. | No |
PAYMENT_REF_QUOTE_MISMATCH | The order does not match the quote or draft the reference was bound to, or the amounts the customer saw. Create another link for the correct order. | No |
PAYMENT_REF_CUSTOMER_MISMATCH | The customer data in the order is not what the customer typed in the link. Send customer empty or with the same data. | No |
PAYMENT_HOLDER_MISMATCH | The account holder shares no surname with the customer (sharing only the first name is not enough); for a company, the holder matches neither the company name nor the contact person (generic words such as CONSTRUCCIONES, SERVICIOS or GRUPO do not count). On the third refusal with the same reference, it is revoked (PAYMENT_REF_REVOKED): names cannot be guessed. Another account is needed. | No |
PAYMENT_HOLDER_REQUIRED | The order does not name the contracting person (first name AND surnames are needed; for a company, the company name is enough), so the holder cannot be checked. If the link did not collect personal data, send them in customer; if it did, they are taken from the link. | No |
PAYMENT_REF_BINDING_MISMATCH | The order is not the configuration (draft or quote) the reference was bound to. Create another link for the correct order. | No |
PAYMENT_REF_REVOKED | The reference was revoked and can no longer be used, for example after three holder refusals (PAYMENT_HOLDER_MISMATCH). Create a new link. | No |
AGENT_PAYMENTS_DISABLED | Agent payments are not enabled in this environment. There are no links or references and, while they stay off, order_create does not require paymentRef. | No |
PAYMENT_LINK_ALREADY_COMPLETED | The customer has already completed this link. Call payment_link_status and use the paymentRef it returns; you do not need another link. | No |
PAYMENT_IBAN_INVALID | The IBAN the customer typed is not valid (format, country, length or check digits). The customer sees it on their page with the attempts they have left; after five, the link locks (PAYMENT_LINK_LOCKED). | No |
PAYMENT_PERSONAL_DATA_INVALID | The personal data the customer typed in the link is not valid (for example, the ID number or NIE). They fix it themselves on the same page. | No |
PAYMENT_LINK_QUOTE_UNAVAILABLE | The link's configuration cannot be quoted (for example, no coverage or a discontinued product). Fix the configuration. | No |
PAYMENT_LINK_DRAFT_NOT_FOUND | The draft does not exist or was not created by your credential. A link can only be created on your own drafts. | No |
PAYMENT_SECRET_UNREADABLE | The account stored for that reference cannot be read (an incident on our side, not yours). Create a new link; if it happens again, let us know. | No |
PAYMENT_LINK_NOT_FOUND | The link does not exist or does not belong to your credential. | No |
PAYMENT_LINK_EXPIRED | The link has expired (30 minutes). Create another. | No |
PAYMENT_LINK_LOCKED | The link locked after several wrong IBANs. Create another. | No |
PAYMENT_RATE_LIMITED | Too many links or tokenizations per hour for your credential. Respect Retry-After. | Yes |
ANONYMOUS_RATE_LIMITED | MCP only, and only without a credential. It has two variants: the per-client cap (you have used up your public reads) and the shared budget of one tool across all anonymous callers ("too many calls without a credential to this tool, from all anonymous callers together"). Either way the response says how many seconds to wait. With a credential, neither applies. | Yes |
AGENT_RATE_LIMITED | You have exceeded your credential limit. There is no effect: the request is rejected before the handler, with no order and no idempotency row. Respect Retry-After. | Yes |
Do not trust the total you calculate
The authoritative amount is the one the server sets. An agent that builds its own price and sends it as truth receives PRICE_MISMATCH, and that is the correct behavior.
The complete contract, with schemas and an interactive console, is the OpenAPI specification.