{
    "swagger": "2.0",
    "host": "user.snapforms.com.au",
    "basePath": "/",
    "consumes": [
        "application/json"
    ],
    "produces": [],
    "info": {
        "version": "1.2.0",
        "title": "Snapforms",
        "description": "Create and share online forms to improve processes and collect accurate data with ease. Build custom workflows and connect form responses with your own systems."
    },
    "schemes": [
        "https"
    ],
    "parameters": {
        "FormSlugParameter": {
            "name": "form-slug",
            "description": "The name of the form",
            "type": "string",
            "in": "path",
            "required": true,
            "x-ms-visibility": "important",
            "x-ms-summary": "Form",
            "x-ms-dynamic-values": {
                "operationId": "GetAvailableForms",
                "value-path": "slug",
                "value-title": "name"
            }
        }
    },
    "definitions": {
        "FormListResponse": {
            "type": "array",
            "description": "A response listing availabe forms",
            "x-ms-summary": "Available Forms",
            "items": {
                "$ref": "#/definitions/AvailableForm"
            }
        },
        "AvailableForm": {
            "type": "object",
            "description": "An available form",
            "properties": {
                "name": {
                    "title": "name",
                    "description": "The name of the form",
                    "type": "string"
                },
                "slug": {
                    "title": "slug",
                    "description": "The form slug",
                    "type": "string"
                }
            }
        },
        "FormSchema": {
            "type": "object",
            "properties": {},
            "x-ms-dynamic-schema": {
                "operationId": "GetFormSchema",
                "parameters": {
                    "form-slug": {
                        "parameter": "form-slug"
                    }
                },
                "value-path": "schema"
            },
            "x-ms-dynamic-properties": {
                "operationId": "GetFormSchema",
                "itemValuePath": "schema",
                "parameters": {
                    "form-slug": {
                        "parameterReference": "form-slug"
                    }
                }
            }
        },
        "WebhookRequestBody": {
            "type": "object",
            "description": "Confirmation of webhook being created.",
            "properties": {
                "active": {
                    "description": "The activity status of the trigger",
                    "type": "boolean",
                    "default": true,
                    "x-ms-visibility": "internal"
                },
                "type": {
                    "description": "Internal",
                    "type": "string",
                    "default": "web",
                    "x-ms-visibility": "internal"
                },
                "url": {
                    "type": "string",
                    "description": "HTML URL of the Form",
                    "title": "HTML URL of the Form",
                    "x-ms-notification-url": true,
                    "x-ms-visibility": "internal"
                },
                "event": {
                    "description": "Event to listen on",
                    "type": "string",
                    "default": "responses",
                    "x-ms-visibility": "internal"
                }
            },
            "required": [
                "active",
                "type",
                "url",
                "event"
            ]
        },
        "WebhookCreationResource": {
            "type": "object",
            "properties": {
                "type": {
                    "description": "The type of webhook.",
                    "type": "string",
                    "title": "Type"
                },
                "id": {
                    "description": "The webhook ID",
                    "type": "integer",
                    "format": "int32",
                    "title": "ID"
                },
                "active": {
                    "description": "The active status of the webhook.",
                    "type": "boolean",
                    "title": "Active"
                },
                "event": {
                    "description": "The event being listened on",
                    "type": "string",
                    "title": "Event"
                },
                "url": {
                    "type": "string"
                },
                "updated_at": {
                    "type": "string"
                },
                "created_at": {
                    "type": "string"
                }
            }
        },
        "TemporaryUrl": {
            "type": "object",
            "description": "A temporary URL to download a file",
            "properties": {
                "name": {
                    "title": "name",
                    "description": "The file name",
                    "type": "string",
                    "x-ms-summary": "File name",
                    "x-ms-visibility": "important"
                },
                "url": {
                    "title": "url",
                    "description": "The temporary URL to be used for downloading the file",
                    "type": "string",
                    "x-ms-summary": "File URL",
                    "x-ms-visibility": "important"
                }
            }
        }
    },
    "paths": {
        "/api/forms": {
            "get": {
                "summary": "Get list of available forms",
                "operationId": "GetAvailableForms",
                "description": "Get a list of available forms",
                "x-ms-visibility": "internal",
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "$ref": "#/definitions/FormListResponse"
                        }
                    },
                    "default": {
                        "description": "Operation Failed."
                    }
                }
            }
        },
        "/api/forms/{form-slug}/schema": {
            "get": {
                "tags": [
                    "Schema"
                ],
                "operationId": "GetFormSchema",
                "summary": "Get the form schema",
                "description": "Get the schema of a form",
                "x-ms-visibility": "internal",
                "parameters": [
                    {
                        "name": "form-slug",
                        "description": "The name of the form",
                        "type": "string",
                        "in": "path",
                        "required": true,
                        "x-ms-visibility": "important",
                        "x-ms-summary": "Form",
                        "x-ms-dynamic-values": {
                            "operationId": "GetAvailableForms",
                            "value-path": "slug",
                            "value-title": "name"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    },
                    "400": {
                        "description": "Bad Request"
                    },
                    "500": {
                        "description": "Internal Server Error"
                    },
                    "default": {
                        "description": "Operation Failed."
                    }
                }
            }
        },
        "/api/forms/{form-slug}/responses/hooks": {
            "x-ms-notification-content": {
                "description": "Details for Webhook",
                "schema": {
                    "$ref": "#/definitions/FormSchema"
                }
            },
            "post": {
                "operationId": "WebhookTrigger",
                "summary": "When a form response is submitted",
                "description": "Creates a Snapforms webhook",
                "x-ms-trigger": "single",
                "parameters": [
                    {
                        "name": "form-slug",
                        "description": "The name of the form",
                        "type": "string",
                        "in": "path",
                        "required": true,
                        "x-ms-visibility": "important",
                        "x-ms-summary": "Form",
                        "x-ms-dynamic-values": {
                            "operationId": "GetAvailableForms",
                            "value-path": "slug",
                            "value-title": "name"
                        }
                    },
                    {
                        "name": "webhook-request-body",
                        "in": "body",
                        "description": "The request body of the Webhook",
                        "schema": {
                            "type": "object",
                            "description": "Confirmation of webhook being created.",
                            "properties": {
                                "active": {
                                    "description": "The activity status of the trigger",
                                    "type": "boolean",
                                    "default": true,
                                    "x-ms-visibility": "internal"
                                },
                                "type": {
                                    "description": "Internal",
                                    "type": "string",
                                    "default": "web",
                                    "x-ms-visibility": "internal"
                                },
                                "url": {
                                    "type": "string",
                                    "description": "HTML URL of the Form",
                                    "title": "HTML URL of the Form",
                                    "x-ms-notification-url": true,
                                    "x-ms-visibility": "internal"
                                },
                                "event": {
                                    "description": "Event to listen on",
                                    "type": "string",
                                    "default": "responses",
                                    "x-ms-visibility": "internal"
                                }
                            },
                            "required": [
                                "active",
                                "type",
                                "url",
                                "event"
                            ]
                        }
                    }
                ],
                "responses": {
                    "201": {
                        "description": "Created",
                        "schema": {
                            "$ref": "#/definitions/WebhookCreationResource"
                        }
                    }
                }
            }
        },
        "/api/forms/{form-slug}/responses/hooks/{hook-id}": {
            "delete": {
                "operationId": "DeleteWebhookTrigger",
                "description": "Deletes a Snapforms webhook",
                "summary": "Delete Webhook",
                "x-ms-visibility": "internal",
                "parameters": [
                    {
                        "name": "form-slug",
                        "description": "The slug of the targetted form.",
                        "type": "string",
                        "in": "path",
                        "required": true,
                        "x-ms-visibility": "advanced",
                        "x-ms-summary": "Form slug"
                    },
                    {
                        "name": "hook-id",
                        "description": "The ID of the hook being deleted.",
                        "type": "integer",
                        "format": "int32",
                        "in": "path",
                        "required": true,
                        "x-ms-visibility": "advanced",
                        "x-ms-summary": "Hook ID"
                    }
                ],
                "responses": {
                    "default": {
                        "description": "default"
                    }
                }
            }
        },
        "/api/forms/{form-slug}/responses/{response-id}/file/{file-key}": {
            "get": {
                "deprecated": true,
                "responses": {
                    "default": {
                        "description": "default",
                        "schema": {}
                    }
                },
                "summary": "Download File (depreciated)",
                "description": "Download File from Form Response",
                "operationId": "DownloadFile",
                "x-ms-visibility": "advanced",
                "parameters": [
                    {
                        "name": "form-slug",
                        "in": "path",
                        "required": true,
                        "type": "string"
                    },
                    {
                        "name": "response-id",
                        "in": "path",
                        "required": true,
                        "type": "string"
                    },
                    {
                        "name": "file-key",
                        "in": "path",
                        "required": true,
                        "type": "string"
                    }
                ]
            }
        },
        "/api/forms/{form-slug}/responses/{response-id}/temporary-file-url/{file-key}": {
            "get": {
                "responses": {
                    "default": {
                        "description": "default",
                        "schema": {
                            "$ref": "#/definitions/TemporaryUrl"
                        }
                    }
                },
                "summary": "Retrieve File Url for Download",
                "description": "A temporary URL to download file from Form Response",
                "operationId": "TemporaryFileUrl",
                "x-ms-visibility": "advanced",
                "parameters": [
                    {
                        "name": "form-slug",
                        "in": "path",
                        "required": true,
                        "type": "string"
                    },
                    {
                        "name": "response-id",
                        "in": "path",
                        "required": true,
                        "type": "string"
                    },
                    {
                        "name": "file-key",
                        "in": "path",
                        "required": true,
                        "type": "string"
                    }
                ]
            }
        },
        "/api/forms/{form-slug}/responses/{response-id}/pdf": {
            "get": {
                "deprecated": true,
                "responses": {
                    "default": {
                        "description": "default",
                        "schema": {}
                    }
                },
                "summary": "Download PDF (depreciated)",
                "description": "Download PDF copy of Form Response",
                "operationId": "DownloadPdf",
                "x-ms-visibility": "advanced",
                "parameters": [
                    {
                        "name": "form-slug",
                        "in": "path",
                        "required": true,
                        "type": "string"
                    },
                    {
                        "name": "response-id",
                        "in": "path",
                        "required": true,
                        "type": "string"
                    }
                ]
            }
        },
        "/api/forms/{form-slug}/responses/{response-id}/temporary-pdf-url": {
            "get": {
                "responses": {
                    "default": {
                        "description": "default",
                        "schema": {
                            "$ref": "#/definitions/TemporaryUrl"
                        }
                    }
                },
                "summary": "Retrieve PDF URL for Download",
                "description": "A temporary URL to download a PDF version of the Form Response",
                "operationId": "TemporaryPdfUrl",
                "x-ms-visibility": "advanced",
                "parameters": [
                    {
                        "name": "form-slug",
                        "in": "path",
                        "required": true,
                        "type": "string"
                    },
                    {
                        "name": "response-id",
                        "in": "path",
                        "required": true,
                        "type": "string"
                    }
                ]
            }
        }
    },
    "responses": {},
    "securityDefinitions": {
        "oauth2_auth": {
            "type": "oauth2",
            "flow": "accessCode",
            "authorizationUrl": "https://user.snapforms.com.au/oauth/authorize",
            "tokenUrl": "https://user.snapforms.com.au/oauth/token",
            "scopes": {}
        }
    },
    "security": [
        {
            "oauth2_auth": []
        }
    ],
    "tags": []
}
