{
  "openapi": "3.0.1",
  "info": {
    "title": "SPARQL Query Runner",
    "description": "Point at ANY public SPARQL endpoint (Wikidata, DBpedia, UniProt, government & museum Linked-Open-Data) and run a query over the W3C SPARQL 1.1 Protocol. SELECT flattens to dynamic columns per binding, ASK to a boolean, CONSTRUCT/DESCRIBE to triples. One actor, any knowledge graph. Pay per binding.",
    "version": "0.1",
    "x-build-id": "idXMosBEGPSQHWz9Z"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/datamule~sparql-query-runner/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-datamule-sparql-query-runner",
        "x-openai-isConsequential": false,
        "summary": "Executes an Actor, waits for its completion, and returns Actor's dataset items in response.",
        "tags": [
          "Run Actor"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/inputSchema"
              }
            }
          }
        },
        "parameters": [
          {
            "name": "token",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Enter your Apify token here"
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/acts/datamule~sparql-query-runner/runs": {
      "post": {
        "operationId": "runs-sync-datamule-sparql-query-runner",
        "x-openai-isConsequential": false,
        "summary": "Executes an Actor and returns information about the initiated run in response.",
        "tags": [
          "Run Actor"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/inputSchema"
              }
            }
          }
        },
        "parameters": [
          {
            "name": "token",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Enter your Apify token here"
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/runsResponseSchema"
                }
              }
            }
          }
        }
      }
    },
    "/acts/datamule~sparql-query-runner/run-sync": {
      "post": {
        "operationId": "run-sync-datamule-sparql-query-runner",
        "x-openai-isConsequential": false,
        "summary": "Executes an Actor, waits for completion, and returns the OUTPUT from Key-value store in response.",
        "tags": [
          "Run Actor"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/inputSchema"
              }
            }
          }
        },
        "parameters": [
          {
            "name": "token",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Enter your Apify token here"
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "inputSchema": {
        "type": "object",
        "required": [
          "query"
        ],
        "properties": {
          "endpoint": {
            "title": "SPARQL endpoint URL",
            "type": "string",
            "description": "The URL of ANY public SPARQL endpoint (W3C SPARQL 1.1 Protocol). One actor speaks to all of them — Wikidata (https://query.wikidata.org/sparql), DBpedia (https://dbpedia.org/sparql), UniProt (https://sparql.uniprot.org/sparql), Bio2RDF, EU / national-library / museum Linked-Open-Data, government open-data endpoints, and any self-hosted triplestore. Required unless you use \"Endpoints\" below to run across several. For an auth-gated deployment, add a Bearer token or headers below."
          },
          "endpoints": {
            "title": "Endpoints (run the same query across several)",
            "type": "array",
            "description": "Optional: run the SAME query across multiple SPARQL endpoints (mirrors, or several knowledge graphs at once). Each output row is tagged with its _endpoint. Use this OR the single \"Endpoint\" above (at least one is required). An endpoint that is unreachable, auth-gated, or returns a non-SPARQL body is skipped with a warning and the batch continues.",
            "items": {
              "type": "string"
            }
          },
          "query": {
            "title": "SPARQL query",
            "type": "string",
            "description": "The SPARQL query to run. SELECT and ASK are the primary forms; CONSTRUCT and DESCRIBE are best-effort (emitted as one row per triple via N-Triples). A portable query that works on almost any endpoint: SELECT ?s ?p ?o WHERE { ?s ?p ?o } LIMIT 5. The output COLUMNS of a SELECT are exactly your query's variables, so shape the result by shaping the query."
          },
          "method": {
            "title": "HTTP method",
            "enum": [
              "GET",
              "POST"
            ],
            "type": "string",
            "description": "How to send the query. GET (default) puts the query in the URL — fine for most queries. POST sends it as an application/x-www-form-urlencoded body — use it for queries too long for a URL.",
            "default": "GET"
          },
          "maxRecords": {
            "title": "Max records (global cap)",
            "minimum": 1,
            "type": "integer",
            "description": "A GLOBAL cap on the number of rows emitted across ALL endpoints (each row is one result binding / triple and one billable event). Reached mid-endpoint, the run stops deterministically. Leave empty to emit every binding the query returns — most endpoints also enforce their own server-side LIMIT, and you can add LIMIT to the query itself."
          },
          "userAgent": {
            "title": "User-Agent override",
            "type": "string",
            "description": "Optional override for the request User-Agent. A descriptive User-Agent is sent by default — REQUIRED in practice for Wikidata, which blocks blank / generic UAs with 403 / 429. Only override if a specific endpoint asks you to identify differently."
          },
          "defaultGraphUri": {
            "title": "Default graph URI",
            "type": "string",
            "description": "Optional SPARQL-protocol default-graph-uri parameter — sets the default RDF dataset the query runs against on endpoints that expose named graphs. Leave empty for the endpoint's own default."
          },
          "namedGraphUri": {
            "title": "Named graph URI(s)",
            "type": "array",
            "description": "Optional SPARQL-protocol named-graph-uri parameter(s) — one or more named graphs to add to the dataset the query runs against. Leave empty unless the endpoint documents named graphs.",
            "items": {
              "type": "string"
            }
          },
          "timeoutSecs": {
            "title": "Read timeout (seconds)",
            "minimum": 1,
            "maximum": 600,
            "type": "integer",
            "description": "How long to wait for the endpoint to answer (default 90). Endpoints also enforce their own server-side query timeouts (Wikidata ~60s), so a very large query may still be cut off by the server."
          },
          "bearer": {
            "title": "Bearer token",
            "type": "string",
            "description": "Optional bearer token for an auth-gated SPARQL endpoint (sent as Authorization: Bearer ***). NOT required for public endpoints. Never logged."
          },
          "extraHeaders": {
            "title": "Extra request headers",
            "type": "object",
            "description": "Optional extra HTTP headers as a JSON object, e.g. {\"X-Api-Key\": \"...\"} for a gateway-fronted endpoint. Not required for public endpoints. Header values are never logged."
          }
        }
      },
      "runsResponseSchema": {
        "type": "object",
        "properties": {
          "data": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "actId": {
                "type": "string"
              },
              "userId": {
                "type": "string"
              },
              "startedAt": {
                "type": "string",
                "format": "date-time",
                "example": "2025-01-08T00:00:00.000Z"
              },
              "finishedAt": {
                "type": "string",
                "format": "date-time",
                "example": "2025-01-08T00:00:00.000Z"
              },
              "status": {
                "type": "string",
                "example": "READY"
              },
              "meta": {
                "type": "object",
                "properties": {
                  "origin": {
                    "type": "string",
                    "example": "API"
                  },
                  "userAgent": {
                    "type": "string"
                  }
                }
              },
              "stats": {
                "type": "object",
                "properties": {
                  "inputBodyLen": {
                    "type": "integer",
                    "example": 2000
                  },
                  "rebootCount": {
                    "type": "integer",
                    "example": 0
                  },
                  "restartCount": {
                    "type": "integer",
                    "example": 0
                  },
                  "resurrectCount": {
                    "type": "integer",
                    "example": 0
                  },
                  "computeUnits": {
                    "type": "integer",
                    "example": 0
                  }
                }
              },
              "options": {
                "type": "object",
                "properties": {
                  "build": {
                    "type": "string",
                    "example": "latest"
                  },
                  "timeoutSecs": {
                    "type": "integer",
                    "example": 300
                  },
                  "memoryMbytes": {
                    "type": "integer",
                    "example": 1024
                  },
                  "diskMbytes": {
                    "type": "integer",
                    "example": 2048
                  }
                }
              },
              "buildId": {
                "type": "string"
              },
              "defaultKeyValueStoreId": {
                "type": "string"
              },
              "defaultDatasetId": {
                "type": "string"
              },
              "defaultRequestQueueId": {
                "type": "string"
              },
              "buildNumber": {
                "type": "string",
                "example": "1.0.0"
              },
              "containerUrl": {
                "type": "string"
              },
              "usage": {
                "type": "object",
                "properties": {
                  "ACTOR_COMPUTE_UNITS": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATASET_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATASET_WRITES": {
                    "type": "integer",
                    "example": 0
                  },
                  "KEY_VALUE_STORE_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "KEY_VALUE_STORE_WRITES": {
                    "type": "integer",
                    "example": 1
                  },
                  "KEY_VALUE_STORE_LISTS": {
                    "type": "integer",
                    "example": 0
                  },
                  "REQUEST_QUEUE_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "REQUEST_QUEUE_WRITES": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATA_TRANSFER_INTERNAL_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATA_TRANSFER_EXTERNAL_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_SERPS": {
                    "type": "integer",
                    "example": 0
                  }
                }
              },
              "usageTotalUsd": {
                "type": "number",
                "example": 0.00005
              },
              "usageUsd": {
                "type": "object",
                "properties": {
                  "ACTOR_COMPUTE_UNITS": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATASET_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATASET_WRITES": {
                    "type": "integer",
                    "example": 0
                  },
                  "KEY_VALUE_STORE_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "KEY_VALUE_STORE_WRITES": {
                    "type": "number",
                    "example": 0.00005
                  },
                  "KEY_VALUE_STORE_LISTS": {
                    "type": "integer",
                    "example": 0
                  },
                  "REQUEST_QUEUE_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "REQUEST_QUEUE_WRITES": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATA_TRANSFER_INTERNAL_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATA_TRANSFER_EXTERNAL_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_SERPS": {
                    "type": "integer",
                    "example": 0
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}