{
  "openapi": "3.1.0",
  "info": {
    "title": "GCC Tender API",
    "version": "2.0.0",
    "summary": "Open UAE federal government tenders (Ministry of Finance) as JSON, a JSON Feed and an MCP server.",
    "description": "Normalised listing facts for open government tenders, refreshed daily, each with a link to the official notice and an attribution string to display. The official notice prevails. Plans: Starter $49/mo: 30 req/min, 10,000 req/month; Pro $149/mo: 120 req/min, 100,000 req/month, MCP; Business $399/mo: 300 req/min, 500,000 req/month, MCP. Rate-limit state is returned in X-RateLimit-* and X-Quota-* headers.",
    "termsOfService": "https://gcctenderalerts.com/terms",
    "contact": {
      "name": "GCC Tender Alerts support",
      "email": "support@gcctenderalerts.com",
      "url": "https://gcctenderalerts.com/api"
    }
  },
  "servers": [
    {
      "url": "https://gcctenderalerts.com"
    }
  ],
  "security": [
    {
      "bearerAuth": []
    },
    {
      "apiKeyHeader": []
    }
  ],
  "tags": [
    {
      "name": "Tenders"
    },
    {
      "name": "Account"
    },
    {
      "name": "Keys"
    },
    {
      "name": "Meta"
    }
  ],
  "paths": {
    "/api/v1/tenders": {
      "get": {
        "tags": [
          "Tenders"
        ],
        "operationId": "searchTenders",
        "summary": "Search open tenders",
        "description": "Open tenders, newest first.",
        "parameters": [
          {
            "name": "q",
            "in": "query",
            "description": "Free text matched against title, buyer and reference.",
            "schema": {
              "type": "string"
            },
            "example": "cctv"
          },
          {
            "name": "source",
            "in": "query",
            "description": "Portal id.",
            "schema": {
              "type": "string",
              "enum": [
                "mof"
              ]
            }
          },
          {
            "name": "country",
            "in": "query",
            "description": "Country code.",
            "schema": {
              "type": "string",
              "enum": [
                "UAE"
              ]
            }
          },
          {
            "name": "category",
            "in": "query",
            "description": "Category name (exact, case-insensitive), e.g. \"IT & software\".",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "closing_within_days",
            "in": "query",
            "description": "Only tenders closing within N days.",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 365
            }
          },
          {
            "name": "limit",
            "in": "query",
            "description": "Max results (default 50).",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 50
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Matching tenders",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "count",
                    "data"
                  ],
                  "properties": {
                    "count": {
                      "type": "integer"
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Tender"
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/api/v1/tenders/{id}": {
      "get": {
        "tags": [
          "Tenders"
        ],
        "operationId": "getTender",
        "summary": "Get one open tender",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "example": "mof:12623",
            "description": "The id from a search result, or source:reference (e.g. mof:12623)."
          }
        ],
        "responses": {
          "200": {
            "description": "The tender",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/Tender"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/api/v1/feed.json": {
      "get": {
        "tags": [
          "Tenders"
        ],
        "operationId": "tenderFeed",
        "summary": "JSON Feed 1.1 of open tenders",
        "description": "Same filters as /api/v1/tenders, as a JSON Feed for feed readers and automation tools (Zapier, Make, n8n). The key may also be passed as ?key= for feed readers.",
        "parameters": [
          {
            "name": "q",
            "in": "query",
            "description": "Free text matched against title, buyer and reference.",
            "schema": {
              "type": "string"
            },
            "example": "cctv"
          },
          {
            "name": "source",
            "in": "query",
            "description": "Portal id.",
            "schema": {
              "type": "string",
              "enum": [
                "mof"
              ]
            }
          },
          {
            "name": "country",
            "in": "query",
            "description": "Country code.",
            "schema": {
              "type": "string",
              "enum": [
                "UAE"
              ]
            }
          },
          {
            "name": "category",
            "in": "query",
            "description": "Category name (exact, case-insensitive), e.g. \"IT & software\".",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "closing_within_days",
            "in": "query",
            "description": "Only tenders closing within N days.",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 365
            }
          },
          {
            "name": "limit",
            "in": "query",
            "description": "Max results (default 50).",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 50
            }
          },
          {
            "name": "key",
            "in": "query",
            "description": "API key (for clients that cannot send headers).",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "JSON Feed",
            "content": {
              "application/feed+json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/api/v1/sources": {
      "get": {
        "tags": [
          "Meta"
        ],
        "operationId": "listSources",
        "summary": "Covered portals and attribution",
        "responses": {
          "200": {
            "description": "Sources",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/api/v1/me": {
      "get": {
        "tags": [
          "Account"
        ],
        "operationId": "me",
        "summary": "Your plan, key and limits",
        "responses": {
          "200": {
            "description": "Account",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/api/v1/usage": {
      "get": {
        "tags": [
          "Account"
        ],
        "operationId": "usage",
        "summary": "Requests this month and per day",
        "responses": {
          "200": {
            "description": "Usage",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Usage"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/api/v1/keys": {
      "get": {
        "tags": [
          "Keys"
        ],
        "operationId": "listKeys",
        "summary": "List your API keys (prefix, status, 30-day usage)",
        "responses": {
          "200": {
            "description": "Keys",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Key"
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      },
      "post": {
        "tags": [
          "Keys"
        ],
        "operationId": "createKey",
        "summary": "Create another key (up to your plan limit)",
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "label": {
                    "type": "string",
                    "maxLength": 60
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "New key; the secret is returned once",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/Key"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "key": {
                          "type": "string"
                        }
                      }
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "409": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/api/v1/keys/{id}": {
      "delete": {
        "tags": [
          "Keys"
        ],
        "operationId": "revokeKey",
        "summary": "Revoke a key immediately",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^key_[0-9a-f]{16}$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Revoked"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "404": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    },
    "/api/v1/plans": {
      "get": {
        "tags": [
          "Meta"
        ],
        "operationId": "listPlans",
        "summary": "Plans and limits (no auth)",
        "security": [],
        "responses": {
          "200": {
            "description": "Plans"
          }
        }
      }
    },
    "/mcp": {
      "post": {
        "tags": [
          "Tenders"
        ],
        "operationId": "mcp",
        "summary": "MCP server (Streamable HTTP, JSON-RPC 2.0); Pro and Business",
        "description": "Tools: search_tenders, get_tender, list_sources.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "JSON-RPC response"
          },
          "401": {
            "$ref": "#/components/responses/Error"
          },
          "403": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/RateLimited"
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "bearerAuth": {
        "type": "http",
        "scheme": "bearer",
        "description": "API key: Authorization: Bearer gta_live_…"
      },
      "apiKeyHeader": {
        "type": "apiKey",
        "in": "header",
        "name": "X-API-Key"
      }
    },
    "schemas": {
      "Tender": {
        "type": "object",
        "required": [
          "id",
          "source",
          "title",
          "url",
          "attribution"
        ],
        "properties": {
          "id": {
            "type": "string",
            "example": "mof_dpji6o_bW9mfDEyNjgwfNiq"
          },
          "source": {
            "type": "string",
            "enum": [
              "mof"
            ]
          },
          "portal": {
            "type": "string",
            "example": "UAE Federal (Ministry of Finance)"
          },
          "country": {
            "type": "string",
            "example": "UAE"
          },
          "reference": {
            "type": "string",
            "example": "12623"
          },
          "title": {
            "type": "string",
            "example": "eInvoicing_ASP Selection_RFP_7th Oct 2026"
          },
          "buyer": {
            "type": "string",
            "example": "Other Federal Spending"
          },
          "category": {
            "type": "string",
            "description": "Our classification from the title.",
            "example": "IT & software"
          },
          "closes_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "closes_at_local": {
            "type": "string",
            "description": "Closing time as published (UAE time)."
          },
          "first_seen_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "When we first saw the tender."
          },
          "url": {
            "type": "string",
            "format": "uri",
            "description": "Official notice."
          },
          "attribution": {
            "type": "string",
            "description": "Show this with the data."
          }
        }
      },
      "Key": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "prefix": {
            "type": "string"
          },
          "plan": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "active",
              "inactive",
              "revoked"
            ]
          },
          "label": {
            "type": "string"
          },
          "created_at": {
            "type": "integer"
          },
          "revoked_at": {
            "type": [
              "integer",
              "null"
            ]
          },
          "usage_30d": {
            "type": "integer"
          }
        }
      },
      "Usage": {
        "type": "object",
        "properties": {
          "month": {
            "type": "string",
            "example": "2026-10"
          },
          "requests": {
            "type": "integer"
          },
          "daily": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "day": {
                  "type": "string"
                },
                "n": {
                  "type": "integer"
                }
              }
            }
          }
        }
      },
      "Error": {
        "type": "object",
        "required": [
          "error"
        ],
        "properties": {
          "error": {
            "type": "object",
            "required": [
              "code",
              "message"
            ],
            "properties": {
              "code": {
                "type": "string"
              },
              "message": {
                "type": "string"
              },
              "docs": {
                "type": "string"
              }
            }
          }
        }
      }
    },
    "responses": {
      "Error": {
        "description": "Error",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "RateLimited": {
        "description": "Rate limit or monthly quota exceeded",
        "headers": {
          "Retry-After": {
            "schema": {
              "type": "integer"
            }
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      }
    }
  }
}