{
  "openapi": "3.0.2",
  "info": {
    "title": "Livstick Public API V2.0",
    "description": "If you're using our v1 please refer to the corresponding <a href='https://www.livstick.com/api'>documentation</a>",
    "contact": {
      "email": "contact@livstick.com"
    },
    "version": "1.0"
  },
  "servers": [
    {
      "url": "/v2"
    }
  ],
  "tags": [
    {
      "name": "User",
      "description": "APIs containing a public key, potentially visible to our users. These APIs are used to enable the recording of a message. This APIs are also used by the widget, the key associated is required to be given to it (<a href='https://s3.livstick.com/livstick-widget/doc/index.html' target='_blank'>More about the widget</a>)"
    },
    {
      "name": "Client",
      "description": "APIs containing a private key only needed to be known by your IT service. It should not be used on a User's environment"
    }
  ],
  "paths": {
    "/client/{key}/{crid}/modify": {
      "post": {
        "description": "Allows to replace a temporary crid aswell as adding (if needed) an email address and/or a shipment tracking.",
        "tags": [
          "Client"
        ],
        "parameters": [
          {
            "in": "path",
            "name": "key",
            "schema": {
              "type": "string"
            },
            "required": true,
            "description": "Your Platform authentification key"
          },
          {
            "in": "path",
            "name": "crid",
            "schema": {
              "type": "string"
            },
            "required": true,
            "description": "Customer Reference Unique Id (CRID)"
          }
        ],
        "requestBody": {
          "description": "Required json post request",
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DataRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ValidResponse"
                }
              }
            }
          },
          "400": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InvalidResponse"
                }
              }
            }
          }
        }
      }
    },
    "/client/{key}/{crid}/notify": {
      "post": {
        "description": "When a delivery occurred, this API will push (by email or text message, depending on the information given to the system by the Gifter) the video message to its right Giftee",
        "tags": [
          "Client"
        ],
        "parameters": [
          {
            "in": "path",
            "name": "key",
            "schema": {
              "type": "string"
            },
            "required": true,
            "description": "Your Platform authentification key"
          },
          {
            "in": "path",
            "name": "crid",
            "schema": {
              "type": "string"
            },
            "required": true,
            "description": "Customer Reference Unique Id (CRID)"
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ValidResponse"
                }
              }
            }
          },
          "400": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InvalidResponse"
                }
              }
            }
          }
        }
      }
    },
    "/user/{key}/{crid}/redirect": {
      "get": {
        "description": "",
        "tags": [
          "User"
        ],
        "parameters": [
          {
            "in": "path",
            "name": "key",
            "schema": {
              "type": "string"
            },
            "required": true,
            "description": "Your Platform authentification key"
          },
          {
            "in": "path",
            "name": "crid",
            "schema": {
              "type": "string"
            },
            "required": true,
            "description": "Customer Reference Unique Id (CRID)"
          }
        ],
        "responses": {
          "301": {
            "description": "Redirect to the recording Page URL"
          },
          "400": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InvalidResponse"
                }
              }
            }
          }
        }
      }
    },
    "/client/{key}/{crid}/redirect": {
      "get": {
        "description": "",
        "tags": [
          "Client"
        ],
        "parameters": [
          {
            "in": "path",
            "name": "key",
            "schema": {
              "type": "string"
            },
            "required": true,
            "description": "Your Platform authentification key"
          },
          {
            "in": "path",
            "name": "crid",
            "schema": {
              "type": "string"
            },
            "required": true,
            "description": "Customer Reference Unique Id (CRID)"
          }
        ],
        "responses": {
          "200": {
            "description": "generate url to redirect to a generated urid",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RedirectResponse"
                }
              }
            }
          },
          "400": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InvalidResponse"
                }
              }
            }
          }
        }
      }
    },
    "/client/{key}/{crid}/retarget": {
      "post": {
        "description": "",
        "tags": [
          "Client"
        ],
        "parameters": [
          {
            "in": "path",
            "name": "key",
            "schema": {
              "type": "string"
            },
            "required": true,
            "description": "Your Platform authentification key"
          },
          {
            "in": "path",
            "name": "crid",
            "schema": {
              "type": "string"
            },
            "required": true,
            "description": "Customer Reference Unique Id (CRID)"
          }
        ],
        "requestBody": {
          "description": "Required json post request",
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CridDataRequest"
              }
            }
          }
        },
        "responses": {
          "301": {
            "description": "Redirect to the recording Page URL"
          },
          "400": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InvalidResponse"
                }
              }
            }
          }
        }
      }
    },
    "/client/{key}/{crid}/qrcode": {
      "get": {
        "description": "",
        "tags": [
          "Client"
        ],
        "parameters": [
          {
            "in": "path",
            "name": "key",
            "schema": {
              "type": "string"
            },
            "required": true,
            "description": "Your Platform authentification key"
          },
          {
            "in": "path",
            "name": "crid",
            "schema": {
              "type": "string"
            },
            "required": true,
            "description": "Customer Reference Unique Id (CRID)"
          }
        ],
        "responses": {
          "200": {
            "description": "send back image file",
            "content": {}
          },
          "400": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InvalidResponse"
                }
              }
            }
          }
        }
      },
      "post": {
        "description": "",
        "tags": [
          "Client"
        ],
        "parameters": [
          {
            "in": "path",
            "name": "key",
            "schema": {
              "type": "string"
            },
            "required": true,
            "description": "Your Platform authentification key"
          },
          {
            "in": "path",
            "name": "crid",
            "schema": {
              "type": "string"
            },
            "required": true,
            "description": "Customer Reference Unique Id (CRID)"
          }
        ],
        "responses": {
          "200": {
            "description": "send back image file",
            "content": {}
          },
          "400": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InvalidResponse"
                }
              }
            }
          }
        }
      }
    },
    "/client/{key}/{crid}/details": {
      "post": {
        "description": "This API will return all the declarative information typed by a Gifter such as its name, first name, email address and more if any.",
        "tags": [
          "Client"
        ],
        "parameters": [
          {
            "in": "path",
            "name": "key",
            "schema": {
              "type": "string"
            },
            "required": true,
            "description": "Your Platform authentification key"
          },
          {
            "in": "path",
            "name": "crid",
            "schema": {
              "type": "string"
            },
            "required": true,
            "description": "Customer Reference Unique Id (CRID)"
          }
        ],
        "responses": {
          "200": {
            "description": "data concerning the customer's message",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DetailsResponse"
                }
              }
            }
          },
          "400": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InvalidResponse"
                }
              }
            }
          }
        }
      }
    },
    "/client/{key}/{crid}/webhook/{webhookId}": {
      "post": {
        "description": "",
        "tags": [
          "Client"
        ],
        "parameters": [
          {
            "in": "path",
            "name": "key",
            "schema": {
              "type": "string"
            },
            "required": true,
            "description": "Your Platform authentification key"
          },
          {
            "in": "path",
            "name": "crid",
            "schema": {
              "type": "string"
            },
            "required": true,
            "description": "Customer Reference Unique Id (CRID)"
          },
          {
            "in": "path",
            "name": "webhookId",
            "schema": {
              "type": "string"
            },
            "required": true,
            "description": "Specific webhook id provided by Livstick"
          }
        ],
        "requestBody": {
          "description": "Required json post request",
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/WebhookRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success"
          },
          "400": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InvalidResponse"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "ValidResponse": {
        "type": "object",
        "properties": {
          "status": {
            "type": "number",
            "readOnly": true,
            "nullable": false,
            "example": 0
          }
        }
      },
      "DetailsResponse": {
        "type": "object",
        "properties": {
          "status": {
            "type": "number",
            "readOnly": true,
            "nullable": false,
            "example": 0
          },
          "data": {
            "type": "object",
            "readOnly": true,
            "nullable": false,
            "example": {
              "receiverEmail": "livstick@meemento.com",
              "senderEmail": "meemento@meemento.com",
              "messageNotified": "email",
              "firstname": "Olivier",
              "lastname": "Adler",
              "videoUrl": "UrlToVideo",
              "messageUrl": "UrlToMessage"
            }
          }
        }
      },
      "RedirectResponse": {
        "type": "object",
        "properties": {
          "urlPreview": {
            "type": "string",
            "readOnly": true,
            "nullable": false,
            "example": "https://demo-v5.livstick.com/preview/urid"
          },
          "url": {
            "type": "string",
            "readOnly": true,
            "nullable": false,
            "example": "https://demo-v5.livstick.com/urid"
          }
        }
      },
      "InvalidResponse": {
        "type": "object",
        "properties": {
          "status": {
            "type": "number",
            "readOnly": true,
            "nullable": false,
            "example": 1
          },
          "error": {
            "type": "string",
            "enum": [
              "crid_invalid",
              "key_invalid",
              "data_invalid"
            ]
          }
        }
      },
      "DataRequest": {
        "type": "object",
        "properties": {
          "newcrid": {
            "type": "string",
            "description": "New Customer Reference Unique Id (CRID)"
          },
          "email": {
            "type": "string",
            "description": "New email to be used"
          },
          "shipmentCode": {
            "type": "string",
            "description": "Tracking number of the order shipped"
          },
          "shipmentCarrier": {
            "type": "string",
            "description": "Carrier used to ship the order",
            "enum": [
              "chronopost",
              "ups",
              "dhl",
              "other"
            ]
          }
        }
      },
      "CridDataRequest": {
        "type": "object",
        "properties": {
          "email": {
            "type": "string",
            "description": "Customer email",
            "example": "qkQp1@example.com"
          },
          "language": {
            "type": "string",
            "description": "country on 2 character (ex: fr)",
            "example": "fr_fr"
          },
          "codeGroup": {
            "type": "string",
            "description": "Code Group Public ID (optional)",
            "example": "codeGroupId"
          },
          "additionalData": {
            "type": "object",
            "example": {
              "gifter_name": "Jean-Luc",
              "gifter_lastname": "Picard",
              "giftee_name": "John",
              "giftee_lastname": "Wick",
              "...": "...{any property}"
            },
            "description": "Additional data we might need to personalize the user experience (keys are gifter_name, gifter_lastname, giftee_name, giftee_lastname) contact us if there is additional information to be used."
          }
        }
      },
      "WebhookRequest": {
        "type": "object"
      }
    }
  }
}
