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

# Create a post

> This endpoint lets you create a post or a draft post on Google / Facebook / Instagram.

The creation of a post will not happen in real time and might take a few minutes.

A draft post can only be created by Org Admins and is not immediately published. 
An expiration date must be specified when creating a draft post.
In order to be published, a draft needs to be updated by a BM/GM user before the expiration date.




## OpenAPI

````yaml /assets/openapi/openapi-bundled.yaml post /posts
openapi: 3.1.0
info:
  title: Partoo Rest API
  version: v2
  license:
    name: © Copyright Partoo
    url: https://www.partoo.co/en/gtu-api/
  x-logo:
    url: >-
      https://partoo-client-images.s3.amazonaws.com/logo-partoo-restapi-white.png
  description: >
    ## Introduction

    The Partoo Rest API allows you to automate all the actions that are possible
    to do in the Partoo Web Application.


    The Partoo Rest API can be used for many different purposes:
      - Create/update/delete your businesses & users if you are a client.
      - Create/subscribe/manage organizations, businesses & users if you are a reseller.
      - Retrieve data on businesses you have access to if you are a publisher.
      - ...
servers:
  - url: https://api.partoo.co/v2
    description: Production server
  - url: https://api.sandbox.partoo.co/v2
    description: Sandbox server (dev environment for clients & partners)
security:
  - ApiKeyAuth: []
paths:
  /posts:
    post:
      tags:
        - Posts
      summary: Create a post
      description: >
        This endpoint lets you create a post or a draft post on Google /
        Facebook / Instagram.


        The creation of a post will not happen in real time and might take a few
        minutes.


        A draft post can only be created by Org Admins and is not immediately
        published. 

        An expiration date must be specified when creating a draft post.

        In order to be published, a draft needs to be updated by a BM/GM user
        before the expiration date.
      operationId: createPost
      requestBody:
        required: true
        content:
          application/json:
            schema:
              description: Request body to create a Post
              type: object
              required:
                - business_search
                - data
                - publishers
              properties:
                business_search:
                  $ref: '#/components/schemas/PostBusinessSearch'
                publishers:
                  $ref: '#/components/schemas/PostPublishers'
                data:
                  $ref: '#/components/schemas/PostData'
                is_draft:
                  description: >-
                    If true, the post will be created as a draft. You must then
                    also specify an `expiration_time` in the body's data.
                  type: boolean
                  default: false
                send_notifications:
                  description: >-
                    If true, a notification email will be sent to all BM/GM
                    users that have access to this draft post
                  type: boolean
                  default: false
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/requestResponsePost'
        '401':
          $ref: '#/components/responses/401'
        '403':
          $ref: '#/components/responses/403'
        '404':
          $ref: '#/components/responses/404'
