# HTML Files

## Retrieve HTML File

> Retrieves an HTML file stored in Firebase using an encrypted token passed as a query parameter. \
> \
> \### Query Parameter\
> \- \*\*token\*\* \*(string, required)\*: Encrypted token representing the user, session, and file name. This token is used to locate and decrypt the corresponding HTML file.\
> \
> \### Response (HTTP 200)\
> \
> On success, returns the content of the HTML file with a \`Content-Type\` of \`text/html\`.\
> \
> \`\`\`html\
> \<html>\<body>\<h1>Example HTML\</h1>\</body>\</html>\
> \`\`\`\
> \
> \### Error Handling\
> \
> \- \*\*400 Bad Request\*\*: Returned if the \`token\` query parameter is missing or empty.\
> \- \*\*404 Not Found\*\*: Returned if the HTML file cannot be retrieved (e.g., invalid token or file not found).\
> \- \*\*500 Internal Server Error\*\*: Returned if an unexpected error occurs on the server.\
> \
> \### Security\
> \
> No authentication is required for this endpoint.

````json
{"openapi":"3.1.1","info":{"title":"AIKYNETIX WEB API","version":"v2"},"servers":[{"url":"https://api.aikynetix.app"}],"security":[],"paths":{"/helper/html-files/":{"get":{"operationId":"helper_html-files_list","summary":"Retrieve HTML File","description":"Retrieves an HTML file stored in Firebase using an encrypted token passed as a query parameter. \n\n### Query Parameter\n- **token** *(string, required)*: Encrypted token representing the user, session, and file name. This token is used to locate and decrypt the corresponding HTML file.\n\n### Response (HTTP 200)\n\nOn success, returns the content of the HTML file with a `Content-Type` of `text/html`.\n\n```html\n<html><body><h1>Example HTML</h1></body></html>\n```\n\n### Error Handling\n\n- **400 Bad Request**: Returned if the `token` query parameter is missing or empty.\n- **404 Not Found**: Returned if the HTML file cannot be retrieved (e.g., invalid token or file not found).\n- **500 Internal Server Error**: Returned if an unexpected error occurs on the server.\n\n### Security\n\nNo authentication is required for this endpoint.","parameters":[{"schema":{"type":"string"},"name":"token","in":"query","description":"Encrypted token used to retrieve the HTML file.","required":true}],"responses":{"200":{"description":"HTML file retrieved successfully.","content":{"application/json":{"schema":{"description":"The HTML file content.","type":"string"}}}},"400":{"description":"Bad Request - Returned if the `token` parameter is missing or empty. Ensure that the token is provided in the query string.","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"description":"Error message explaining that the token is required.","type":"string"}}}}}},"404":{"description":"Not Found - Returned if the HTML file cannot be retrieved. This may be due to an invalid token or if the file does not exist.","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"description":"Error message indicating that the HTML file could not be found.","type":"string"}}}}}},"500":{"description":"Internal Server Error - Returned if an unexpected error occurred on the server. Check the error details for further information.","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"description":"A detailed error message describing the server-side failure.","type":"string"}}}}}}},"tags":["helper"]}}}}
````

## Upload HTML File

> Uploads an HTML file to Firebase for a specific session. The file must be provided as form-data with a key \`html\_file\` and have a content type of 'text/html'. Additionally, the \`session\_id\` must be included in the form-data to associate the file with a session.\
> \
> \### Form Data\
> \- \*\*html\_file\*\* \*(file, required)\*: The HTML file to be uploaded. Only files with content type 'text/html' are accepted.\
> \- \*\*session\_id\*\* \*(string, required)\*: The session ID associated with the uploaded HTML file.\
> \
> \### Response (HTTP 201)\
> On success, returns a JSON object containing:\
> \- \*\*message\*\* \*(string)\*: A confirmation message indicating that the file was uploaded successfully.\
> \- \*\*token\*\* \*(string)\*: An encrypted token representing the file and session information.\
> \
> \### Error Handling\
> \
> \- \*\*400 Bad Request\*\*: Returned if required fields are missing (e.g. no file or session ID provided), if the file type is not 'text/html', or if the admin UID is invalid.\
> \- \*\*404 Not Found\*\*: Returned if the session ID does not exist in Firestore. This indicates that the session ID provided does not match any existing session in the database.\
> \- \*\*422 Unprocessable Entity\*\*: Returned if the HTML file processing (e.g., encryption) fails.\
> \- \*\*500 Internal Server Error\*\*: Returned if an unexpected error occurs on the server.\
> \
> \### Security\
> A valid API-KEY token must be provided in the \`Authorization\` header.

```json
{"openapi":"3.1.1","info":{"title":"AIKYNETIX WEB API","version":"v2"},"servers":[{"url":"https://api.aikynetix.app"}],"security":[{"Bearer":[]},{"ApiKeyAuth":[]}],"components":{"securitySchemes":{"Bearer":{"type":"apiKey","name":"Authorization","in":"header","description":"Enter your bearer token (Firebase auth) in the format: Bearer <token>"},"ApiKeyAuth":{"type":"apiKey","name":"API-KEY","in":"header","description":"Enter your API key in the header: API-KEY: <api_key>"}}},"paths":{"/helper/html-files/":{"post":{"operationId":"helper_html-files_create","summary":"Upload HTML File","description":"Uploads an HTML file to Firebase for a specific session. The file must be provided as form-data with a key `html_file` and have a content type of 'text/html'. Additionally, the `session_id` must be included in the form-data to associate the file with a session.\n\n### Form Data\n- **html_file** *(file, required)*: The HTML file to be uploaded. Only files with content type 'text/html' are accepted.\n- **session_id** *(string, required)*: The session ID associated with the uploaded HTML file.\n\n### Response (HTTP 201)\nOn success, returns a JSON object containing:\n- **message** *(string)*: A confirmation message indicating that the file was uploaded successfully.\n- **token** *(string)*: An encrypted token representing the file and session information.\n\n### Error Handling\n\n- **400 Bad Request**: Returned if required fields are missing (e.g. no file or session ID provided), if the file type is not 'text/html', or if the admin UID is invalid.\n- **404 Not Found**: Returned if the session ID does not exist in Firestore. This indicates that the session ID provided does not match any existing session in the database.\n- **422 Unprocessable Entity**: Returned if the HTML file processing (e.g., encryption) fails.\n- **500 Internal Server Error**: Returned if an unexpected error occurs on the server.\n\n### Security\nA valid API-KEY token must be provided in the `Authorization` header.","responses":{"201":{"description":"File uploaded successfully.","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"description":"A confirmation message.","type":"string"},"token":{"description":"Encrypted token representing the file and session information.","type":"string"}}}}}},"400":{"description":"Bad Request - Returned if required fields are missing (e.g., no file provided, session ID missing), if the file type is invalid (only HTML files are allowed), or if the admin UID is invalid.","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"description":"Detailed error message explaining the invalid request.","type":"string"}}}}}},"404":{"description":"Not Found - Returned if the session ID does not exist in Firestore.","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"description":"Error message indicating that the session ID was not found.","type":"string"}}}}}},"422":{"description":"Unprocessable Entity - Returned if the HTML file processing (e.g., encryption) fails.","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"description":"Detailed error message describing the processing failure.","type":"string"}}}}}},"500":{"description":"Internal Server Error - Returned if an unexpected error occurs on the server.","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"description":"A detailed error message indicating a server-side failure.","type":"string"}}}}}}},"tags":["helper"],"requestBody":{"content":{"application/x-www-form-urlencoded":{"schema":{"type":"object","properties":{"html_file":{"type":"string","description":"The HTML file to upload. Must have the content type 'text/html'."},"session_id":{"type":"string","description":"The session ID to associate with the uploaded HTML file."}},"required":["html_file","session_id"]}}}}}}}}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.aikynetix.app/api-documentation/developer-resources-and-api-reference/api-reference/html-files.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
