# /marchesma/purchase_orders/search

`POST /api/marchesma/purchase_orders/search`

Price: 5 credits

Search Moroccan below-threshold purchase orders (avis d'achat sur bon de commande) on the Portail Marocain des Marchés Publics (marchespublics.gov.ma) by keyword, reference, subject, buyer, place of execution, category, nature of service, publication window and quote deadline window. Returns one row per purchase order: id, reference, subject, buyer, status, quote deadline and place of execution.

## How to use it

With no filter only purchase orders still open for quotes are listed; any filter searches the whole archive. Pass `id` to marchesma/purchase_orders for the items; awards are in marchesma/purchase_order_results/search.

## Parameters

- `access-token` (string, required)

## Request body

- `timeout` (integer) — Max scrapping execution timeout (in seconds) (default: 300; min: 20; max: 1500)
- `query` (string, nullable) — Keyword to match in the purchase order (examples: "informatique"; minLength: 1)
- `reference` (string, nullable) — Reference of the purchase order (examples: "6/2026"; minLength: 1)
- `subject` (string, nullable) — Words to match in the subject (examples: "fournitures de bureau"; minLength: 1)
- `buyer_id` (string, nullable) — Buyer id from marchesma/buyers/search (examples: "17-z7x"; pattern: ^\d+-[a-z0-9]+$)
- `execution_location` (string, nullable) — Place of execution (examples: "RABAT"; minLength: 1)
- `category` (string, nullable) — Main category of the purchase (one of: "travaux", "fournitures", "services")
- `service_nature` (string, nullable) — Nature of the service bought (one of: "travaux_amenagement_espaces_verts_avec_sans_fourni", "travaux_amenagement_entretien_installations_milita", "travaux_amenagement_entretien_reparation_batiments", "travaux_amenagement_entretien_reparation_logements", "travaux_amenagement_entretien_reparation_ouvrages", "travaux_equipement_renforcement_postes_mt_bt_resea", "travaux_installation_materiels_divers", "travaux_branchement_extension_reseau_eau_potable_e", "travaux_raccordement_reseau_assainissement_curage", "achat_affiches_articles_publicitaires", "achat_animaux", "achat_articles_correction_vue_articles_personnes_b", "achat_articles_droguerie_quincaillerie_electricite", "achat_habillement", "achat_badges_medailles_effigies_fanions_drapeaux_p", "achat_carburants_lubrifiants", "achat_cartables_livres_manuels_fournitures_scolair", "achat_cartes_geographiques_topographiques_geologiq", "achat_fournitures_bureau_documentation", "achat_materiaux_construction", "achat_materiel_audiovisuel_sonore_mise_lumiere", "achat_materiel_eclairage_public", "achat_materiel_diagnostic_recherche_detection_sign", "achat_materiel_navigation_transmission", "achat_materiel_securite_lutte_contre_incendie", "achat_materiel_transport_citernes_engins", "achat_materiel_electrique_groupes_electrogenes_ele", "achat_materiel_equipement_plongee_sous_marine", "achat_materiel_mobilier_bureau", "achat_materiel_technique_logiciels_materiel_inform", "achat_materiel_cables_coffrets_distribution_poteau", "achat_materiels_articles_sport_literie_linge_couch", "achat_matieres_premieres_laboratoire_enseignement", "achat_matieres_premieres_textile_cuir_reliure_docu", "achat_medicaments", "achat_mobilier_enseignement_laboratoire_exposition", "achat_papeteries_imprimes", "achat_pieces_rechange_pneumatiques_vehicules_engin", "achat_pieces_rechange_equipements_medicotechniques", "achat_pieces_rechange_materiel_technique_informati", "achat_produits_alimentaires_usage_animal", "achat_produits_alimentaires_usage_humain", "achat_produits_chimiques_laboratoire_pesticides_in", "achat_produits_impression_reproduction_photographi", "achat_produits_pharmaceutiques_non_medicamenteux_g", "achat_produits_traitement_eau_potable", "achat_produits_veterinaires_produits_elevage_aquac", "fourniture_alevins_naissains_boutures_algues_anima", "fourniture_engrais_graines_plantes_plants_portoirs", "fourniture_equipements_medico_techniques_pieces_re", "fourniture_combustibles_produits_chauffage", "fourniture_films_produits_radiologiques", "fourniture_fongibles_medicaux_fils_chirurgicaux", "fourniture_instrumentation_medicotechnique", "fourniture_protheses_ortheses", "fourniture_sacs_produits_emballage", "fourniture_verrerie_petit_materiel_outillage_labor", "fourniture_consommables_dentaires", "fournitures_pieces_rechange_materiel_technique_inf", "fournitures_produits_entretien_nettoyage", "fournitures_inauguration_pose_premieres_pierres", "fournitures_traitement_conservation_preventive_arc", "achat_piges", "achat_developpement_production_coproduction_progra", "collecte_produits_biologiques_sanguins", "controle_expertise_techniques", "direction_animation_participation_artistes_intelle", "entretien_maintenance_logiciels_progiciels", "entretien_maintenance_equipements_informatique", "entretien_reparation_materiel_technique_mobilier_i", "entretien_depoussierage_traitement_chimique_archiv", "etudes_conseil_formation", "location_engins_moyens_transport_materiels_materia", "location_camions_citernes", "location_materiel_mobilier", "location_moyens_transport_personnes_voitures_autoc", "location_salles_stands_mobilier_exposition", "montage_demontage_materiel_hydraulique_electromeca", "organisation_manifestations_culturelles_scientifiq", "prestation_jardinage_gardiennage_nettoyage", "prestations_assistance_conseil_technique_juridique", "prestations_entretien_vehicules_engins", "prestations_entretien_reequilibrage_etalonnage_rep", "prestations_impression_tirage_reproduction_photogr", "prestations_centres_appels_telemarketing_tele_serv", "prestations_collecte_traitement_dechets_hospitalie", "prestations_collecte_traitement_blanchissage_linge", "prestations_controle_points_comptage", "prestations_controle_analyse_echantillons_preleves", "prestations_demenagement", "prestations_desinsectisation_deratisation_prestati", "prestations_mise_place_outils_gestion_technique_de", "prestations_publicite_sensibilisation_supports_mul", "prestations_remise_etat_recharge_extincteurs", "prestations_hotellerie_hebergement_reception_resta", "prestations_geotechniques_laboratoire", "prestations_medicales_hospitalieres_radiologiques", "prestations_topographiques_oceanographiques", "traduction_simultanee_traduction_documents_uvres_l", "transport_acconage_magasinage_transit", "travaux_amenagement_entretien_reparation_batim_101", "travaux_amenagement_entretien_reparation_batim_102", "travaux_amenagement_entretien_reparation_batim_103", "travaux_amenagement_entretien_reparation_ouvra_104", "travaux_entretien_maintenance_reseaux_espaces_vert", "travaux_amenagement_espaces_verts_avec_sans_fo_106", "travaux_installation_materiels_divers_onda", "travaux_degommage_pistes_envol_onda", "travaux_entretien_infrastructures_aeroportuaires_l", "travaux_signaletique_signalisation_onda", "travaux_assainissement_raccordement_reseau_assaini", "travaux_equipement_renforcement_postes_mt_bt_r_112", "travaux_branchement_extension_reseau_eau_potab_113", "achat_articles_relations_publiques_onda", "acquisition_licences_conception_procedures_onda", "animaux_onda", "articles_cuisine_onda", "articles_literie_lingerie_couchage_buanderie_onda", "articles_habillement_personnel_onda", "articles_plomberie_sanitaire_onda", "batteries_onda", "carburants_lubrifiants_onda", "cartes_geographiques_topographiques_geologiques_ph", "fournitures_produits_nettoyage_onda", "documentation_onda", "equipements_protection_individuelle_epi_onda", "fourniture_engrais_graines_plantes_fleurs_plants_p", "fourniture_equipements_medicotechniques_onda", "fourniture_badge_articles_similaires_accessoires_o", "fourniture_materiel_informatique_bureautique_onda", "fournitures_bureau_imprimes_onda", "fournitures_clotures_grillagees_barbeles_securite", "fournitures_composants_electriques_chargeurs_ondul", "fournitures_sacs_produits_emballage_onda", "fournitures_materiel_systeme_teleaffichage_systeme", "fournitures_electriques_onda", "fournitures_materiel_technique_informatique_onda", "achat_cartables_livres_manuels_fournitures_sco_138", "materiaux_construction_onda", "materiel_sonorisation_telephonie_telecommunication", "materiel_transport_onda", "materiel_articles_sport_onda", "materiel_informatique_pieces_rechange_onda", "materiel_medical_unite_medicale_urgence_onda", "materiel_technique_assainissement_onda", "materiels_lutte_contre_incendie_onda", "badges_medailles_effigies_drapeaux_fanions_portrai", "medicaments_onda", "mobilier_aerogare_onda", "mobilier_bureau_onda", "materiel_bureau_onda", "autres_mobiliers_onda", "autres_materiels_onda", "droguerie_outillage_quincaillerie_onda", "fourniture_peinture_ses_produits_accessoires_onda", "pieces_rechange_fournitures_electriques_eclairage", "pieces_rechange_fournitures_climatisation_materiel", "pieces_rechange_fournitures_installations_communic", "pieces_rechange_fournitures_installations_navigati", "pieces_rechange_fournitures_materiel_balisage_onda", "pieces_rechange_equipements_medicotechniques_onda", "pieces_rechange_materiel_technique_onda", "pieces_rechange_fournitures_pneumatiques_vehicules", "produits_alimentaires_usage_humain_animal_onda", "produits_chimiques_laboratoire_pesticides_insectic", "produits_impression_reproduction_photographie_onda", "fourniture_combustibles_produits_chauffage_onda", "produits_lutte_contre_incendie_onda", "produits_pharmaceutiques_non_medicamenteux_article", "systemes_video_surveillance_onda", "mobilier_exposition_onda", "signaletique_signalisation_onda", "articles_electromenager_onda", "fourniture_ateliers_mecaniques_menuiserie_tolerie", "gaz_oxygene_onda", "mobiliers_batiments_caractere_social_onda", "materiels_equipements_batiments_caractere_social_o", "achat_logiciels_onda", "articles_habillement_eleves_aiac_onda", "articles_habillement_actions_sociales_onda", "materiel_article_sport_eleves_aiac_onda", "literies_eleves_aiac_onda", "materiel_manutention_citernes_engins_onda", "materiel_installations_logistiques_onda", "achat_affiches_articles_publicitaires_onda", "materiel_audiovisuel_sonore_mise_lumiere_onda", "materiel_electrique_groupes_electrogenes_electropo", "materiel_cables_coffrets_distribution_poteaux_autr", "animation_colonie_vacances_onda", "capture_animaux_onda", "controle_reglementaire_veille_legale_reglementaire", "degraissage_nettoyage_onda", "elaboration_plan_degagement_servitude_radioelectri", "entretien_reparation_materiel_mobilier_onda", "entretien_reparation_equipements_installation_tech", "entretien_reparation_groupes_electrogene_onduleurs", "entretien_reparation_vehicules_engins_onda", "etalonnage_calibrage_appareils_mesure_onda", "etudes_conseil_onda", "location_engins_moyens_transport_materiels_mat_200", "location_camion_citernes_onda", "location_materiel_mobilier_onda", "location_moyens_transport_personnes_voitures_cars", "location_tentes_chapiteaux_toilettes_mobiles_onda", "montage_demontage_materiel_hydraulique_electro_205", "organisation_manifestations_culturelles_scient_206", "prestation_formation_coaching_onda", "prestation_montage_demontage_pointage_antenne_vhf", "prestation_refection_peinture_pylones_antennes_ava", "prestation_medicale_hospitalieres_brancardage_onda", "prestations_assistance_conseil_onda", "prestations_assistance_recrutement_onda", "prestations_enquete_cadastrale_parcellaire_onda", "prestations_impression_reproduction_photographie_t", "prestations_jardinage_aerogares_batiments_onda", "prestations_nettoyage_onda", "prestations_collecte_dechets_onda", "prestations_interim_onda", "prestations_mesure_analyse_controle_mesure_qualite", "prestations_publicite_onda", "prestations_topographiques_onda", "reparation_maintenance_equipements_techniques_info", "traduction_documents_correspondances_onda", "transport_acconage_magasinage_transit_onda", "visite_technique_vehicules_engins_onda", "prestations_gardiennage_surveillance_onda", "gestion_multiservices_batiments_onda", "audits_onda", "prestations_accreditation_certification_onda", "prestations_centres_appels_onda", "veille_gestion_marque_onda_reseaux_sociaux_onda", "prestations_liees_obtention_un_certificat_signatur", "assistance_administrative_technique_logistique_ref", "prestations_remise_etat_recharge_extincteurs_onda", "travaux_amenagement_espaces_verts_avec_sans_fo_235", "travaux_amenagement_entretien_reparation_batim_236", "travaux_amenagement_entretien_reparation_ouvra_237", "travaux_equipement_renforcement_postes_mt_bt_r_238", "travaux_installation_materiels_divers_ancfcc", "travaux_branchement_extension_reseau_eau_potab_240", "travaux_raccordement_reseau_assainissement_cur_241", "travaux_amenagement_entretien_reparation_batim_242", "achat_affiches_articles_publicitaires_ancfcc", "achat_animaux_ancfcc", "achat_articles_correction_vue_articles_personn_245", "achat_articles_droguerie_quincaillerie_electri_246", "achat_habillement_ancfcc", "achat_badges_medailles_effigies_fanions_drapea_248", "achat_carburants_lubrifiants_ancfcc", "achat_cartables_livres_manuels_fournitures_sco_250", "achat_cartes_geographiques_topographiques_geol_251", "achat_fournitures_bureau_documentation_ancfcc", "achat_materiaux_construction_ancfcc", "achat_materiel_audiovisuel_sonore_mise_lumiere_anc", "achat_materiel_eclairage_public_ancfcc", "achat_materiel_diagnostic_recherche_detection_256", "achat_materiel_navigation_transmission_ancfcc", "achat_materiel_securite_produits_lutte_contre_ince", "achat_materiel_electrique_groupes_electrogenes_259", "achat_materiel_mobilier_bureau_ancfcc", "achat_materiel_technique_logiciels_materiel_in_261", "achat_materiel_cables_coffrets_distribution_po_262", "achat_materiels_articles_sport_literie_linge_c_263", "achat_matieres_premieres_laboratoire_enseignem_264", "achat_matieres_premieres_textile_cuir_reliure_265", "achat_medicaments_ancfcc", "achat_mobilier_enseignement_laboratoire_exposi_267", "achat_papeteries_imprimes_ancfcc", "achat_pieces_rechange_pneumatiques_vehicules_e_269", "achat_pieces_rechange_equipements_medicotechni_270", "achat_pieces_rechange_materiel_technique_infor_271", "achat_produits_alimentaires_usage_animal_ancfcc", "achat_produits_alimentaires_usage_humain_ancfcc", "achat_produits_chimiques_laboratoire_pesticide_274", "achat_produits_impression_reproduction_photogr_275", "achat_produits_pharmaceutiques_non_medicamente_276", "achat_produits_traitement_eau_potable_ancfcc", "cartes_geographiques_topographiques_geologique_278", "detergents_produits_nettoyage_ancfcc", "fourniture_engrais_graines_plantes_plants_port_280", "fourniture_equipements_medicotechniques_pieces_rec", "fourniture_combustibles_produits_chauffage_ancfcc", "fourniture_films_produits_radiologiques_ancfcc", "fourniture_sacs_produits_emballage_ancfcc", "fourniture_verrerie_petit_materiel_outillage_l_285", "fournitures_pieces_rechange_materiel_technique_286", "fournitures_produits_entretien_nettoyage_ancfcc", "fournitures_inauguration_pose_premieres_pierres_an", "fournitures_traitement_conservation_preventive_289", "fournitures_reliure_reprographie_reproduction_phot", "fournitures_electriques_ancfcc", "fournitures_materiel_informatique_technique_ancfcc", "fourniture_pieces_rechange_materiel_imprimerie_anc", "fourniture_pieces_rechange_materiel_cartographique", "fourniture_pieces_rechange_materiel_geodesique_anc", "habillement_ancfcc", "manuels_fournitures_scolaires_enseignement_ancfcc", "materiel_imprimerie_ancfcc", "materiel_geodesique_accessoires_ancfcc", "materiel_cartographique_accessoires_ancfcc", "outillage_quincaillerie_ancfcc", "abonnement_prestations_liees_avions_ancfcc", "actions_communication_relations_publiques_ancfcc", "achat_piges_ancfcc", "controle_expertise_techniques_ancfcc", "direction_animation_participation_artistes_int_306", "entretien_maintenance_equipements_cartographiques", "entretien_maintenance_logiciels_progiciels_ancfcc", "entretien_maintenance_equipements_informatiques_an", "entretien_reparation_materiel_technique_mobili_310", "entretien_depoussierage_traitement_chimique_ar_311", "etudes_conseil_formation_ancfcc", "location_engins_moyens_transport_materiels_mat_313", "location_camions_citernes_ancfcc", "location_materiel_mobilier_ancfcc", "location_moyens_transport_personnes_voitures_a_316", "montage_demontage_materiel_hydraulique_electro_317", "organisation_manifestations_culturelles_scient_318", "prestation_jardinage_gardiennage_nettoyage_interim", "prestations_assistance_conseil_technique_jurid_320", "prestations_entretien_vehicules_engins_ancfcc", "prestations_impression_tirage_reproduction_pho_322", "prestations_centres_appels_telemarketing_tele_323", "prestations_controle_analyse_echantillons_prel_324", "prestations_demenagement_ancfcc", "prestations_desinsectisation_deratisation_pres_326", "prestations_mise_place_outils_gestion_techniqu_327", "prestations_publicite_sensibilisation_supports_328", "prestations_remise_etat_recharge_extincteurs_ancfc", "prestations_geotechniques_laboratoire_ancfcc", "prestations_medicales_hospitalieres_radiologiq_331", "prestations_topographiques_oceanographiques_ancfcc", "transport_acconage_magasinage_transit_ancfcc", "prestations_installation_mise_service_liens_wan_an", "prestations_audit_controle_gestion_ancfcc", "prestations_cartographiques_photogrammetriques_anc", "prestations_geodesiques_ancfcc", "prestations_topographiques_ancfcc", "prestations_flashage_impression_cartographique_anc")
- `published_from` (string, nullable) — Earliest publication date (format: date; examples: "2026-09-01")
- `published_to` (string, nullable) — Latest publication date (format: date; examples: "2026-09-15")
- `deadline_from` (string, nullable) — Earliest quote deadline (format: date; examples: "2026-09-25")
- `deadline_to` (string, nullable) — Latest quote deadline (format: date; examples: "2026-10-05")
- `count` (integer, required) — Max number of purchase orders to return (min: 1; max: 1000)

## Response

### 200 — Successful Response

- `@type` (string) (default: "MarchesmaPurchaseOrderSummary")
- `id` (string, required)
- `reference` (string, nullable)
- `name` (string, nullable)
- `buyer_name` (string, nullable)
- `status` (string, nullable)
- `submission_deadline_at` (integer, nullable)
- `execution_location` (string, nullable)
- `country` (string) (default: "MA")
- `url` (string, required)

## Errors

### 422 — Validation Error

The request body did not validate

What to do: Check the fields against this schema. A URN with the wrong prefix is the most common cause.

- `detail` (array)
  - `loc` (array, required)
  - `msg` (string, required)
  - `type` (string, required)
  - `input` (any)
  - `ctx` (object)

### 408

The request ran past its time limit

What to do: Raise `timeout` in the request body, up to the maximum this endpoint documents. Lowering `count` or turning off the `with_*` flags also helps, because less work finishes sooner.

### 412

The entity was not found, or a precondition failed

What to do: Retrying will not help: either the entity does not exist, or the input points at a different one.

### 429

Too many requests: a rate limit or a usage window is exhausted

What to do: When the response carries an X-Retry-After header, wait that many seconds and retry: the same number is in the body as `detail.retry_after`, and the limit clears once that window passes. The message in the body names the limit that was hit.

### 500

Something broke on our side

What to do: Retrying will not help. If it keeps happening, send us the X-Request-ID from the response headers.

### 529

Rate limit reached, or the endpoint is overloaded

What to do: Wait at least 30 seconds, then retry.

## Response envelope

Success: Array of objects (may be empty if no results)

Error: Error may coexist with partial results if it occurs mid-execution. Check X-Error header and status code.

Every response carries these headers:

- `X-Error` — Error message text (present only on error)
- `X-Request-ID` — Unique request identifier
- `X-Execution-Time` — Execution time in seconds
- `X-Result-Count` — How many records the body carries. 0 means an empty result, which is a normal answer and not by itself an error. A non-zero count can come back together with X-Error when the failure happened partway through — read this header and X-Error independently.
- `X-Total-Available-Results` — How many records exist for this query, when the endpoint can say. On a `dry_run` request this is the answer and the body is empty. It saturates: the endpoint's documented maximum means 'at least that many', any smaller number is exact.
- `X-Warning` — Present when the request body carried keys this endpoint does not document. They were ignored, so any filter you meant to apply through them did not apply. Check the spelling against this schema and retry.
- `X-Retry-After` — Seconds to wait before retrying. Present only on 429.

