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

# Approve sample request

> Approves a pending sample request. Sends sample_request.approved. When the sample was picked during the creator's campaign application, the application is accepted too.

Approves a **pending** sample request and sends the `sample_request.approved` [webhook event](https://growi.mintlify.site/essentials/custom-store-samples.md#webhook-events). Create the order on your side after this call, or when you receive the webhook.

When the creator picked the sample while applying to the campaign, their application is accepted too, the same as on Shopify stores.

> [!NOTE]
>
> Requires a full-access API key (read-only keys are rejected).

## Path parameters

| Parameter | Type | Description | Required |
| - | - | - | - |
| `id` | Integer | Sample request id | Yes |

No request body is needed.

## Request example

```bash theme={"dark"}
curl -X POST "https://api.growi.io/api/public/v1/sample_requests/812345/approve" \
  -H "Authorization: Bearer YOUR_PUBLIC_API_KEY"
```

## Response

Returns the updated sample request in `data`, with `"status": "approved"`. See [List sample requests](https://growi.mintlify.site/api-reference/endpoint/list-sample-requests.md) for the fields.

## Error responses

**403: read-only API key**

```json theme={"dark"}
{ "error": "This API key is read-only and cannot modify data." }
```

**404: not found for your organization**

```json theme={"dark"}
{ "error": "Sample request not found" }
```

**422: the request is not pending**

```json theme={"dark"}
{ "error": "Cannot mark a shipped sample request as approved" }
```


## OpenAPI

````yaml POST /sample_requests/{id}/approve
openapi: 3.0.1
info:
  title: Growi API
  description: >-
    API documentation for Growi platform, showcasing the public tracking event
    endpoint
  license:
    name: MIT
  version: 1.0.0
servers:
  - url: https://api.growi.io/api/public/v1
security:
  - bearerAuth: []
paths:
  /sample_requests/{id}/approve:
    post:
      summary: Approve Sample Request
      description: >-
        Approves a pending sample request. Sends sample_request.approved. When
        the sample was picked during the creator's campaign application, the
        application is accepted too.
      parameters:
        - name: id
          in: path
          required: true
          description: Sample request id
          schema:
            type: integer
      responses:
        '200':
          description: Sample request approved
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    $ref: '#/components/schemas/SampleRequest'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: Read-only API key
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: Sample request not found for your organization
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '422':
          description: The request is not pending
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
components:
  schemas:
    SampleRequest:
      type: object
      properties:
        id:
          type: integer
          description: Sample request id
        status:
          type: string
          enum:
            - pending
            - approved
            - shipped
            - delivered
            - completed
            - rejected
            - cancelled
        campaign_id:
          type: integer
        campaign_name:
          type: string
        campaign_affiliate_id:
          type: integer
          nullable: true
          description: The creator's campaign enrollment id
        source:
          type: string
          description: >-
            campaign_application (picked while applying), creator_request
            (requested after joining), or sample_program
        creator:
          type: object
          properties:
            user_id:
              type: integer
            name:
              type: string
            first_name:
              type: string
            last_name:
              type: string
              nullable: true
            email:
              type: string
              nullable: true
            phone:
              type: string
              nullable: true
        product:
          type: object
          properties:
            id:
              type: integer
            title:
              type: string
              description: The product name the brand entered
            sku:
              type: string
              nullable: true
              description: The brand's product SKU
            url:
              type: string
              nullable: true
            image_url:
              type: string
              nullable: true
            shopify_id:
              type: string
              nullable: true
            tik_tok_id:
              type: string
              nullable: true
            amazon_product_id:
              type: string
              nullable: true
        variant:
          type: object
          nullable: true
          properties:
            id:
              type: integer
            title:
              type: string
              nullable: true
            display_name:
              type: string
              nullable: true
            sku:
              type: string
              nullable: true
              description: >-
                The brand's variant SKU. For a product without variants, the
                product SKU
            external_id:
              type: string
              nullable: true
              description: Null for brand sample products
            price:
              type: number
              nullable: true
        quantity:
          type: integer
          description: >-
            Units to ship: the quantity approved for the request, or the
            quantity the creator asked for
        shipping_address:
          type: object
          nullable: true
          description: >-
            Where to ship the sample. Null for a pending request from a
            marketplace creator.
          properties:
            first_name:
              type: string
              nullable: false
            last_name:
              type: string
              nullable: false
            address_line_1:
              type: string
              nullable: false
            address_line_2:
              type: string
              nullable: true
            city:
              type: string
              nullable: false
            state:
              type: string
              nullable: true
            postal_code:
              type: string
              nullable: false
            country:
              type: string
              nullable: false
            phone:
              type: string
              nullable: true
        order_id:
          type: string
          nullable: true
          description: Your order id, once reported
        order_name:
          type: string
          nullable: true
        tracking_url:
          type: string
          nullable: true
        created_at:
          type: string
          format: date-time
        updated_at:
          type: string
          format: date-time
    Error:
      required:
        - error
        - message
      type: object
      properties:
        error:
          type: string
        message:
          type: string
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.