openapi: 3.1.0 info: title: Loops OpenAPI Spec API key Contacts API description: This is the OpenAPI Spec for the [Loops API](https://loops.so/docs/api). version: 1.8.0 servers: - url: https://app.loops.so/api/v1 tags: - name: Contacts description: Manage contacts in your audience paths: /contacts/create: post: tags: - Contacts summary: Create a contact description: Add a contact to your audience. requestBody: description: You can add custom contact properties as keys in this request (of type `string`, `number`, `boolean` or `date` ([see available date formats](https://loops.so/docs/contacts/properties#dates))).
Make sure to create the properties in Loops before using them in API calls. content: application/json: schema: $ref: '#/components/schemas/ContactRequest' required: true responses: '200': description: Successful create. content: application/json: schema: $ref: '#/components/schemas/ContactSuccessResponse' '400': description: Bad request (e.g. invalid email address). content: application/json: schema: $ref: '#/components/schemas/ContactFailureResponse' '405': description: Wrong HTTP request method. '409': description: Email or `userId` already exists. content: application/json: schema: $ref: '#/components/schemas/ContactFailureResponse' security: - apiKey: [] /contacts/update: put: tags: - Contacts summary: Update a contact description: Update a contact by `email` or `userId`. You must provide one of these parameters.
If you want to update a contact’s email address, the contact will first need a `userId` value. You can then make a request containing the userId field along with an updated email address. requestBody: description: You can add custom contact properties as keys in this request (of type `string`, `number`, `boolean` or `date` ([see available date formats](https://loops.so/docs/contacts/properties#dates))).
Make sure to create the properties in Loops before using them in API calls. content: application/json: schema: $ref: '#/components/schemas/ContactUpdateRequest' required: true responses: '200': description: Successful update. content: application/json: schema: $ref: '#/components/schemas/ContactSuccessResponse' '400': description: Bad request (e.g. `email` or `userId` are missing). content: application/json: schema: $ref: '#/components/schemas/ContactFailureResponse' '405': description: Wrong HTTP request method. security: - apiKey: [] /contacts/find: get: tags: - Contacts summary: Find a contact description: Search for a contact by `email` or `userId`. Only one parameter is allowed. parameters: - name: email in: query required: false description: Email address (URI-encoded) schema: type: string - name: userId in: query required: false schema: type: string responses: '200': description: List of contacts (or an empty array if no contact was found). Contact objects will include any custom properties. content: application/json: schema: type: array items: $ref: '#/components/schemas/Contact' '400': description: Bad request (e.g. invalid email address). content: application/json: schema: $ref: '#/components/schemas/ContactFailureResponse' '405': description: Wrong HTTP request method. security: - apiKey: [] /contacts/delete: post: tags: - Contacts summary: Delete a contact description: Delete a contact by `email` or `userId`. requestBody: description: Include only one of `email` or `userId`. content: application/json: schema: $ref: '#/components/schemas/ContactDeleteRequest' required: true responses: '200': description: Successful delete. content: application/json: schema: $ref: '#/components/schemas/ContactDeleteResponse' '400': description: Bad request (e.g. `email` and `userId` are both provided). content: application/json: schema: $ref: '#/components/schemas/ContactFailureResponse' '404': description: Contact not found. content: application/json: schema: $ref: '#/components/schemas/ContactFailureResponse' '405': description: Wrong HTTP request method. security: - apiKey: [] /contacts/suppression: get: tags: - Contacts summary: Get suppression status for a contact description: Retrieve suppression status and removal quota for a contact by `email` or `userId`. Include only one query parameter. parameters: - name: email in: query required: false description: Email address (URI-encoded) schema: type: string - name: userId in: query required: false schema: type: string responses: '200': description: Successful. content: application/json: schema: $ref: '#/components/schemas/ContactSuppressionStatusResponse' '400': description: Bad request (e.g. invalid email address). content: application/json: schema: $ref: '#/components/schemas/ContactFailureResponse' '404': description: Contact not found. content: application/json: schema: $ref: '#/components/schemas/ContactFailureResponse' '405': description: Wrong HTTP request method. security: - apiKey: [] delete: tags: - Contacts summary: Remove a contact from suppression list description: Remove a suppressed contact from the suppression list by `email` or `userId`. Include only one query parameter. parameters: - name: email in: query required: false description: Email address (URI-encoded) schema: type: string - name: userId in: query required: false schema: type: string responses: '200': description: Successful removal. content: application/json: schema: $ref: '#/components/schemas/ContactSuppressionRemoveResponse' '400': description: Bad request (e.g. contact is not suppressed). content: application/json: schema: $ref: '#/components/schemas/ContactFailureResponse' '404': description: Contact not found. content: application/json: schema: $ref: '#/components/schemas/ContactFailureResponse' '405': description: Wrong HTTP request method. security: - apiKey: [] components: schemas: ContactSuppressionRemoveResponse: type: object properties: success: type: boolean examples: - true message: type: string examples: - Email removed from suppression list. removalQuota: $ref: '#/components/schemas/ContactSuppressionRemovalQuota' required: - success - message - removalQuota ContactUpdateRequest: type: object properties: email: type: string firstName: type: string lastName: type: string subscribed: type: boolean userGroup: type: string userId: type: string mailingLists: type: object description: An object of mailing list IDs and boolean subscription statuses. examples: - list_123: true additionalProperties: oneOf: - type: string - type: number - type: boolean ContactSuppressionStatusResponse: type: object properties: contact: type: object properties: id: type: string email: type: string userId: type: - string - 'null' required: - id - email - userId isSuppressed: type: boolean removalQuota: $ref: '#/components/schemas/ContactSuppressionRemovalQuota' required: - contact - isSuppressed - removalQuota ContactRequest: type: object required: - email properties: email: type: string firstName: type: string lastName: type: string subscribed: type: boolean userGroup: type: string userId: type: string mailingLists: type: object description: An object of mailing list IDs and boolean subscription statuses. examples: - list_123: true additionalProperties: oneOf: - type: string - type: number - type: boolean ContactSuppressionRemovalQuota: type: object properties: limit: type: number remaining: type: number required: - limit - remaining ContactDeleteRequest: type: object properties: email: type: string userId: type: string required: - email - userId ContactDeleteResponse: type: object properties: success: type: boolean examples: - true message: type: string examples: - Contact deleted. required: - success - message ContactFailureResponse: type: object properties: success: type: boolean examples: - false message: type: string required: - success - message ContactSuccessResponse: type: object properties: success: type: boolean examples: - true id: type: string required: - success - id Contact: type: object properties: id: type: string email: type: string firstName: type: - string - 'null' lastName: type: - string - 'null' source: type: string subscribed: type: boolean userGroup: type: string userId: type: - string - 'null' mailingLists: type: object description: An object of mailing list IDs and boolean subscription statuses. examples: - list_123: true optInStatus: type: - string - 'null' description: Double opt-in status. enum: - accepted - pending - rejected - null securitySchemes: apiKey: type: http scheme: bearer