Skip to main content
POST
/
mobile_push_credentials
JavaScript
import Telnyx from 'telnyx';

const client = new Telnyx({
  apiKey: 'My API Key',
});

const pushCredentialResponse = await client.mobilePushCredentials.create({
  alias: 'LucyIosCredential',
  certificate:
    '-----BEGIN CERTIFICATE----- MIIGVDCCBTKCAQEAsNlRJVZn9ZvXcECQm65czs... -----END CERTIFICATE-----',
  private_key:
    '-----BEGIN RSA PRIVATE KEY----- MIIEpQIBAAKCAQEAsNlRJVZn9ZvXcECQm65czs... -----END RSA PRIVATE KEY-----',
  type: 'ios',
});

console.log(pushCredentialResponse.data);
{
  "data": {
    "id": "0ccc7b54-4df3-4bcb-a65a-3da1ecc997d7",
    "certificate": "-----BEGIN CERTIFICATE----- MIIGVDCCBTKCAQEAsNlRJVZn9ZvXcECQm65czs... -----END CERTIFICATE-----",
    "private_key": "-----BEGIN RSA PRIVATE KEY----- MIIEpQIBAAKCAQEAsNlRJVZn9ZvXcECQm65czs... -----END RSA PRIVATE KEY-----",
    "project_account_json_file": {
      "private_key": "BBBB0J56jd8kda:APA91vjb11BCjvxx3Jxja...",
      "client_email": "account@customer.org"
    },
    "alias": "LucyCredential",
    "type": "ios",
    "record_type": "push_credential",
    "created_at": "2021-03-26T17:51:59.588408Z",
    "updated_at": "2021-03-26T17:51:59.588408Z"
  }
}

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Body

application/json

Mobile push credential parameters that need to be sent in the request

  • Create iOS push credential request
  • Create Android Push Credential Request
type
enum<string>
required

Type of mobile push credential. Should be <code>ios</code> here

Available options:
ios
certificate
string
required

Certificate as received from APNs

Example:

"-----BEGIN CERTIFICATE----- MIIGVDCCBTKCAQEAsNlRJVZn9ZvXcECQm65czs... -----END CERTIFICATE-----"

private_key
string
required

Corresponding private key to the certificate as received from APNs

Example:

"-----BEGIN RSA PRIVATE KEY----- MIIEpQIBAAKCAQEAsNlRJVZn9ZvXcECQm65czs... -----END RSA PRIVATE KEY-----"

alias
string
required

Alias to uniquely identify the credential

Example:

"LucyIosCredential"

Response

Mobile push credential created

Success response with details about a push credential

data
object