{
  "openapi": "3.0.1",
  "info": {
    "title": "Bahrain Import Data API",
    "description": "Unofficial Bahrain import data API: monthly non-oil imports of Bahrain by 8-digit HS code and country of origin, with value, weight, quantity and unit values. Data from the Bahrain Open Data Portal.",
    "version": "0.1",
    "x-build-id": "93y3ejUkBifqKmNkb"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/sourcing-data-studio~bahrain-import-data-api/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-sourcing-data-studio-bahrain-import-data-api",
        "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/sourcing-data-studio~bahrain-import-data-api/runs": {
      "post": {
        "operationId": "runs-sync-sourcing-data-studio-bahrain-import-data-api",
        "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/sourcing-data-studio~bahrain-import-data-api/run-sync": {
      "post": {
        "operationId": "run-sync-sourcing-data-studio-bahrain-import-data-api",
        "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",
        "properties": {
          "hsCodes": {
            "title": "HS commodity codes",
            "maxItems": 30,
            "type": "array",
            "description": "The goods to look up, as HS code prefixes with 2 to 8 digits. A prefix matches every 8-digit commodity code that starts with it: \"85\" is all electrical machinery, \"8517\" is telephone sets and network apparatus, \"85171300\" is smartphones only. Write codes in quotes so leading zeros stay (\"09\" is coffee and tea). Dots, dashes and spaces are ignored, so 8517.13.00 works. A code that is already covered by a shorter code in the same list is dropped. Several codes are combined with OR. Use at most 30 codes. At least one of HS commodity codes or Search keywords is required; if you give both, a record must match a code AND a keyword.",
            "items": {
              "type": "string"
            }
          },
          "searchQueries": {
            "title": "Search keywords",
            "maxItems": 10,
            "type": "array",
            "description": "Optional keywords matched against the English commodity description, for example \"smartphone\", \"telephone sets\" or \"cotton t-shirts\". The portal matches whole words and word beginnings, case-insensitive: \"telephon\" finds \"telephone\" and \"smartphone\" finds \"Smartphones\", but a misspelling finds nothing and the portal does not search inside a word. Several keywords are combined with OR. Use at most 10 keywords of up to 60 characters. At least one of HS commodity codes or Search keywords is required.",
            "items": {
              "type": "string"
            }
          },
          "originCountries": {
            "title": "Countries of origin",
            "maxItems": 40,
            "type": "array",
            "description": "Optional. Only records whose country of origin is one of these 2-letter ISO 3166-1 codes, for example \"CN\" (China), \"IN\" (India), \"AE\" (United Arab Emirates), \"SA\" (Saudi Arabia), \"TR\" (Turkey), \"DE\" (Germany). Leave empty for all origin countries. Codes are not case-sensitive. Use at most 40 codes.",
            "items": {
              "type": "string"
            }
          },
          "years": {
            "title": "Years",
            "maxItems": 6,
            "type": "array",
            "description": "Calendar years to read, as whole numbers from 2021 to 2026, for example [2024, 2025]. The default is [2025]. The portal publishes one dataset per year; 2026 is a partial year that grows as the Authority publishes new months, and the newest months of a year may lag behind. Results are returned newest period first.",
            "items": {
              "type": "integer",
              "minimum": 2021,
              "maximum": 2026
            },
            "default": [
              2025
            ]
          },
          "months": {
            "title": "Months",
            "maxItems": 12,
            "type": "array",
            "description": "Optional. Only these months of each selected year, as whole numbers from 1 (January) to 12 (December), for example [11, 12]. Leave empty for all months. A month that the portal has not published yet is simply absent from the results.",
            "items": {
              "type": "integer",
              "minimum": 1,
              "maximum": 12
            }
          },
          "maxItems": {
            "title": "Maximum import records",
            "minimum": 1,
            "maximum": 10000,
            "type": "integer",
            "description": "Maximum number of import records to save and pay for in this run, across all years and months. Records are read newest period first and, inside a month, largest import value first, so a low limit gives you the most recent and biggest records. The run stops as soon as this many records are saved.",
            "default": 100
          },
          "proxyConfiguration": {
            "title": "Proxy configuration",
            "type": "object",
            "description": "Off by default. The Bahrain Open Data Portal needs no key, no login and no proxy, and it gives each IP address a daily quota of anonymous requests (the portal does not publish the number). Addresses of a shared proxy are used by many people at once, so their quota can already be used up. A proxy is not a way round a refusal: after HTTP 429 the Actor waits and asks again from the same address, and when the quota is used up or the portal refuses a request (HTTP 401, 403 or 407) the run stops without trying another address.",
            "default": {
              "useApifyProxy": false
            }
          },
          "maxRequestRetries": {
            "title": "Retries per request",
            "minimum": 0,
            "maximum": 6,
            "type": "integer",
            "description": "How many times a failed request is retried with exponential backoff. Connection errors count too. A retry after a refusal always leaves from the same address. Requests the portal rejects for good (HTTP 400 or 404) or refuses (HTTP 401, 403 or 407) are not retried, and neither is HTTP 429 with a used-up daily quota or with a wait time above 60 seconds. Failed requests are never charged.",
            "default": 3
          },
          "debugLog": {
            "title": "Debug log",
            "type": "boolean",
            "description": "Print detailed debug messages to the run log.",
            "default": false
          },
          "feedback": {
            "title": "Feedback for the developer",
            "maxLength": 1000,
            "type": "string",
            "description": "Optional. Tell us which field, dataset or filter you need next, or what went wrong. It is saved with the run summary. Do not include personal data. AI agents may also use this field to report problems."
          }
        }
      },
      "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
                  },
                  "PROXY_UNBLOCKER_UNITS": {
                    "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
                  },
                  "PROXY_UNBLOCKER_UNITS": {
                    "type": "integer",
                    "example": 0
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}