components:
  schemas:
    PostBusinessSearch:
      description: Business to create post
      type: object
      required:
        - business__in
      properties:
        business__in:
          type: array
          items:
            $ref: '#/components/schemas/business_ids'
    PostPublishers:
      description: List of publisher to diffuse the post
      type: array
      items:
        type: string
        enum:
          - google_my_business
          - facebook
          - instagram
      example:
        - google_my_business
        - facebook
        - instagram
    PostData:
      description: Information on post to create
      type: object
      required:
        - post_type
        - summary
      properties:
        post_type:
          $ref: '#/components/schemas/postType'
        summary:
          $ref: '#/components/schemas/postSummary'
        image_url:
          $ref: '#/components/schemas/postImageURL'
        title:
          $ref: '#/components/schemas/postTitle'
        cta_type:
          $ref: '#/components/schemas/postCTAType'
        link:
          $ref: '#/components/schemas/postLink'
        schedule_time:
          $ref: '#/components/schemas/postScheduleTime'
        expiration_time:
          $ref: '#/components/schemas/postExpirationTime'
        coupon_code:
          $ref: '#/components/schemas/postCouponCode'
        offer_terms:
          $ref: '#/components/schemas/postOfferTerms'
        start_at:
          $ref: '#/components/schemas/postStartAt'
        end_at:
          $ref: '#/components/schemas/postEndAt'
    requestResponsePost:
      properties:
        status:
          description: Request status
          type: string
          enum:
            - success
        code:
          description: Request code
          type: number
          example: 200
        message:
          description: Number of post(s) created
          type: string
          example: 2 posts have been created.
        ids:
          deprecated: true
          description: Id(s) of post(s) created
          type: string
          example: 45,46
        data:
          description: Post ID and relative business ID pair list
          type: array
          items:
            type: object
            properties:
              post_id:
                type: integer
              business_id:
                type: string
          example:
            - post_id: 101
              business_id: '1234567890'
            - post_id: 102
              business_id: '1234567891'
    business_ids:
      description: List of business ids
      type: array
      example:
        - 5409c35a97bbc544d8e26737
        - 595badaef348ab6b3530033f
        - 59d53302b12ff6429f262639
      items:
        $ref: '#/components/schemas/BusinessId'
    postType:
      type: string
      description: >-
        The type of the post to be created. Event and Offer are not yet
        available for Facebook.
      enum:
        - news
        - event
        - offer
        - covid
    postSummary:
      type: string
      description: Main text content of the post.
      example: Wonderful post summary !
    postImageURL:
      description: |
        URLs of the images displayed with the post.

        **Note:**
          - Add up to 10 images for multi-image post on Facebook and IG
          - Multi-image is not supported by Google, only the first image will be displayed
          - Image ratio must be between 4:5 and 16:9 for IG
          - All images must be same ratio for IG or they will be crop at the first image ratio by IG
      anyOf:
        - type: string
        - type: array
          items:
            type: string
      example:
        - https://example.com/1.png
        - https://example.com/2.png
    postTitle:
      type: string
      description: Title of the post.
      example: Great post title !
    postCTAType:
      description: The type of the post to be created. Some type mig.
      type: string
      enum:
        - book
        - order
        - shop
        - learn_more
        - sign_up
        - call
        - no_cta
    postLink:
      description: >-
        Link displayed in the post to redirect the client clicking on it. Use
        can only have one of the following parameters ('use_business_url' or
        'custom_url').
      type: object
      properties:
        use_business_url:
          type: boolean
          description: Use the business google url for link on the post.
        custom_url:
          type: string
          description: An URL to redirect client when they click on the button
    postScheduleTime:
      type: string
      description: >-
        Date and time of when the post will be diffused corresponding platforms.
        It needs to be at least 2 hours after the time of the request. The
        timezone used is UTC.
      example: '2050-01-01T09:00:00'
    postExpirationTime:
      type: string
      description: >-
        This parameter is mandatory when creating a draft post. It indicates
        when the draft will expire, the time after which BM/GM users will no
        longer be able to validate and publish the post
      example: '2050-01-01T09:00:00'
    postCouponCode:
      type: string
      description: Offer code that is usable in store or online
      example: PROMO25
    postOfferTerms:
      type: string
      description: Terms and conditions of the offer
      example: These are the conditions
    postStartAt:
      type: string
      description: >-
        For either event or offer post type. Defined when it start. Timezone is
        defined by the business timezone.
      example: '2050-01-01T09:00:00'
    postEndAt:
      type: string
      description: >-
        For either event or offer post type. Defined when it end. Timezone is
        defined by the business timezone.
      example: '2050-01-01T09:00:00'
    BusinessId:
      description: Business id
      type: string
      example: 5409c35a97bbc544d8e26737
  responses:
    '401':
      description: You are not authenticated
      content:
        application/json:
          schema:
            description: Error that occurs when you are not authenticated
            type: object
            properties:
              errors:
                type: object
                description: The detail of the error encountered
                properties:
                  authentication:
                    type: string
                    default: User not authenticated
    '403':
      description: |
        You are not allowed to perform this action
      content:
        application/json:
          schema:
            description: >
              Error that occurs when you are authenticated but you are trying to
              perform an action you are not allowed to perform
            type: object
            properties:
              errors:
                type: object
                description: The detail of the error encountered
                properties:
                  authorization:
                    type: string
                    default: Operation not allowed
    '404':
      description: Resource does not exist
      content:
        application/json:
          schema:
            description: >-
              Error that occcurs when you are trying to reach a resource that
              does not exist
            type: object
            properties:
              errors:
                type: object
                description: The detail of the error encountered
                properties:
                  json:
                    type: string
                    default: Resource not found
  securitySchemes:
    ApiKeyAuth:
      description: >
        The authentication system on Partoo API is using API Key that should be
        put in the header of the request (the name of the header is `x-APIKey`).
        An api_key is linked to a user. This user's role will give you different
        access level to the API features.
      type: apiKey
      in: header
      name: x-APIKey

````