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

# Create a scheduled or a draft post

> Returns an id of the post



## OpenAPI

````yaml /openapi.yaml post /post
openapi: 3.1.0
info:
  version: 1.1.0
  title: Ocoya API
  description: REST API reference for Ocoya.
servers:
  - url: https://app.ocoya.com/api/_public/v1
security:
  - ApiKeyAuth: []
paths:
  /post:
    post:
      summary: Create a scheduled or a draft post
      description: Returns an id of the post
      parameters:
        - in: query
          name: workspaceId
          required: true
          description: Ocoya workspace ID. Get one from `GET /workspaces`.
          schema:
            type: string
            example: cmayvq3hk00017apshay5qezu
      requestBody:
        content:
          application/json:
            schema:
              oneOf:
                - type: object
                  required:
                    - caption
                    - mediaUrls
                  properties:
                    caption:
                      type: string
                      description: Text caption for the post.
                      example: Happy new year everyone!
                    mediaUrls:
                      type: array
                      description: Publicly accessible media URLs to attach to the post.
                      example:
                        - https://yourmediaurl.com
                    socialProfileIds:
                      type: array
                      description: >-
                        Connected social profile IDs that should receive the
                        post. Get IDs from `GET /social-profiles`.
                      example:
                        - clh49poxf008x8kov4ncbjty9
                    scheduledAt:
                      type: string
                      description: >-
                        ISO 8601 datetime when the post should be scheduled.
                        Omit to save as draft.
                      example: '2024-01-01T00:00:00Z'
                - type: object
                  required:
                    - caption
                  properties:
                    caption:
                      type: string
                      description: Text caption for the post.
                      example: Happy new year everyone!
                    socialProfileIds:
                      type: array
                      description: >-
                        Connected social profile IDs that should receive the
                        post. Get IDs from `GET /social-profiles`.
                      example:
                        - clh49poxf008x8kov4ncbjty9
                    scheduledAt:
                      type: string
                      description: >-
                        ISO 8601 datetime when the post should be scheduled.
                        Omit to save as draft.
                      example: '2024-01-01T00:00:00Z'
                - type: object
                  required:
                    - mediaUrls
                  properties:
                    mediaUrls:
                      type: array
                      description: Publicly accessible media URLs to attach to the post.
                      example:
                        - https://yourmediaurl.com
                    socialProfileIds:
                      type: array
                      description: >-
                        Connected social profile IDs that should receive the
                        post. Get IDs from `GET /social-profiles`.
                      example:
                        - clh49poxf008x8kov4ncbjty9
                    scheduledAt:
                      type: string
                      description: >-
                        ISO 8601 datetime when the post should be scheduled.
                        Omit to save as draft.
                      example: '2024-01-01T00:00:00Z'
      responses:
        '201':
          description: Created
        '500':
          description: Unknown error
components:
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: X-API-Key

````