> ## Documentation Index
> Fetch the complete documentation index at: https://docs.surge.app/llms.txt
> Use this file to discover all available pages before exploring further.

# Send blast

> Sends a Blast.



## OpenAPI

````yaml POST /accounts/{account_id}/blasts
openapi: 3.1.1
info:
  title: Surge
  version: '1.0'
servers:
  - url: https://api.surge.app
security:
  - authorization: []
paths:
  /accounts/{account_id}/blasts:
    post:
      tags:
        - Blasts
      summary: Send a blast
      description: Sends a Blast.
      operationId: SendBlast
      parameters:
        - in: path
          name: account_id
          required: true
          schema:
            description: The account for which the blast should be sent.
            example: acct_01j9a43avnfqzbjfch6pygv1td
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/BlastParams'
        required: true
      responses:
        '201':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Blast'
          description: Created blast
        default:
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Error
      x-codeSamples:
        - lang: JavaScript
          source: >-
            import Surge from '@surgeapi/node';


            const client = new Surge({
              apiKey: process.env['SURGE_API_KEY'], // This is the default and can be omitted
            });


            const blast = await
            client.blasts.create('acct_01j9a43avnfqzbjfch6pygv1td');


            console.log(blast.id);
        - lang: Python
          source: |-
            import os
            from surge import Surge

            client = Surge(
                api_key=os.environ.get("SURGE_API_KEY"),  # This is the default and can be omitted
            )
            blast = client.blasts.create(
                account_id="acct_01j9a43avnfqzbjfch6pygv1td",
            )
            print(blast.id)
        - lang: Go
          source: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/stainless-sdks/surge-go\"\n\t\"github.com/stainless-sdks/surge-go/option\"\n)\n\nfunc main() {\n\tclient := surge.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tblast, err := client.Blasts.New(\n\t\tcontext.TODO(),\n\t\t\"acct_01j9a43avnfqzbjfch6pygv1td\",\n\t\tsurge.BlastNewParams{},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", blast.ID)\n}\n"
        - lang: Ruby
          source: |-
            require "surge_api"

            surge = SurgeAPI::Client.new(api_key: "My API Key")

            blast = surge.blasts.create("acct_01j9a43avnfqzbjfch6pygv1td")

            puts(blast)
        - lang: PHP
          source: >-
            <?php


            require_once dirname(__DIR__) . '/vendor/autoload.php';


            use Surge\Client;

            use Surge\Core\Exceptions\APIException;


            $client = new Client(apiKey: getenv('SURGE_API_KEY') ?: 'My API
            Key');


            try {
              $blast = $client->blasts->create(
                'acct_01j9a43avnfqzbjfch6pygv1td',
                attachments: [['url' => 'https://example.com/image.jpg']],
                body: 'Join us for our grand opening!',
                contacts: ['ctc_01jxwtp1vse91twb5bj977gav9'],
                from: '+18015552345',
                name: 'Grand Opening Announcement',
                segments: ['aud_01jxwtwzqhfykb31dt6mvpsa9k'],
                sendAt: new \DateTimeImmutable('2024-02-01T15:00:00Z'),
                to: [
                  'aud_01j9dy8mdzfn3r0e8x1tbdrdrf',
                  'ctc_01j9dy8mdzfn3r0e8x1tbdrdrf',
                  '+18015551234',
                  '+18015555678',
                ],
              );

              var_dump($blast);
            } catch (APIException $e) {
              echo $e->getMessage();
            }
components:
  schemas:
    BlastParams:
      description: Parameters for creating a Blast
      example:
        attachments:
          - url: https://example.com/image.jpg
        body: Join us for our grand opening!
        from: '+18015552345'
        name: Grand Opening Announcement
        send_at: '2024-02-01T15:00:00Z'
        to:
          - aud_01j9dy8mdzfn3r0e8x1tbdrdrf
          - ctc_01j9dy8mdzfn3r0e8x1tbdrdrf
          - '+18015551234'
          - '+18015555678'
      properties:
        attachments:
          items:
            $ref: '#/components/schemas/AttachmentParams'
          type: array
        body:
          description: The message body.
          type:
            - string
            - 'null'
        contacts:
          deprecated: true
          description: Deprecated. Use `to` instead.
          items:
            example: ctc_01jxwtp1vse91twb5bj977gav9
            format: id
            type: string
          type: array
          x-stainless-deprecation-message: Use `to` to specify recipients instead.
        from:
          description: >-
            The phone number from which to send the blast. This can be either
            the phone number in E.164 format or a Surge phone number id. If not
            provided, the account's default phone number is used.
          example: '+18015552345'
          pattern: ^\+[1-9]\d{6,14}$|^\d{5,6}$|^pn_[[:alnum:]]{26}$
          type: string
        name:
          description: Optional name for the blast.
          type: string
        segments:
          deprecated: true
          description: Deprecated. Use `to` with audience IDs instead.
          items:
            example: aud_01jxwtwzqhfykb31dt6mvpsa9k
            format: id
            type: string
          type: array
          x-stainless-deprecation-message: >-
            Use `to` with audience IDs (`aud_...`) to specify audience
            recipients instead.
        send_at:
          description: When to send the blast. If not provided, sends immediately.
          format: date-time
          type: string
        to:
          description: >-
            List of recipients to whom the blast should be sent. This can be a
            combination of contact IDs, audience IDs, and phone numbers.
          items:
            oneOf:
              - example: ctc_01jxwtp1vse91twb5bj977gav9
                format: id
                type: string
              - example: aud_01jxwtwzqhfykb31dt6mvpsa9k
                format: id
                type: string
              - example: '+18015551234'
                format: phone-number
                pattern: ^\+[1-9]\d{6,14}$
                type: string
          type: array
      required: []
      title: BlastParams
      type: object
    Blast:
      description: A Blast is a message sent to multiple recipients at once.
      example:
        attachments:
          - url: https://example.com/image.jpg
        body: Join us for our grand opening!
        id: bst_01j9dy8mdzfn3r0e8x1tbdrdrf
        name: Grand Opening Announcement
        send_at: '2024-02-01T15:00:00Z'
      properties:
        attachments:
          items:
            properties:
              url:
                description: The URL of the attachment.
                type: string
            type: object
          type: array
        body:
          description: The message body.
          type:
            - string
            - 'null'
        id:
          description: Unique identifier for the object.
          type: string
        name:
          description: Optional name for the blast.
          type: string
        send_at:
          description: When the blast will be or was sent.
          format: date-time
          type: string
      title: Blast
      type: object
    ErrorResponse:
      description: An error response
      example:
        error:
          message: The requested resource could not be found.
          type: not_found
      properties:
        error:
          $ref: '#/components/schemas/Error'
      required:
        - error
      title: ErrorResponse
      type: object
    AttachmentParams:
      description: Params for creating an attachment
      example:
        url: https://toretto.family/coronas.gif
      properties:
        url:
          description: The URL of the attachment.
          type: string
      required:
        - url
      title: AttachmentParams
      type: object
    Error:
      description: An error response
      example:
        message: The requested resource was not found.
        type: not_found
      properties:
        detail:
          additionalProperties: true
          description: Additional details about the error.
          type: object
        message:
          description: A human-readable error message.
          example: The requested resource was not found.
          type: string
        type:
          description: A unique error code.
          example: not_found
          type: string
      required:
        - type
        - message
      title: Error
      type: object
  securitySchemes:
    authorization:
      bearerFormat: Surge API token
      scheme: bearer
      type: http

````