{
    "swagger": "2.0",
    "x-navigateMethodsByName": true,
    "info": {
        "description": "This is the specification for our Contacts REST API.",
        "version": "0.1.0",
        "title": "Contacts REST API",
        "termsOfService": "https://www.snapaddy.com/de/agb.html",
        "contact": {
            "email": "info@snapaddy.com"
        },
        "license": {
            "name": "Apache 2.0",
            "url": "http://www.apache.org/licenses/LICENSE-2.0.html"
        }
    },
    "host": "api.snapaddy.com",
    "basePath": "/grabber/v1",
    "tags": [{
        "name": "contactlist",
        "description": "Contact Lists"
    }, {
        "name": "contactitem",
        "description": "Contact Items"
    }, {
        "name": "attachment",
        "description": "Attachments"
    }],
    "schemes": ["https"],
    "paths": {
        "/attachment/{contactItemId}/{attachmentId}": {
            "get": {
                "tags": ["attachment"],
                "summary": "Retrieve attachments of contact items",
                "description": "Retrieve attachments of contact items such as contact photos.",
                "operationId": "getContactItemAttachment",
                "produces": ["application/pdf", "image/png", "image/jpeg", "image/gif", "image/bmp"],
                "parameters": [{
                    "name": "contactItemId",
                    "in": "path",
                    "description": "Id of the contact item to retrieve attachments for",
                    "required": true,
                    "type": "string"
                }, {
                    "name": "attachmentId",
                    "in": "path",
                    "description": "Id of the attachment to retrieve",
                    "required": true,
                    "type": "string"
                }],
                "responses": {
                    "200": {
                        "description": "Success"
                    },
                    "401": {
                        "description": "Unauthorized"
                    },
                    "404": {
                        "description": "Not Found"
                    }
                }
            }
        },
        "/contactlist": {
            "get": {
                "tags": ["contactlist"],
                "summary": "Retrieve your contact lists",
                "description": "Retrieves a list of all of your contact lists.",
                "operationId": "getContactLists",
                "produces": ["application/json"],
                "parameters": [],
                "responses": {
                    "200": {
                        "description": "Success",
                        "schema": {
                            "type": "array",
                            "items": {
                                "$ref": "#/definitions/ContactList"
                            }
                        }
                    },
                    "401": {
                        "description": "Unauthorized",
                        "schema": {
                            "$ref": "#/definitions/Error"
                        }
                    },
                    "500": {
                        "description": "Internal Server Error",
                        "schema": {
                            "$ref": "#/definitions/Error"
                        }
                    }
                }
            }
        },
        "/contactlist/{listId}/count": {
            "get": {
                "tags": ["contactlist"],
                "summary": "Retrieve size of a contact list",
                "description": "Retrieves the number of contact items that are part of your contact list specified by {listId}.",
                "operationId": "getContactListSize",
                "produces": ["application/json"],
                "parameters": [{
                    "name": "listId",
                    "in": "path",
                    "description": "ID of the contact list",
                    "required": true,
                    "type": "string"
                }],
                "responses": {
                    "200": {
                        "description": "Success",
                        "schema": {
                            "title": "Size",
                            "type": "object",
                            "properties": {
                                "count": {
                                    "type": "integer",
                                    "format": "int32",
                                    "description": "Size of your contact list"
                                }
                            }
                        }

                    },
                    "401": {
                        "description": "Unauthorized",
                        "schema": {
                            "$ref": "#/definitions/Error"
                        }
                    },
                    "500": {
                        "description": "Internal Server Error",
                        "schema": {
                            "$ref": "#/definitions/Error"
                        }
                    }
                }
            }
        },
        "/contactlist/{listId}/contactitems": {
            "get": {
                "tags": ["contactlist", "contactitems"],
                "summary": "Retrieve contact items from contact list",
                "description": "Retrieves a list of contact items that are part of your contact list specified by {listId}.",
                "operationId": "getContactItemsFromContactList",
                "produces": ["application/json"],
                "parameters": [{
                    "name": "listId",
                    "in": "path",
                    "description": "ID of the contact list",
                    "required": true,
                    "type": "string"
                }, {
                    "name": "page",
                    "in": "query",
                    "description": "Pagination offset starting at 0 (default: 0)",
                    "required": false,
                    "type": "integer",
                    "format": "int32"
                }, {
                    "name": "limit",
                    "in": "query",
                    "description": "Pagination limit (default: 15)",
                    "required": false,
                    "type": "integer",
                    "format": "int32"
                }],
                "responses": {
                    "200": {
                        "description": "Success",
                        "schema": {
                            "type": "array",
                            "items": {
                                "$ref": "#/definitions/ContactItem"
                            }
                        }
                    },
                    "401": {
                        "description": "Unauthorized",
                        "schema": {
                            "$ref": "#/definitions/Error"
                        }
                    },
                    "500": {
                        "description": "Internal Server Error",
                        "schema": {
                            "$ref": "#/definitions/Error"
                        }
                    }
                }
            }
        },
        "/contactitem": {
            "post": {
                "tags": ["contactitem"],
                "summary": "Create a new contact item",
                "description": "Creates a new contact item with the given information.",
                "operationId": "createContactItem",
                "produces": ["application/json"],
                "consumes": ["application/json"],
                "parameters": [{
                    "name": "payload",
                    "in": "body",
                    "required": true,
                    "schema": {
                        "$ref": "#/definitions/ContactItem"
                    }
                }],
                "responses": {
                    "200": {
                        "description": "Success",
                        "schema": {
                            "$ref": "#/definitions/ContactItem"
                        }
                    },
                    "401": {
                        "description": "Unauthorized",
                        "schema": {
                            "$ref": "#/definitions/Error"
                        }
                    },
                    "500": {
                        "description": "Internal Server Error",
                        "schema": {
                            "$ref": "#/definitions/Error"
                        }
                    }
                }
            }
        },
        "/contactitem/{itemId}": {
            "get": {
                "tags": ["contactitem"],
                "summary": "Retrieve a single contact item",
                "description": "Retrieve a single contact item specified by {itemId}.",
                "operationId": "getContactItem",
                "produces": ["application/json"],
                "parameters": [{
                    "name": "itemId",
                    "in": "path",
                    "description": "ID of the contact item",
                    "required": true,
                    "type": "string"
                }],
                "responses": {
                    "200": {
                        "description": "Success",
                        "schema": {
                            "$ref": "#/definitions/ContactItem"
                        }
                    },
                    "401": {
                        "description": "Unauthorized",
                        "schema": {
                            "$ref": "#/definitions/Error"
                        }
                    },
                    "404": {
                        "description": "Not Found",
                        "schema": {
                            "$ref": "#/definitions/Error"
                        }
                    },
                    "500": {
                        "description": "Internal Server Error",
                        "schema": {
                            "$ref": "#/definitions/Error"
                        }
                    }
                }
            },
            "put": {
                "tags": ["contactitem"],
                "summary": "Update an existing contact item",
                "description": "Updates an existing contact item specified by {itemId} with the given information.",
                "operationId": "updateContactItem",
                "produces": ["application/json"],
                "parameters": [{
                    "name": "itemId",
                    "in": "path",
                    "description": "ID of the contact item",
                    "required": true,
                    "type": "string"
                }, {
                    "in": "body",
                    "name": "payload",
                    "schema": {
                        "$ref": "#/definitions/ContactItem"
                    }
                }],
                "responses": {
                    "200": {
                        "description": "Success",
                        "schema": {
                            "$ref": "#/definitions/ContactItem"
                        }
                    },
                    "401": {
                        "description": "Unauthorized",
                        "schema": {
                            "$ref": "#/definitions/Error"
                        }
                    },
                    "404": {
                        "description": "Not Found",
                        "schema": {
                            "$ref": "#/definitions/Error"
                        }
                    },
                    "409": {
                        "description": "Conflict",
                        "schema": {
                            "$ref": "#/definitions/Error"
                        }
                    },
                    "500": {
                        "description": "Internal Server Error",
                        "schema": {
                            "$ref": "#/definitions/Error"
                        }
                    }
                }
            },
            "delete": {
                "tags": ["contactitem"],
                "summary": "Delete an existing contact item",
                "description": "Deletes an existing contact item specified by {itemId}.",
                "operationId": "deleteContactItem",
                "produces": ["application/json"],
                "parameters": [{
                    "name": "itemId",
                    "in": "path",
                    "description": "ID of the contact item",
                    "required": true,
                    "type": "string"
                }],
                "responses": {
                    "200": {
                        "description": "The contact item was deleted successfully."
                    },
                    "401": {
                        "description": "Unauthorized",
                        "schema": {
                            "$ref": "#/definitions/Error"
                        }
                    },
                    "404": {
                        "description": "Not Found",
                        "schema": {
                            "$ref": "#/definitions/Error"
                        }
                    },
                    "500": {
                        "description": "Internal Server Error",
                        "schema": {
                            "$ref": "#/definitions/Error"
                        }
                    }
                }
            }
        }
    },
    "securityDefinitions": {
        "api_key": {
            "type": "apiKey",
            "name": "X-API-Token",
            "in": "header"
        }
    },
    "security": [{
        "api_key": []
    }],
    "definitions": {
        "Contact": {
            "description": "The entity that actually contains the contact specific data.",
            "title": "Contact",
            "type": "object",
            "required": [
                "firstName",
                "lastName",
                "organization",
                "email",
                "phone",
                "bcImage",
                "bcImageBackside",
                "bcImageLocal",
                "bcImageBacksideLocal",
                "bcChecked",
                "drawing",
                "image",
                "industry",
                "note",
                "gender",
                "title",
                "position",
                "mobile",
                "fax",
                "website",
                "vat",
                "street",
                "city",
                "poBox",
                "state",
                "zip",
                "country",
                "xing",
                "linkedin",
                "facebook",
                "twitter",
                "attachments",
                "industry",
                "companySize",
                "revenue"
            ],
            "properties": {
                "firstName": {
                    "type": "string"
                },
                "lastName": {
                    "type": "string"
                },
                "organization": {
                    "type": "string"
                },
                "email": {
                    "type": "string"
                },
                "phone": {
                    "type": "string"
                },
                "bcImage": {
                    "type": "string"
                },
                "bcImageBackside": {
                    "type": "string"
                },
                "bcImageLocal": {
                    "type": "string"
                },
                "bcImageBacksideLocal": {
                    "type": "string"
                },
                "bcChecked": {
                    "type": "boolean"
                },
                "drawing": {
                    "type": "string"
                },
                "image": {
                    "type": "string"
                },
                "industry": {
                    "type": "string",
                    "description": "LinkedIn industry code as defined <a href=\"/contacts-rest-api/guides/industry-codes\">here</a>"
                },
                "note": {
                    "type": "string"
                },
                "gender": {
                    "type": "integer",
                    "description": "-1 (neutral), 0 (male) or 1 (female)"
                },
                "title": {
                    "type": "string"
                },
                "position": {
                    "type": "string"
                },
                "mobile": {
                    "type": "string"
                },
                "fax": {
                    "type": "string"
                },
                "website": {
                    "type": "string"
                },
                "vat": {
                    "type": "string"
                },
                "street": {
                    "type": "string"
                },
                "city": {
                    "type": "string"
                },
                "zip": {
                    "type": "string"
                },
                "poBox": {
                    "type": "string"
                },
                "state": {
                    "type": "string"
                },
                "country": {
                    "type": "string"
                },
                "xing": {
                    "type": "string"
                },
                "linkedin": {
                    "type": "string"
                },
                "facebook": {
                    "type": "string"
                },
                "twitter": {
                    "type": "string"
                },
                "attachments": {
                    "type": "array",
                    "items": {
                        "type": "string"
                    }
                },
                "companySize": {
                    "type": "string",
                    "enum": [
                        "1-10",
                        "11-50",
                        "51-200",
                        "201-500",
                        "501-1000",
                        "1001-5000",
                        "5001-10000",
                        "10000+"
                    ]
                },
                "revenue": {
                    "type": "string"
                }
            }
        },
        "ContactItem": {
            "description": "Encapsulates contacts and always belongs to a specific contact list.",
            "title": "ContactItem",
            "type": "object",
            "allOf": [
                {
                    "$ref": "#/definitions/Contact"
                },
                {
                    "type": "object",
                    "required": ["customFields", "contactListId"],
                    "properties": {
                         "contactListId": {
                             "description": "The id of the corresponding contact list a contact item belongs to.",
                             "type": "string"
                         },
                         "createdBy": {
                             "type": "string",
                             "readOnly": true
                         },
                         "sequenceNumber": {
                             "type": "number",
                             "description": "This is used to order items within a list (default: null -> appears on top)",
                             "readOnly": true
                         },
                         "customFields": {
                            "type": "object",
                            "additionalProperties": {
                                "description": "This might be any viable JSON value.",
                                "type": ["object", "array", "string", "number", "bool"]
                            }
                         }
                     }
                }
            ]
        },
        "ContactList": {
            "description": "A list of contact items that belongs to an organization",
            "title": "ContactList",
            "type": "object",
            "properties": {
                "organizationId": {
                    "description": "The id of the organization a contact list belongs to.",
                    "type": "string"
                },
                "name": {
                    "description": "The name of a contact list.",
                    "type": "string"
                },
                "isMain": {
                    "type": "boolean"
                },
                "client": {
                    "type": "string"
                },
                "contacts": {
                    "description": "The list of contact items that belong to a contact list",
                    "type": "array",
                    "items": {
                        "$ref": "#/definitions/ContactItem"
                    }
                }
            }
        },
        "ExportedAttachment": {
            "title": "ExportedAttachment",
            "type": "object",
            "properties": {
                "url": {
                    "type": "string"
                }
            }
        },
        "CustomField": {
            "title": "CustomField",
            "type": "object",
            "required": ["id", "type", "label", "properties"],
            "properties": {
                "id": {
                    "type": "string"
                },
                "type": {
                    "type": "string",
                    "enum": ["SELECT"]
                },
                "label": {
                    "$ref": "#/definitions/CustomFieldLabelObject"
                },
                "properties": {
                    "type": "object",
                    "required": ["defaultValue", "options"],
                    "properties": {
                        "defaultValue": {
                            "type": "string"
                        },
                        "options": {
                            "type": "array",
                            "items": {
                                "$ref": "#/definitions/CustomFieldOptionObject"
                            }
                        }
                    }
                }
            }
        },
        "CustomFieldOptionObject": {
            "title": "CustomFieldOptionObject",
            "type": "object",
            "required": ["label", "value"],
            "properties": {
                "label": {
                    "$ref": "#/definitions/CustomFieldLabelObject"
                },
                "value": {
                    "type": "string"
                }
            }
        },
        "CustomFieldLabelObject": {
            "title": "CustomFieldLabelObject",
            "type": "object",
            "required": ["DE", "GB"],
            "properties": {
                "DE": {
                    "type": "string"
                },
                "GB": {
                    "type": "string"
                }
            }
        },
        "Error": {
            "title": "Error",
            "type": "object",
            "properties": {
                "ERROR": {
                    "type": "string",
                    "description": "The corresponding error message"
                }
            }
        }
    }
}
