Add a new push notification credential to your account

POST /v1/Credentials

A Credential resource represents a push notification credential.

Add a new push notification credential to your account

Body

  • ApiKey string

    [GCM only] The API key for the project that was obtained from the Google Developer console for your GCM Service application credential.

  • [APN only] The URL encoded representation of the certificate. For example, -----BEGIN CERTIFICATE----- MIIFnTCCBIWgAwIBAgIIAjy9H849+E8wDQYJKoZIhvcNAQEF.....A== -----END CERTIFICATE-----.

  • A descriptive string that you create to describe the new resource. It can be up to 64 characters long.

  • [APN only] The URL encoded representation of the private key. For example, -----BEGIN RSA PRIVATE KEY----- MIIEpQIBAAKCAQEAuyf/lNrH9ck8DmNyo3fG... -----END RSA PRIVATE KEY-----.

  • Sandbox boolean

    [APN only] Whether to send the credential to sandbox APNs. Can be true to send to sandbox APNs or false to send to production.

  • Secret string

    [FCM only] The Server key of your project from the Firebase console, found under Settings / Cloud messaging.

  • Type string Required

    The type of push-notification service the credential is for. Can be: fcm, gcm, or apn.

    Values are apn, gcm, or fcm.

Responses

  • Created

    Hide response attributes Show response attributes object
    • account_sid string | null

      The unique ID of the Account responsible for this credential.

      Minimum length is 34, maximum length is 34. Format should match the following pattern: ^AC[0-9a-fA-F]{32}$.

    • date_created string(date-time) | null

      The date that this resource was created.

    • date_updated string(date-time) | null

      The date that this resource was last updated.

    • friendly_name string | null

      The human-readable name of this credential.

    • sandbox string | null

      [APN only] Whether to send the credential to sandbox APNs.

    • sid string | null

      A 34 character string that uniquely identifies this resource.

      Minimum length is 34, maximum length is 34. Format should match the following pattern: ^CR[0-9a-fA-F]{32}$.

    • type string | null

      The type of push-notification service the credential is for.

      Values are apn, gcm, or fcm.

    • url string(uri) | null

      An absolute URL for this credential.

POST /v1/Credentials
curl \
 -X POST https://conversations.twilio.com/v1/Credentials \
 --user "username:password" \
 -H "Content-Type: application/x-www-form-urlencoded" \
 -d 'ApiKey=string&Certificate=string&FriendlyName=string&PrivateKey=string&Sandbox=true&Secret=string&Type=apn'
Request example
{
  "ApiKey": "string",
  "Certificate": "string",
  "FriendlyName": "string",
  "PrivateKey": "string",
  "Sandbox": true,
  "Secret": "string",
  "Type": "apn"
}
Request examples
{
  "ApiKey": "string",
  "Certificate": "string",
  "FriendlyName": "string",
  "PrivateKey": "string",
  "Sandbox": true,
  "Secret": "string",
  "Type": "apn"
}
Response examples (201)
{
  "account_sid": "string",
  "date_created": "2023-05-04T09:42:00+00:00",
  "date_updated": "2023-05-04T09:42:00+00:00",
  "friendly_name": "string",
  "sandbox": "string",
  "sid": "string",
  "type": "apn",
  "url": "https://example.com"
}
Response examples (201)
{
  "account_sid": "string",
  "date_created": "2024-05-04T09:42:00+00:00",
  "date_updated": "2024-05-04T09:42:00+00:00",
  "friendly_name": "string",
  "sandbox": "string",
  "sid": "string",
  "type": "apn",
  "url": "https://example.com"
}