UNPKG

@noobforal/openphone-api-sdk

Version:

Unofficial TypeScript SDK for OpenPhone Public API (AI-generated - use with caution)

1,368 lines 240 kB
/** * This file was auto-generated by openapi-typescript. * Do not make direct changes to the file. */ export interface paths { '/v1/calls': { parameters: { query?: never; header?: never; path?: never; cookie?: never; }; /** * List calls * @description Fetch a paginated list of calls associated with a specific OpenPhone number and another number. */ get: operations['listCalls_v1']; put?: never; post?: never; delete?: never; options?: never; head?: never; patch?: never; trace?: never; }; '/v1/calls/{callId}': { parameters: { query?: never; header?: never; path?: never; cookie?: never; }; /** * Get a call by ID * @description Get a call by its unique identifier. */ get: operations['getCallById_v1']; put?: never; post?: never; delete?: never; options?: never; head?: never; patch?: never; trace?: never; }; '/v1/call-recordings/{callId}': { parameters: { query?: never; header?: never; path?: never; cookie?: never; }; /** * Get recordings for a call * @description Retrieve a list of recordings associated with a specific call. The results are sorted chronologically, with the oldest recording segment appearing first in the list. */ get: operations['getCallRecordings_v1']; put?: never; post?: never; delete?: never; options?: never; head?: never; patch?: never; trace?: never; }; '/v1/call-summaries/{callId}': { parameters: { query?: never; header?: never; path?: never; cookie?: never; }; /** * Get a summary for a call * @description Retrieve an AI-generated summary of a specific call identified by its unique call ID. Call summaries are only available on OpenPhone Business plan. */ get: operations['getCallSummary_v1']; put?: never; post?: never; delete?: never; options?: never; head?: never; patch?: never; trace?: never; }; '/v1/call-transcripts/{id}': { parameters: { query?: never; header?: never; path?: never; cookie?: never; }; /** * Get a transcription for a call * @description Retrieve a detailed transcript of a specific call identified by its unique call ID. Call transcripts are only available on OpenPhone business plan. */ get: operations['getCallTranscript_v1']; put?: never; post?: never; delete?: never; options?: never; head?: never; patch?: never; trace?: never; }; '/v1/contact-custom-fields': { parameters: { query?: never; header?: never; path?: never; cookie?: never; }; /** * Get contact custom fields * @description Custom contact fields enhance your OpenPhone contacts with additional information beyond standard details like name, company, role, emails and phone numbers. These user-defined fields let you capture business-specific data. While you can only create or modify these fields in OpenPhone itself, this endpoint retrieves your existing custom properties. Use this information to accurately map and include important custom data when creating new contacts via the API. */ get: operations['getContactCustomFields_v1']; put?: never; post?: never; delete?: never; options?: never; head?: never; patch?: never; trace?: never; }; '/v1/contacts': { parameters: { query?: never; header?: never; path?: never; cookie?: never; }; /** * List contacts * @description Retrieve a paginated list of contacts. You can optionally filter the results by providing external IDs and sources. When no external IDs are provided, all contacts for the organization are returned. */ get: operations['listContacts_v1']; put?: never; /** * Create a contact * @description Create a contact for a workspace. */ post: operations['createContact_v1']; delete?: never; options?: never; head?: never; patch?: never; trace?: never; }; '/v1/contacts/{id}': { parameters: { query?: never; header?: never; path?: never; cookie?: never; }; /** * Get a contact by ID * @description Retrieve detailed information about a specific contact in your OpenPhone workspace using the contact's unique identifier. */ get: operations['getContactById_v1']; put?: never; post?: never; /** * Delete a contact * @description Delete a contact by its unique identifier. */ delete: operations['deleteContact_v1']; options?: never; head?: never; /** * Update a contact by ID * @description Modify an existing contact in your OpenPhone workspace using the contact's unique identifier. */ patch: operations['updateContactById_v1']; trace?: never; }; '/v1/conversations': { parameters: { query?: never; header?: never; path?: never; cookie?: never; }; /** * List Conversations * @description Fetch a paginated list of conversations of OpenPhone conversations. Can be filtered by user and/or phone numbers. Defaults to all conversations in the OpenPhone organization. Results are returned in descending order based on the most recent conversation. */ get: operations['listConversations_v1']; put?: never; post?: never; delete?: never; options?: never; head?: never; patch?: never; trace?: never; }; '/v1/messages': { parameters: { query?: never; header?: never; path?: never; cookie?: never; }; /** * List messages * @description Retrieve a chronological list of messages exchanged between your OpenPhone number and specified participants, with support for filtering and pagination. */ get: operations['listMessages_v1']; put?: never; /** * Send a text message * @description Send a text message from your OpenPhone number to a recipient. */ post: operations['sendMessage_v1']; delete?: never; options?: never; head?: never; patch?: never; trace?: never; }; '/v1/messages/{id}': { parameters: { query?: never; header?: never; path?: never; cookie?: never; }; /** * Get a message by ID * @description Get a message by its unique identifier. */ get: operations['getMessageById_v1']; put?: never; post?: never; delete?: never; options?: never; head?: never; patch?: never; trace?: never; }; '/v1/phone-numbers': { parameters: { query?: never; header?: never; path?: never; cookie?: never; }; /** * List phone numbers * @description Retrieve the list of phone numbers and users associated with your OpenPhone workspace. */ get: operations['listPhoneNumbers_v1']; put?: never; post?: never; delete?: never; options?: never; head?: never; patch?: never; trace?: never; }; '/v1/webhooks': { parameters: { query?: never; header?: never; path?: never; cookie?: never; }; /** * Lists all webhooks * @description List all webhooks for a user. */ get: operations['listWebhooks_v1']; put?: never; post?: never; delete?: never; options?: never; head?: never; patch?: never; trace?: never; }; '/v1/webhooks/{id}': { parameters: { query?: never; header?: never; path?: never; cookie?: never; }; /** * Get a webhook by ID * @description Get a webhook by its unique identifier. */ get: operations['getWebhookById_v1']; put?: never; post?: never; /** * Delete a webhook by ID * @description Delete a webhook by its unique identifier. */ delete: operations['deleteWebhookById_v1']; options?: never; head?: never; patch?: never; trace?: never; }; '/v1/webhooks/messages': { parameters: { query?: never; header?: never; path?: never; cookie?: never; }; get?: never; put?: never; /** * Create a new webhook for messages * @description Creates a new webhook that triggers on events from messages. */ post: operations['createMessageWebhook_v1']; delete?: never; options?: never; head?: never; patch?: never; trace?: never; }; '/v1/webhooks/calls': { parameters: { query?: never; header?: never; path?: never; cookie?: never; }; get?: never; put?: never; /** * Create a new webhook for calls * @description Creates a new webhook that triggers on events from calls. */ post: operations['createCallWebhook_v1']; delete?: never; options?: never; head?: never; patch?: never; trace?: never; }; '/v1/webhooks/call-summaries': { parameters: { query?: never; header?: never; path?: never; cookie?: never; }; get?: never; put?: never; /** * Create a new webhook for call summaries * @description Creates a new webhook that triggers on events from call summaries. */ post: operations['createCallSummaryWebhook_v1']; delete?: never; options?: never; head?: never; patch?: never; trace?: never; }; '/v1/webhooks/call-transcripts': { parameters: { query?: never; header?: never; path?: never; cookie?: never; }; get?: never; put?: never; /** * Create a new webhook for call transcripts * @description Creates a new webhook that triggers on events from call transcripts. */ post: operations['createCallTranscriptWebhook_v1']; delete?: never; options?: never; head?: never; patch?: never; trace?: never; }; } export type webhooks = Record<string, never>; export interface components { schemas: { ListPhoneNumbersResponse: { data: { /** * @description The unique identifier of OpenPhone phone number. * @example PN123bc */ id: string; /** * @description The unique identifier of the group to which the OpenPhone number belongs. * @example 1234 */ groupId: string; /** * @description Timestamp of when the phone number was added to the account in ISO 8601 format. * @example '2022-01-01T00:00:00Z' */ createdAt: string; /** * @description Timestamp of the last update to the phone number's details in ISO 8601 format. * @example '2022-01-01T00:00:00Z' */ updatedAt: string; /** * @description The display name of the phone number * @example My phone number */ name: string; /** * @description A phone number in E.164 format, including the country code. * @example +15555555555 */ number: string; formattedNumber: string | null; forward: string | null; portRequestId: string | null; portingStatus: string | null; symbol: string | null; users: { email: string; firstName: string | null; groupId: string; id: string; lastName: string | null; role: string; }[]; restrictions: { messaging: { /** * @description The phone-number usage restriction status for a specific region * @example unrestricted * @enum {string} */ CA: 'restricted' | 'unrestricted'; /** * @description The phone-number usage restriction status for a specific region * @example unrestricted * @enum {string} */ US: 'restricted' | 'unrestricted'; /** * @description The phone-number usage restriction status for a specific region * @example unrestricted * @enum {string} */ Intl: 'restricted' | 'unrestricted'; }; calling: { /** * @description The phone-number usage restriction status for a specific region * @example unrestricted * @enum {string} */ CA: 'restricted' | 'unrestricted'; /** * @description The phone-number usage restriction status for a specific region * @example unrestricted * @enum {string} */ US: 'restricted' | 'unrestricted'; /** * @description The phone-number usage restriction status for a specific region * @example unrestricted * @enum {string} */ Intl: 'restricted' | 'unrestricted'; }; }; }[]; }; }; responses: never; parameters: never; requestBodies: never; headers: never; pathItems: never; } export type $defs = Record<string, never>; export interface operations { listCalls_v1: { parameters: { query: { phoneNumberId: string; userId?: string; participants: string[]; since?: string; createdAfter?: string; createdBefore?: string; maxResults: number; pageToken?: string; }; header?: never; path?: never; cookie?: never; }; requestBody?: never; responses: { /** @description Success */ 200: { headers: { [name: string]: unknown; }; content: { 'application/json': { data: { answeredAt: string | null; answeredBy: string | null; initiatedBy: string | null; /** * @description The direction of the call relative to the OpenPhone number. * @example incoming * @enum {string} */ direction: 'incoming' | 'outgoing'; /** * @description The current status of the call. * @example completed * @enum {string} */ status: 'queued' | 'initiated' | 'ringing' | 'in-progress' | 'completed' | 'busy' | 'failed' | 'no-answer' | 'canceled' | 'missed' | 'answered' | 'forwarded' | 'abandoned'; completedAt: string | null; /** * Format: date-time * @description The timestamp when the call record was created, in ISO 8601 format. * @example 2022-01-01T00:00:00Z */ createdAt: string; /** * @description The total duration of the call in seconds. * @example 60 */ duration: number; forwardedFrom: string | null; forwardedTo: string | null; /** * @description The unique identifier of the call. * @example AC123abc */ id: string; /** * @description The unique identifier of the OpenPhone number associated with the call. * @example PN123abc */ phoneNumberId: string; participants: string[]; updatedAt: string | null; /** * @description The unique identifier of the OpenPhone user account associated with the call. * @example US123abc */ userId: string; }[]; /** @description Total number of items available. ⚠️ Note: `totalItems` is not accurately returning the total number of items that can be paginated. We are working on fixing this issue. */ totalItems: number; nextPageToken: string | null; }; }; }; /** @description Too Many Participants */ 400: { headers: { [name: string]: unknown; }; content: { 'application/json': { message: string; /** @constant */ code: '0101400'; /** @constant */ status: 400; /** @constant */ docs: 'https://openphone.com/docs'; /** @constant */ title: 'Too Many Participants'; trace?: string; errors?: { path: string; message: string; value?: unknown; schema: { type: string; }; }[]; /** @constant */ description: 'Too Many Participants'; }; }; }; /** @description Unauthorized */ 401: { headers: { [name: string]: unknown; }; content: { 'application/json': { message: string; /** @constant */ code: '0100401'; /** @constant */ status: 401; /** @constant */ docs: 'https://openphone.com/docs'; /** @constant */ title: 'Unauthorized'; trace?: string; errors?: { path: string; message: string; value?: unknown; schema: { type: string; }; }[]; }; }; }; /** @description Not Phone Number User */ 403: { headers: { [name: string]: unknown; }; content: { 'application/json': { message: string; /** @constant */ code: '0101403'; /** @constant */ status: 403; /** @constant */ docs: 'https://openphone.com/docs'; /** @constant */ title: 'Not Phone Number User'; trace?: string; errors?: { path: string; message: string; value?: unknown; schema: { type: string; }; }[]; /** @constant */ description: 'Not Phone Number User'; }; }; }; /** @description Not Found */ 404: { headers: { [name: string]: unknown; }; content: { 'application/json': { message: string; /** @constant */ code: '0100404'; /** @constant */ status: 404; /** @constant */ docs: 'https://openphone.com/docs'; /** @constant */ title: 'Not Found'; trace?: string; errors?: { path: string; message: string; value?: unknown; schema: { type: string; }; }[]; }; }; }; /** @description Unknown Error */ 500: { headers: { [name: string]: unknown; }; content: { 'application/json': { message: string; /** @constant */ code: '0101500'; /** @constant */ status: 500; /** @constant */ docs: 'https://openphone.com/docs'; /** @constant */ title: 'Unknown'; trace?: string; errors?: { path: string; message: string; value?: unknown; schema: { type: string; }; }[]; }; }; }; }; }; getCallById_v1: { parameters: { query?: never; header?: never; path: { callId: string; }; cookie?: never; }; requestBody?: never; responses: { /** @description Success */ 200: { headers: { [name: string]: unknown; }; content: { 'application/json': { data: { answeredAt: string | null; answeredBy: string | null; initiatedBy: string | null; /** * @description The direction of the call relative to the OpenPhone number. * @example incoming * @enum {string} */ direction: 'incoming' | 'outgoing'; /** * @description The current status of the call. * @example completed * @enum {string} */ status: 'queued' | 'initiated' | 'ringing' | 'in-progress' | 'completed' | 'busy' | 'failed' | 'no-answer' | 'canceled' | 'missed' | 'answered' | 'forwarded' | 'abandoned'; completedAt: string | null; /** * Format: date-time * @description The timestamp when the call record was created, in ISO 8601 format. * @example 2022-01-01T00:00:00Z */ createdAt: string; /** * @description The total duration of the call in seconds. * @example 60 */ duration: number; forwardedFrom: string | null; forwardedTo: string | null; /** * @description The unique identifier of the call. * @example AC123abc */ id: string; /** * @description The unique identifier of the OpenPhone number associated with the call. * @example PN123abc */ phoneNumberId: string; participants: string[]; updatedAt: string | null; /** * @description The unique identifier of the OpenPhone user account associated with the call. * @example US123abc */ userId: string; }; }; }; }; /** @description Too Many Participants */ 400: { headers: { [name: string]: unknown; }; content: { 'application/json': { message: string; /** @constant */ code: '0101400'; /** @constant */ status: 400; /** @constant */ docs: 'https://openphone.com/docs'; /** @constant */ title: 'Too Many Participants'; trace?: string; errors?: { path: string; message: string; value?: unknown; schema: { type: string; }; }[]; /** @constant */ description: 'Too Many Participants'; }; }; }; /** @description Unauthorized */ 401: { headers: { [name: string]: unknown; }; content: { 'application/json': { message: string; /** @constant */ code: '0100401'; /** @constant */ status: 401; /** @constant */ docs: 'https://openphone.com/docs'; /** @constant */ title: 'Unauthorized'; trace?: string; errors?: { path: string; message: string; value?: unknown; schema: { type: string; }; }[]; }; }; }; /** @description Not Phone Number User */ 403: { headers: { [name: string]: unknown; }; content: { 'application/json': { message: string; /** @constant */ code: '0101403'; /** @constant */ status: 403; /** @constant */ docs: 'https://openphone.com/docs'; /** @constant */ title: 'Not Phone Number User'; trace?: string; errors?: { path: string; message: string; value?: unknown; schema: { type: string; }; }[]; /** @constant */ description: 'Not Phone Number User'; }; }; }; /** @description Not Found */ 404: { headers: { [name: string]: unknown; }; content: { 'application/json': { message: string; /** @constant */ code: '0100404'; /** @constant */ status: 404; /** @constant */ docs: 'https://openphone.com/docs'; /** @constant */ title: 'Not Found'; trace?: string; errors?: { path: string; message: string; value?: unknown; schema: { type: string; }; }[]; }; }; }; /** @description Unknown Error */ 500: { headers: { [name: string]: unknown; }; content: { 'application/json': { message: string; /** @constant */ code: '0101500'; /** @constant */ status: 500; /** @constant */ docs: 'https://openphone.com/docs'; /** @constant */ title: 'Unknown'; trace?: string; errors?: { path: string; message: string; value?: unknown; schema: { type: string; }; }[]; }; }; }; }; }; getCallRecordings_v1: { parameters: { query?: never; header?: never; path: { callId: string; }; cookie?: never; }; requestBody?: never; responses: { /** @description Success */ 200: { headers: { [name: string]: unknown; }; content: { 'application/json': { data: { duration: number | null; /** * @description The unique identifier of the call recording. * @example CRwRVK2qBq */ id: string; startTime: string | null; status: ('absent' | 'completed' | 'deleted' | 'failed' | 'in-progress' | 'paused' | 'processing' | 'stopped' | 'stopping') | null; type: string | null; url: string | null; }[]; }; }; }; /** @description Bad Request */ 400: { headers: { [name: string]: unknown; }; content: { 'application/json': { message: string; /** @constant */ code: '0900400'; /** @constant */ status: 400; /** @constant */ docs: 'https://openphone.com/docs'; /** @constant */ title: 'Bad Request'; trace?: string; errors?: { path: string; message: string; value?: unknown; schema: { type: string; }; }[]; }; }; }; /** @description Unauthorized */ 401: { headers: { [name: string]: unknown; }; content: { 'application/json': { message: string; /** @constant */ code: '0900401'; /** @constant */ status: 401; /** @constant */ docs: 'https://openphone.com/docs'; /** @constant */ title: 'Unauthorized'; trace?: string; errors?: { path: string; message: string; value?: unknown; schema: { type: string; }; }[]; }; }; }; /** @description Forbidden */ 403: { headers: { [name: string]: unknown; }; content: { 'application/json': { message: string; /** @constant */ code: '0900403'; /** @constant */ status: 403; /** @constant */ docs: 'https://openphone.com/docs'; /** @constant */ title: 'Forbidden'; trace?: string; errors?: { path: string; message: string; value?: unknown; schema: { type: string; }; }[]; }; }; }; /** @description Not Found */ 404: { headers: { [name: string]: unknown; }; content: { 'application/json': { message: string; /** @constant */ code: '0900404'; /** @constant */ status: 404; /** @constant */ docs: 'https://openphone.com/docs'; /** @constant */ title: 'Not Found'; trace?: string; errors?: { path: string; message: string; value?: unknown; schema: { type: string; }; }[]; }; }; }; /** @description Unknown Error */ 500: { headers: { [name: string]: unknown; }; content: { 'application/json': { message: string; /** @constant */ code: '0901500'; /** @constant */ status: 500; /** @constant */ docs: 'https://openphone.com/docs'; /** @constant */ title: 'Unknown'; trace?: string; errors?: { path: string; message: string; value?: unknown; schema: { type: string; }; }[]; }; }; }; }; }; getCallSummary_v1: { parameters: { query?: never; header?: never; path: { callId: string; }; cookie?: never; }; requestBody?: never; responses: { /** @description Success */ 200: { headers: { [name: string]: unknown; }; content: { 'application/json': { data: { /** * @description The unique identifier of the call to which this summary belongs. * @example ACea724hac8c30465bcbcff0b76e4c1c7b */ callId: string; nextSteps: string[] | null; /** * @description The status of the call summary. * @example completed * @enum {string} */ status: 'absent' | 'in-progress' | 'completed' | 'failed'; summary: string[] | null; jobs?: { icon: string; name: string; result: { data: { name: string; value: string | number | boolean; }[]; }; }[] | null; }; }; }; }; /** @description Bad Request */ 400: { headers: { [name: string]: unknown; }; content: { 'application/json': { message: string; /** @constant */ code: '0500400'; /** @constant */ status: 400; /** @constant */ docs: 'https://openphone.com/docs'; /** @constant */ title: 'Bad Request'; trace?: string; errors?: { path: string; message: string; value?: unknown; schema: { type: string; }; }[]; }; }; }; /** @description Unauthorized */ 401: { headers: { [name: string]: unknown; }; content: { 'application/json': { message: string; /** @constant */ code: '0500401'; /** @constant */ status: 401; /** @constant */ docs: 'https://openphone.com/docs'; /** @constant */ title: 'Unauthorized'; trace?: string; errors?: { path: string; message: string; value?: unknown; schema: { type: string; }; }[]; }; }; }; /** @description Forbidden */ 403: { headers: { [name: string]: unknown; }; content: { 'application/json': { message: string; /** @constant */ code: '0500403'; /** @constant */ status: 403; /** @constant */ docs: 'https://openphone.com/docs'; /** @constant */ title: 'Forbidden'; trace?: string; errors?: { path: string; message: string; value?: unknown; schema: { type: string; }; }[]; }; }; }; /** @description Not Found */ 404: { headers: { [name: string]: unknown; }; content: { 'application/json': { message: string; /** @constant */ code: '0500404'; /** @constant */ status: 404; /** @constant */ docs: 'https://openphone.com/docs'; /** @constant */ title: 'Not Found'; trace?: string; errors?: { path: string; message: string; value?: unknown; schema: { type: string; }; }[]; }; }; }; /** @description Unknown Error */ 500: { headers: { [name: string]: unknown; }; content: { 'application/json': { message: string; /** @constant */ code: '0501500'; /** @constant */ status: 500; /** @constant */ docs: 'https://openphone.com/docs'; /** @constant */ title: 'Unknown'; trace?: string; errors?: { path: string; message: string; value?: unknown; schema: { type: string; }; }[]; }; }; }; }; }; getCallTranscript_v1: { parameters: { query?: never; header?: never; path: { id: string; }; cookie?: never; }; requestBody?: never; responses: { /** @description Success */ 200: { headers: { [name: string]: unknown; }; content: { 'application/json': { data: { /** * @description The unique identifier of the call to which this transcript belongs. * @example ACea724hac8c30465bcbcff0b76e4c1c7b */ callId: string; /** * Format: date-time * @description The timestamp when the transcription was created, in ISO 8601 format. * @example 2022-01-01T00:00:00Z */ createdAt: string; dialogue: { /** * @description The transcribed text of a specific dialogue segment. * @example Hello, world! */ content: string; /** * @description The start time of the dialogue segment in seconds, relative to the beginning of the call. * @example 5.123456 */ start: number; /** * @description The end time of the dialogue segment in seconds, relative to the beginning of the call. * @example 10.123456 */ end: number; identifier: string | null; userId: string | null; }[] | null; /** * @description The total duration of the transcribed call in seconds. * @example 100 */ duration: number; /** * @description The status of the call transcription. * @example completed * @enum {string} */ status: 'absent' | 'in-progress' | 'completed' | 'failed'; }; }; }; }; /** @description Bad Request */ 400: { headers: { [name: string]: unknown; }; content: { 'application/json': { message: string; /** @constant */ code: '0600400'; /** @constant */ status: 400; /** @constant */ docs: 'https://openphone.com/docs