{
	"swagger": "2.0",
	"info": {
		"title": "Hoko Power Platform connector",
		"version": "0.0.1",
		"description": "Preview actions for Hoko link creation and external ID lookup. Generated from the canonical unversioned Hoko REST contract."
	},
	"host": "api.hoko.to",
	"basePath": "/",
	"schemes": [
		"https"
	],
	"produces": [
		"application/json"
	],
	"consumes": [
		"application/json"
	],
	"securityDefinitions": {
		"api_key": {
			"type": "apiKey",
			"name": "X-API-Key",
			"in": "header",
			"description": "A Hoko API key with linksRead and linksWrite scopes."
		}
	},
	"security": [
		{
			"api_key": []
		}
	],
	"tags": [
		{
			"name": "Links"
		}
	],
	"paths": {
		"/links": {
			"get": {
				"tags": [
					"Links"
				],
				"operationId": "listLinksByExternalId",
				"summary": "List links",
				"description": "Lists links by externalId. Requires the `linksRead` scope.",
				"security": [
					{
						"api_key": []
					}
				],
				"parameters": [
					{
						"name": "externalId",
						"in": "query",
						"required": true,
						"description": "Filter by external ID.",
						"type": "string"
					},
					{
						"name": "take",
						"in": "query",
						"required": false,
						"description": "Number of records to return.",
						"type": "integer",
						"minimum": 1,
						"maximum": 5000,
						"default": 50
					},
					{
						"name": "skip",
						"in": "query",
						"required": false,
						"description": "Number of records to skip.",
						"type": "integer",
						"minimum": 0,
						"default": 0
					},
					{
						"name": "sort",
						"in": "query",
						"required": false,
						"description": "Sort order.",
						"type": "string",
						"enum": [
							"asc",
							"desc"
						],
						"default": "desc"
					}
				],
				"responses": {
					"200": {
						"description": "Links returned.",
						"headers": {
							"X-RateLimit-Limit": {
								"description": "Maximum requests allowed per minute for the workspace plan.",
								"type": "integer"
							},
							"X-RateLimit-Remaining": {
								"description": "Requests remaining in the current rate-limit window.",
								"type": "integer"
							},
							"X-RateLimit-Reset": {
								"description": "Unix timestamp, in seconds, when the current window resets.",
								"type": "integer"
							},
							"X-Request-Id": {
								"description": "Request identifier returned by Hoko for support and reconciliation.",
								"type": "string"
							}
						},
						"schema": {
							"type": "array",
							"maxItems": 10000,
							"items": {
								"$ref": "#/definitions/Link"
							}
						}
					},
					"400": {
						"description": "Invalid request body, query string, or JSON payload.",
						"headers": {
							"X-RateLimit-Limit": {
								"description": "Maximum requests allowed per minute for the workspace plan.",
								"type": "integer"
							},
							"X-RateLimit-Remaining": {
								"description": "Requests remaining in the current rate-limit window.",
								"type": "integer"
							},
							"X-RateLimit-Reset": {
								"description": "Unix timestamp, in seconds, when the current window resets.",
								"type": "integer"
							},
							"X-Request-Id": {
								"description": "Request identifier returned by Hoko for support and reconciliation.",
								"type": "string"
							}
						},
						"schema": {
							"$ref": "#/definitions/ApiError"
						}
					},
					"401": {
						"description": "Missing or invalid credential.",
						"schema": {
							"$ref": "#/definitions/ApiError"
						},
						"headers": {
							"X-Request-Id": {
								"description": "Request identifier returned by Hoko for support and reconciliation.",
								"type": "string"
							}
						}
					},
					"403": {
						"description": "Credential is missing the required scope.",
						"headers": {
							"X-RateLimit-Limit": {
								"description": "Maximum requests allowed per minute for the workspace plan.",
								"type": "integer"
							},
							"X-RateLimit-Remaining": {
								"description": "Requests remaining in the current rate-limit window.",
								"type": "integer"
							},
							"X-RateLimit-Reset": {
								"description": "Unix timestamp, in seconds, when the current window resets.",
								"type": "integer"
							},
							"X-Request-Id": {
								"description": "Request identifier returned by Hoko for support and reconciliation.",
								"type": "string"
							}
						},
						"schema": {
							"$ref": "#/definitions/ApiError"
						}
					},
					"429": {
						"description": "Workspace rate limit exceeded.",
						"headers": {
							"X-RateLimit-Limit": {
								"description": "Maximum requests allowed per minute for the workspace plan.",
								"type": "integer"
							},
							"X-RateLimit-Remaining": {
								"description": "Requests remaining in the current rate-limit window.",
								"type": "integer"
							},
							"X-RateLimit-Reset": {
								"description": "Unix timestamp, in seconds, when the current window resets.",
								"type": "integer"
							},
							"X-Request-Id": {
								"description": "Request identifier returned by Hoko for support and reconciliation.",
								"type": "string"
							}
						},
						"schema": {
							"$ref": "#/definitions/ApiError"
						}
					},
					"500": {
						"description": "Unexpected server error.",
						"schema": {
							"$ref": "#/definitions/ApiError"
						},
						"headers": {
							"X-Request-Id": {
								"description": "Request identifier returned by Hoko for support and reconciliation.",
								"type": "string"
							}
						}
					}
				}
			},
			"post": {
				"tags": [
					"Links"
				],
				"operationId": "createLinksFromApi",
				"summary": "Create links",
				"description": "Creates one or more links. Requires the `linksWrite` scope.",
				"security": [
					{
						"api_key": []
					}
				],
				"responses": {
					"201": {
						"description": "Links created.",
						"headers": {
							"X-RateLimit-Limit": {
								"description": "Maximum requests allowed per minute for the workspace plan.",
								"type": "integer"
							},
							"X-RateLimit-Remaining": {
								"description": "Requests remaining in the current rate-limit window.",
								"type": "integer"
							},
							"X-RateLimit-Reset": {
								"description": "Unix timestamp, in seconds, when the current window resets.",
								"type": "integer"
							},
							"X-Request-Id": {
								"description": "Request identifier returned by Hoko for support and reconciliation.",
								"type": "string"
							}
						},
						"schema": {
							"type": "array",
							"maxItems": 10000,
							"items": {
								"$ref": "#/definitions/Link"
							}
						}
					},
					"400": {
						"description": "Invalid request body, query string, or JSON payload.",
						"headers": {
							"X-RateLimit-Limit": {
								"description": "Maximum requests allowed per minute for the workspace plan.",
								"type": "integer"
							},
							"X-RateLimit-Remaining": {
								"description": "Requests remaining in the current rate-limit window.",
								"type": "integer"
							},
							"X-RateLimit-Reset": {
								"description": "Unix timestamp, in seconds, when the current window resets.",
								"type": "integer"
							},
							"X-Request-Id": {
								"description": "Request identifier returned by Hoko for support and reconciliation.",
								"type": "string"
							}
						},
						"schema": {
							"$ref": "#/definitions/ApiError"
						}
					},
					"401": {
						"description": "Missing or invalid credential.",
						"schema": {
							"$ref": "#/definitions/ApiError"
						},
						"headers": {
							"X-Request-Id": {
								"description": "Request identifier returned by Hoko for support and reconciliation.",
								"type": "string"
							}
						}
					},
					"403": {
						"description": "Credential is missing the required scope.",
						"headers": {
							"X-RateLimit-Limit": {
								"description": "Maximum requests allowed per minute for the workspace plan.",
								"type": "integer"
							},
							"X-RateLimit-Remaining": {
								"description": "Requests remaining in the current rate-limit window.",
								"type": "integer"
							},
							"X-RateLimit-Reset": {
								"description": "Unix timestamp, in seconds, when the current window resets.",
								"type": "integer"
							},
							"X-Request-Id": {
								"description": "Request identifier returned by Hoko for support and reconciliation.",
								"type": "string"
							}
						},
						"schema": {
							"$ref": "#/definitions/ApiError"
						}
					},
					"429": {
						"description": "Workspace rate limit exceeded.",
						"headers": {
							"X-RateLimit-Limit": {
								"description": "Maximum requests allowed per minute for the workspace plan.",
								"type": "integer"
							},
							"X-RateLimit-Remaining": {
								"description": "Requests remaining in the current rate-limit window.",
								"type": "integer"
							},
							"X-RateLimit-Reset": {
								"description": "Unix timestamp, in seconds, when the current window resets.",
								"type": "integer"
							},
							"X-Request-Id": {
								"description": "Request identifier returned by Hoko for support and reconciliation.",
								"type": "string"
							}
						},
						"schema": {
							"$ref": "#/definitions/ApiError"
						}
					},
					"500": {
						"description": "Unexpected server error.",
						"schema": {
							"$ref": "#/definitions/ApiError"
						},
						"headers": {
							"X-Request-Id": {
								"description": "Request identifier returned by Hoko for support and reconciliation.",
								"type": "string"
							}
						}
					}
				},
				"parameters": [
					{
						"name": "body",
						"in": "body",
						"required": true,
						"schema": {
							"type": "array",
							"maxItems": 1,
							"items": {
								"$ref": "#/definitions/LinkCreate"
							},
							"minItems": 1
						},
						"description": "Send an array containing one link object."
					}
				]
			}
		}
	},
	"definitions": {
		"Link": {
			"type": "object",
			"required": [
				"id",
				"url",
				"shortUrl",
				"qrCode",
				"title",
				"description",
				"image",
				"utm",
				"expiresAt",
				"expiredUrl",
				"password",
				"cloaked",
				"ios",
				"android",
				"geo",
				"collectionId",
				"tagIds",
				"externalId",
				"tenantId",
				"partnerId",
				"createdAt"
			],
			"properties": {
				"id": {
					"type": "string",
					"pattern": "^[0-7][0-9A-HJKMNP-TV-Z]{25}$",
					"description": "Resource IDs are bare 26-character ULIDs."
				},
				"url": {
					"type": "string",
					"format": "uri",
					"pattern": "^[Hh][Tt][Tt][Pp][Ss]://"
				},
				"shortUrl": {
					"type": "string",
					"format": "uri",
					"pattern": "^[Hh][Tt][Tt][Pp][Ss]://"
				},
				"qrCode": {
					"type": "string",
					"format": "uri",
					"pattern": "^[Hh][Tt][Tt][Pp][Ss]://"
				},
				"title": {
					"type": "string",
					"x-nullable": true
				},
				"description": {
					"type": "string",
					"x-nullable": true
				},
				"image": {
					"type": "string",
					"format": "uri",
					"pattern": "^[Hh][Tt][Tt][Pp][Ss]://",
					"x-nullable": true
				},
				"utm": {
					"$ref": "#/definitions/Utm",
					"x-nullable": true
				},
				"expiresAt": {
					"type": "string",
					"format": "date-time",
					"x-nullable": true
				},
				"expiredUrl": {
					"type": "string",
					"format": "uri",
					"pattern": "^[Hh][Tt][Tt][Pp][Ss]://",
					"x-nullable": true
				},
				"password": {
					"type": "string",
					"x-nullable": true
				},
				"cloaked": {
					"type": "boolean",
					"description": "When true, Hoko renders the resolved destination in a full-page iframe. Create and update requests preflight the destination and return 400 when the current destination blocks iframe rendering."
				},
				"ios": {
					"type": "string",
					"format": "uri",
					"pattern": "^[Hh][Tt][Tt][Pp][Ss]://",
					"x-nullable": true
				},
				"android": {
					"type": "string",
					"format": "uri",
					"pattern": "^[Hh][Tt][Tt][Pp][Ss]://",
					"x-nullable": true
				},
				"geo": {
					"$ref": "#/definitions/GeoTargeting",
					"x-nullable": true
				},
				"collectionId": {
					"type": "string",
					"pattern": "^[0-7][0-9A-HJKMNP-TV-Z]{25}$",
					"description": "Resource IDs are bare 26-character ULIDs."
				},
				"tagIds": {
					"type": "array",
					"maxItems": 10000,
					"items": {
						"type": "string",
						"pattern": "^[0-7][0-9A-HJKMNP-TV-Z]{25}$",
						"description": "Resource IDs are bare 26-character ULIDs."
					},
					"description": "Existing tag IDs assigned to the link. Every tag ID must belong to the authenticated workspace."
				},
				"externalId": {
					"type": "string",
					"x-nullable": true
				},
				"tenantId": {
					"type": "string",
					"x-nullable": true
				},
				"partnerId": {
					"type": "string",
					"pattern": "^[0-7][0-9A-HJKMNP-TV-Z]{25}$",
					"description": "Resource IDs are bare 26-character ULIDs.",
					"x-nullable": true
				},
				"createdAt": {
					"type": "string",
					"format": "date-time"
				}
			}
		},
		"LinkCreate": {
			"type": "object",
			"required": [
				"url",
				"collectionId"
			],
			"properties": {
				"url": {
					"type": "string",
					"format": "uri",
					"pattern": "^[Hh][Tt][Tt][Pp][Ss]://"
				},
				"title": {
					"type": "string"
				},
				"description": {
					"type": "string"
				},
				"image": {
					"type": "string",
					"format": "uri",
					"pattern": "^[Hh][Tt][Tt][Pp][Ss]://"
				},
				"utm": {
					"$ref": "#/definitions/UtmCreate"
				},
				"expiresAt": {
					"type": "string",
					"format": "date-time",
					"description": "ISO date-time with timezone offset. When the current server time is later than this value, the link is expired."
				},
				"expiredUrl": {
					"type": "string",
					"format": "uri",
					"pattern": "^[Hh][Tt][Tt][Pp][Ss]://",
					"description": "Destination URL used after expiration. Expired links skip device and geo targeting."
				},
				"password": {
					"type": "string",
					"description": "Password visitors must enter before Hoko resolves the final destination."
				},
				"cloaked": {
					"type": "boolean",
					"default": false,
					"description": "When true, Hoko renders the resolved destination in a full-page iframe. Create and update requests preflight the destination and return 400 when the current destination blocks iframe rendering."
				},
				"ios": {
					"type": "string",
					"format": "uri",
					"pattern": "^[Hh][Tt][Tt][Pp][Ss]://",
					"description": "iOS-specific destination selected from best-effort User-Agent detection. iOS and Android checks run before geo targeting."
				},
				"android": {
					"type": "string",
					"format": "uri",
					"pattern": "^[Hh][Tt][Tt][Pp][Ss]://",
					"description": "Android-specific destination selected from best-effort User-Agent detection. iOS and Android checks run before geo targeting."
				},
				"geo": {
					"$ref": "#/definitions/GeoTargeting",
					"x-nullable": true
				},
				"collectionId": {
					"type": "string",
					"pattern": "^[0-7][0-9A-HJKMNP-TV-Z]{25}$",
					"description": "Resource IDs are bare 26-character ULIDs."
				},
				"tagIds": {
					"type": "array",
					"maxItems": 10000,
					"items": {
						"type": "string",
						"pattern": "^[0-7][0-9A-HJKMNP-TV-Z]{25}$",
						"description": "Resource IDs are bare 26-character ULIDs."
					},
					"description": "Existing tag IDs assigned to the link. Every tag ID must belong to the authenticated workspace."
				},
				"externalId": {
					"type": "string"
				},
				"tenantId": {
					"type": "string"
				},
				"partnerId": {
					"type": "string",
					"pattern": "^[0-7][0-9A-HJKMNP-TV-Z]{25}$",
					"description": "Resource IDs are bare 26-character ULIDs."
				}
			}
		},
		"ApiError": {
			"type": "object",
			"required": [
				"error"
			],
			"properties": {
				"error": {
					"description": "Error message. Hoko may return a string or a localized object with en and ar fields.",
					"x-hoko-oneOf": [
						{
							"type": "string"
						},
						{
							"$ref": "#/definitions/LocalizedMessage"
						}
					]
				},
				"missingScopes": {
					"type": "array",
					"maxItems": 10000,
					"items": {
						"type": "string"
					}
				},
				"retryAfter": {
					"type": "integer",
					"minimum": 0
				}
			}
		},
		"Utm": {
			"type": "object",
			"properties": {
				"source": {
					"type": "string"
				},
				"medium": {
					"type": "string"
				},
				"campaign": {
					"type": "string"
				},
				"term": {
					"type": "string"
				},
				"content": {
					"type": "string"
				},
				"referral": {
					"type": "string"
				}
			}
		},
		"GeoTargeting": {
			"type": "object",
			"description": "Country-code destination map. Use uppercase ISO 3166-1 alpha-2 keys such as SA or US. Geo targeting runs after iOS and Android checks.",
			"x-hoko-propertyNames": {
				"type": "string",
				"pattern": "^[A-Z]{2}$"
			},
			"additionalProperties": {
				"type": "string",
				"format": "uri",
				"pattern": "^[Hh][Tt][Tt][Pp][Ss]://"
			}
		},
		"UtmCreate": {
			"type": "object",
			"properties": {
				"source": {
					"type": "string"
				},
				"medium": {
					"type": "string"
				},
				"campaign": {
					"type": "string"
				},
				"term": {
					"type": "string"
				},
				"content": {
					"type": "string"
				},
				"referral": {
					"type": "string"
				}
			}
		},
		"LocalizedMessage": {
			"type": "object",
			"required": [
				"en",
				"ar"
			],
			"properties": {
				"en": {
					"type": "string"
				},
				"ar": {
					"type": "string"
				}
			}
		}
	}
}
